Skip to content
Docs
ExtendUpdated 2026-08-20

Add a product module

Create a domain, persistence, API, UI, configuration, activity, tests, and documentation without breaking module boundaries.

Define the workflow

Write the user-visible start and finish condition before writing files. A module is a complete workflow, not a route name.

Create the domain

Place business operations in src/<module>/. Keep persistence and external protocols behind those operations.

Add persistence

Extend src/db/schema.ts, generate a Drizzle migration, and review indexes, ownership, cascades, and idempotency.

bash
pnpm db:generate
pnpm db:migrate:local

Add server APIs

Routes should validate input, require the correct session or administrator role, call the domain, and return a stable response shape.

Add the product surface

Use the public shell or authenticated app shell as appropriate. Reuse UI primitives, loading and error states, theme tokens, and responsive conventions.

Record activity

Emit meaningful lifecycle events through the activity module. Do not include reusable secrets or unbounded payloads.

Test the module

  • Unit-test business and security invariants.
  • Add a deterministic local adapter for external dependencies.
  • Close the main workflow in Playwright.
  • Exercise mobile and accessibility when the module has UI.
  • Run production build and Wrangler dry run when bindings change.

Document configuration

Add a documentation page, .env.example entries, CLI behavior when relevant, and a production smoke checklist.

TanStarter SES documentationBuilt with TanStack Start and Content Collections.