Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/michael-tiger-2010/dragonjson/llms.txt

Use this file to discover all available pages before exploring further.

dragonJSON is a single-file ES module (client/web-client.js) with zero external dependencies — there is nothing to install and no build step required. Drop the file into your project, point an import at it, and you are ready to go. The Node.js server reference implementation is equally self-contained, relying only on Node’s built-in http and url modules.

Client setup

Copy client/web-client.js from the dragonJSON repository into your project, then import it as a standard ES module:
import dragonJSON from './web-client.js';

const [server, control] = dragonJSON("https://your-api.example.com", {
  enableBatching: true,
});
Because web-client.js uses only standard browser APIs (fetch and Proxy), no bundler or transpiler is needed. It works as-is in any modern browser or in Node.js 18+.

Server setup

The repository ships a ready-to-run Node.js reference server at server/nodejs/server.js. Start the server:
node server/nodejs/server.js
Override the default port (3000):
PORT=8080 node server/nodejs/server.js
No npm install is required. The server uses only Node.js built-in modules (http and url). Swapping in your own data store: The reference server uses a simple in-memory object. To connect dragonJSON to a real database, replace the three data-access functions:
FunctionResponsibility
getByPath(pathArray)Read a value from the store at the given path.
setByPath(pathArray, value)Write or update a value at the given path.
deleteByPath(pathArray)Remove the entry at the given path.
These are the only functions that interact with storage; everything else — request routing, batch handling, invalidation responses — is handled by the server framework layer and does not need to change.

Browser compatibility

The dragonJSON client relies on two standard platform features:
  • fetch — the browser Fetch API for HTTP requests.
  • Proxy — the ES2015 Proxy object for path interception.
Both are supported in all modern evergreen browsers and in Node.js 18+. No polyfills are needed for current browser versions. If you need to support older environments, a fetch polyfill (such as whatwg-fetch) is sufficient for the network layer; Proxy cannot be polyfilled and requires a natively compliant runtime.

Writing your own server

The dragonJSON wire protocol is language-agnostic. Any HTTP server that speaks JSON can act as a dragonJSON backend as long as it honours the expected request shapes, response formats, batch protocol, and invalidate contract. See the Server Specification for the full contract, including the __more, __batch, and mutation response conventions.
Property names in your data must not contain ., cannot be then or exists, and cannot start with $. These names are reserved by the dragonJSON proxy for path separation, promise interception, and built-in methods respectively.

Build docs developers (and LLMs) love