@async/db

Fixture to contract workflow

File-backed JSON data, from fixture to production contract.

Start with db/*.json, infer useful schema metadata, serve local REST and viewer routes, then graduate each resource behind stable operation refs when production constraints appear.

install

Start from a package install.

pnpm add @async/db
pnpm exec async-db sync
pnpm exec async-db serve

Keep serve running, then open http://127.0.0.1:7331/__db.

db/users.json fixture
[
  {
    "id": "u_1",
    "name": "Ada",
    "plan": "founder"
  }
]
sync output schema + types
User.plan enum
GET /db/users.json route
production boundary resource-level
json sqlite postgres ops refs

01 fixture

Editable source files in `db/`.

02 contract

Inferred or explicit resource schema.

03 local API

REST, GraphQL metadata, and viewer state.

04 graduate

Registered operations and store choices.

Keep local routes local, then expose reviewed operations.

Use fixture-like routes while the data shape is moving. When the app-facing contract settles, move browser traffic to registered operation refs, app-owned auth, and explicit route exposure rules.

GET /db/users.json POST /__db/operations/GetUserProfile server.expose.rest = "registered-only" server.expose.viewer = "dev"

Operation refs are allowlist identifiers, not secrets. They keep route shape reviewable while normal app policy still owns authentication, authorization, limits, and monitoring.

Example paths stay visible.

The docs point readers toward concrete repo examples instead of abstract feature claims.

See the advanced map
basic advanced production-json local-web-app schema-manifest schema-ui rest-client standard-schema