Installation
For the complete documentation index, see llms.txt. Prefer markdown by appending .md to documentation URLs or sending Accept: text/markdown.

Project structure

Understand the Edge Kit layout. Where routes, modules, infrastructure adapters, the database, and Cloudflare config live.

Edge Kit is a single package, not a monorepo. Everything for the Worker lives in one repository root, so there are no workspaces or internal packages to wire up.

Repository structure

router.tsx
server.ts
routeTree.gen.ts
.env.local
env.config.ts
wrangler.jsonc
vite.config.ts
oxlint.config.ts
oxfmt.config.ts
package.json

Two layers for app code

App code is split into infrastructure and features, and src/routes stays a thin URL map on top:

LayerOwnsExamples
src/lib/Shared adapters reused by many featuresauth, billing, email, kv, queue, storage, log, i18n
src/modules/<f>/One product capability end-to-endauth, billing, dashboard, marketing, user
src/routes/URL composition onlypages, webhooks, OAuth catch-alls
src/db/Tables and clientDrizzle schema

Add new capabilities under src/modules/<feature>/ instead of creating new top-level folders like src/payment/ or src/mail/.

Routes

src/routes holds TanStack Router file routes:

__root.tsx
sitemap[.]xml.ts
robots[.]txt.ts

Individual ppages call createServerFn handlers from modules. Keep src/routes/api for webhooks and other inbound HTTP only.

Generated files

Never edit src/routeTree.gen.ts, worker-configuration.d.ts, src/lib/i18n/, .content-collections/, or src/db/schema/auth.ts by hand. They're regenerated by Vite, pnpm cf-typegen, Paraglide, content collections, and pnpm db:generate.

Take a look at the feature recipe to see how these layers come together in a new notes module.

How is this guide?

Last updated on

On this page

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