Installation
For the complete documentation index, see llms.txt. Prefer markdown by appending .md to documentation URLs or sending Accept: 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:

~/.bashrc
alias p='pnpm'

Or, if you're using Zsh, you can add the alias to ~/.zshrc:

~/.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 install

Development server

Start the Vite dev server on the Workers runtime at http://localhost:3000:

pnpm dev

Production build

To create a production build, run:

pnpm build

To build and serve it locally with vite preview, run:

pnpm preview

Cleanup

To remove node_modules, build output, and generated caches, run:

pnpm clean

Then, reinstall the dependencies:

pnpm install

Formatting

To check for formatting errors using Oxfmt, run:

pnpm format

To fix formatting errors, run:

pnpm format:fix

Linting

To check for linting errors using Oxlint, run:

pnpm lint

To fix linting errors, run:

pnpm lint:fix

Type 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-typegen

Routes

To regenerate src/routeTree.gen.ts from the files in src/routes, run:

pnpm generate-routes

Content

To rebuild the MDX content collections (blog and legal pages), run:

pnpm content

Database 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:setup

Migration generation

To regenerate the Better Auth tables in src/db/schema/auth.ts and create a new migration with Drizzle Kit, run:

pnpm db:generate

It 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 --local

To apply them to the production database, run:

pnpm db:migrate --remote

Production 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:seed

Test commands

Unit and Worker tests

To run the configured Vitest projects, run:

pnpm test

To run them in watch mode, run:

pnpm test:watch

The 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:e2e

The 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 email

It starts the preview on http://localhost:3005.

Environment inspector

To inspect and validate your env setup in the envin UI, run:

pnpm env

It starts on http://localhost:3333.

Deployment

To build, apply remote D1 migrations, and publish the Worker, run:

pnpm deploy

See the deployment guide for the one-time setup of Cloudflare resources and secrets.

How is this guide?

Last updated on

On this page

Ship globally on the edge. In minutes.Try Edge Kit