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.
pnpm scripts call Vite+ for the dev server, builds, formatting, linting, and tests. Code generation is a set of cached tasks in vite.config.ts. Run those with the Vite+ CLI, vp. If vp is not on your PATH, use pnpm exec vp run <task>.
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 that output locally, run:
pnpm previewCleanup
To remove node_modules, build output, and generated caches, run:
pnpm cleanThen, reinstall the dependencies:
pnpm installChecks
To run formatting, linting, and type checking together, run:
pnpm checkTo apply the format and lint fixes in the same pass, run:
pnpm check:fixCI uses pnpm check before the test suite. pnpm format and pnpm lint still run those pieces on their own while you are editing. The rules live in the fmt and lint blocks of vite.config.ts.
Formatting
To check formatting with Oxfmt, run:
pnpm formatTo fix formatting, run:
pnpm format:fixLinting
To check lint with Oxlint, run:
pnpm lintTo fix lint findings, run:
pnpm lint:fixType checking
Oxlint runs in type-aware mode, so pnpm lint and pnpm check report real TypeScript errors. There's no separate typecheck script. If you need raw compiler output, run pnpm exec tsc --noEmit.
Code generation
These tasks are cached. Vite+ reruns one when its inputs change.
Cloudflare binding types
After changing wrangler.jsonc, regenerate worker-configuration.d.ts:
vp run cf-typegenRoutes
To regenerate src/routeTree.gen.ts from the files in src/routes, run:
vp run generate-routesContent
To rebuild the MDX content collections (blog and legal pages), run:
vp run contentDatabase commands
The database is D1 managed through Drizzle and Wrangler.
Local database setup
To apply migrations to the local replica and seed the development users, 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.
Reset database
To reset the database, run:
pnpm db:resetIt will reset the database to its initial state.
Seed data
To seed your local database with an admin and a regular user (for development purposes), run:
pnpm db:seedTheir emails are derived from SEED_EMAIL, such as me+admin@turbostarter.dev and me+user@turbostarter.dev, and both use SEED_PASSWORD.
Test commands
Unit and Worker tests
To run the Vitest projects configured in vite.config.ts, 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