TurboStarter
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.

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 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 that output locally, run:

pnpm preview

Cleanup

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

pnpm clean

Then, reinstall the dependencies:

pnpm install

Checks

To run formatting, linting, and type checking together, run:

pnpm check

To apply the format and lint fixes in the same pass, run:

pnpm check:fix

CI 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 format

To fix formatting, run:

pnpm format:fix

Linting

To check lint with Oxlint, run:

pnpm lint

To fix lint findings, run:

pnpm lint:fix

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

Routes

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

vp run generate-routes

Content

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

vp run content

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

Reset database

To reset the database, run:

pnpm db:reset

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

Their 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 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