Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Data-First Example

What This Teaches

Use this when you have fixture data before you have a contract. db infers collections, singleton documents, REST routes, GraphQL fields, and TypeScript types from plain JSON.

Files To Inspect

Run It

From the repository root, use the repo-internal CLI path:

npm run db -- sync --cwd ./examples/data-first
npm run db -- serve --cwd ./examples/data-first

Open the viewer:

http://127.0.0.1:7331/__db

Expected Result

sync infers schema and writes generated runtime state under examples/data-first/.db/.

REST Request To Try

Leave serve running and run this from another terminal:

curl 'http://127.0.0.1:7331/db/users.json?select=id,name,email'

Features To Notice

Cleanup

Generated .db/ output is ignored by git and can be removed whenever you want a fresh mirror.

More Docs