Skip to content

Latest commit

 

History

History
52 lines (32 loc) · 1.4 KB

File metadata and controls

52 lines (32 loc) · 1.4 KB

CSV Example

What This Teaches

Use this when product, customer, or spreadsheet-like data starts as CSV. db scans the header row, infers field shapes, generates types, and mirrors the rows into JSON runtime state.

Files To Inspect

Run It

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

pnpm run db -- sync --cwd ./examples/csv
pnpm run db -- serve --cwd ./examples/csv

Open the local data explorer:

http://127.0.0.1:7331/__db

Expected Result

sync writes .db/state/customers.json. When db/customers.csv changes, the source hash changes and the JSON store refreshes from CSV.

REST Request To Try

Leave serve running and run this from another terminal:

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

Features To Notice

Cleanup

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

More Docs