For the complete documentation index, see llms.txt. Prefer markdown by appending.mdto documentation URLs or sendingAccept: text/markdown.
Common commands
Common pnpm, Wrangler, and D1 commands for daily Edge Kit work. Dev server, builds, linting, migrations, tests, and deploys.
For sure, you don't need these commands to kickstart your project, but it's useful to know they exist for when you need them.
Command aliases
You can set up aliases for these commands in your shell configuration file. For example, you can set up an alias for pnpm to p:
alias p='pnpm'Or, if you're using Zsh, you can add the alias to ~/.zshrc:
alias p='pnpm'Then run source ~/.bashrc or source ~/.zshrc to apply the changes.
Environment loading
To inject environment variables from your env file into a command, prefix it with with-env:
pnpm with-env <command>Commands that need them, like pnpm email and pnpm db:seed, already do it for you.
Dependencies
pnpm installDevelopment server
Start the Vite dev server on the Workers runtime at http://localhost:3000:
pnpm devProduction build
To create a production build, run:
pnpm buildTo build and serve it locally with vite preview, run:
pnpm previewCleanup
To remove node_modules, build output, and generated caches, run:
pnpm cleanThen, reinstall the dependencies:
pnpm installFormatting
To check for formatting errors using Oxfmt, run:
pnpm formatTo fix formatting errors, run:
pnpm format:fixLinting
To check for linting errors using Oxlint, run:
pnpm lintTo fix linting errors, run:
pnpm lint:fixType checking
Oxlint runs in type-aware mode, so pnpm lint reports real TypeScript errors. There's no separate typecheck script. If you need raw compiler output, run pnpm exec tsc --noEmit.
Code generation
Cloudflare binding types
After changing wrangler.jsonc, regenerate worker-configuration.d.ts:
pnpm cf-typegenRoutes
To regenerate src/routeTree.gen.ts from the files in src/routes, run:
pnpm generate-routesContent
To rebuild the MDX content collections (blog and legal pages), run:
pnpm contentDatabase commands
The database is D1 managed through Drizzle and Wrangler.
Local database setup
To apply migrations to the local replica and seed a development user, run:
pnpm db:setupMigration generation
To regenerate the Better Auth tables in src/db/schema/auth.ts and create a new migration with Drizzle Kit, run:
pnpm db:generateIt will create a new .sql file in the drizzle folder.
The auth generator overwrites src/db/schema/auth.ts only. Keep custom tables in other files under src/db/schema/ and export them from src/db/schema/index.ts. For an application-only change, use pnpm exec drizzle-kit generate instead. Follow schema changes before generating SQL.
Migrations
To apply pending migrations to the local database, run:
pnpm db:migrate --localTo apply them to the production database, run:
pnpm db:migrate --remoteProduction migrations
--remote changes your production data. pnpm deploy already runs it for you, so you rarely need to call it manually.
Seed data
To seed your local database with the development user (for development purposes), run:
pnpm db:seedTest commands
Unit and Worker tests
To run the configured Vitest projects, run:
pnpm testTo run them in watch mode, run:
pnpm test:watchThe current suite contains billing unit tests. A Worker project is configured but has no shipped Worker test files; see unit and Worker tests before adding binding-backed coverage.
End-to-end tests
To run browser end-to-end tests with Playwright, run:
pnpm test:e2eThe default suite builds the app and starts its own local Worker harness. See end-to-end testing for browser installation, fixtures, and failure artifacts.
Tooling commands
Email preview
To preview and edit React Email templates, run:
pnpm emailIt starts the preview on http://localhost:3005.
Environment inspector
To inspect and validate your env setup in the envin UI, run:
pnpm envIt starts on http://localhost:3333.
Deployment
To build, apply remote D1 migrations, and publish the Worker, run:
pnpm deploySee the deployment guide for the one-time setup of Cloudflare resources and secrets.
How is this guide?
Last updated on