Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.edgespark.dev/llms.txt

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

EdgeSpark uses a declarative workflow for app tables, storage buckets, runtime keys, and auth config. The source of truth is your repo, not a dashboard editor. Agents should edit repo-authored defs, generate migrations, apply declarative config, pull generated SDK types when needed, and never hand-write platform types.

Files to read before writing code

Every EdgeSpark project has two important categories of files:
FilePurposeEdit it?
server/src/defs/db_schema.tsApp table definitionsYes
server/src/defs/db_relations.tsApp relationsYes
server/src/defs/storage_schema.tsBucket declarationsYes
server/src/defs/runtime.tsAllowed var and secret keysYes
server/src/__generated__/sys_schema.tsPulled system-managed tablesNo
server/src/__generated__/sys_relations.tsPulled system-managed relationsNo
server/src/__generated__/edgespark.d.tsGenerated imports from edgesparkNo
server/src/__generated__/server-types.d.tsGenerated runtime SDK typesNo
Never edit files in server/src/__generated__/. They are overwritten by pull commands.

Commands you should use

# App schema workflow
edgespark db generate
edgespark db migrate
edgespark db check

# Generated platform files
edgespark pull schema
edgespark pull types
edgespark pull types --check

# Bucket and auth config sync
edgespark storage apply
edgespark auth apply
1

Read repo-authored defs

Start with server/src/defs/db_schema.ts, server/src/defs/storage_schema.ts, and server/src/defs/runtime.ts. These files tell you what the app intends to own.
2

Read generated runtime types

Open server/src/__generated__/edgespark.d.ts and server/src/__generated__/server-types.d.ts before using runtime SDK imports. Do not guess import names or method signatures.
3

Update schema or buckets in code

Add tables in db_schema.ts, relations in db_relations.ts, buckets in storage_schema.ts, and runtime key names in runtime.ts.
4

Run the matching sync command

edgespark db generate
edgespark db migrate
edgespark storage apply
edgespark pull types
5

Write handlers against typed imports

server/src/index.ts
import { db } from "edgespark";
import { Hono } from "hono";
import { posts } from "@defs";

const app = new Hono().get("/api/posts", async (c) => {
  return c.json(await db.select().from(posts));
});

export default app;
6

Type check before deploy

cd server && npx tsc --noEmit

When to pull

Use edgespark pull schema when you need the latest platform-managed tables or system metadata in server/src/__generated__/. Use edgespark pull types when runtime SDK types may be stale. In automation or CI, use:
edgespark pull types --check

See also

Use the database

How to define schema, generate migrations, and query D1 in the current scaffold.

Handling errors

How to fix stale types, migration issues, and deploy failures.
Last modified on April 7, 2026