Skip to content

Local Development

The graphdb dev command wraps wrangler dev --local and boots the complete stack on your machine:

ServiceLocal equivalent
Cloudflare WorkersMiniflare in-process runtime
Durable Objects (GraphShard)Miniflare DO emulation
D1 (graph metadata)Local SQLite file
KV (schema cache)In-memory KV store
VectorizeIn-memory vector index
R2 (backups)Local filesystem bucket

No cloud account is needed. No billing surprises.

  • Node.js 20+
  • pnpm 9+
  • Cloned core repository
  1. Install dependencies

    Terminal window
    pnpm install
  2. Copy the environment example

    Terminal window
    cp .env.example .env
  3. Start the local stack

    Terminal window
    pnpm graphdb dev

    You should see output like:

    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
    graphdb-labs local stack
    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
    ✓ D1 database ready (local SQLite)
    ✓ GraphShard DO ready (Miniflare)
    ✓ KV store ready
    ✓ Vectorize index ready
    ✓ API listening on http://localhost:8787
  4. Create your first graph

    Terminal window
    curl -X POST http://localhost:8787/graphs \
    -H "Content-Type: application/json" \
    -H "X-Tenant-Id: dev-tenant" \
    -d '{"name": "my-graph", "description": "Test graph"}'

In production, every request must carry a verified X-Internal-Sig trust header (issued by edge-gateway).
In ENVIRONMENT=development, the trust middleware automatically bypasses signature verification and accepts any X-Tenant-Id you provide.

CommandDescription
pnpm graphdb devStart local stack
pnpm graphdb schema pushPush schema changes to local D1
pnpm graphdb schema generateGenerate Drizzle migration files
core/
└── .wrangler/
└── state/
├── d1/ ← local SQLite files
├── kv/ ← KV store snapshots
└── r2/ ← R2 bucket files

Delete this directory to reset all local state.