Project Structure
Make the repo feel familiar fast.
Goal
Get a fast map of where code lives and how to extend it safely.
Monorepo overview
- Workspaces live under workers/*.
- The primary app is workers/app.
Why a monorepo
- Keep infra, app, and docs in one deployable unit.
- Share configs and utilities without extra packages.
Cloudflare
- The local Cloudflare resource are created in .wrangler in the monorepo root.
- Cloudflare wants the wrangler files in the worker code so to interact with a resource like D1 use any workers wrangler file.
Shared packages
- UI primitives: workers/app/src/components/ui.
- Layout and shared components: workers/app/src/components.
Config files
- Next.js config: workers/app/next.config.ts.
- Cloudflare bindings: workers/app/wrangler.jsonc.
- Content pipeline: workers/app/velite.config.ts.
Where to put new code
- App routes and server actions: workers/app/src/app.
- Database schema: workers/app/src/db/schema.
- Marketing pages: workers/app/src/app/(marketing).
What not to edit initially
- Keep wrangler.jsonc stable until you understand the bindings.
- Prefer server actions over new API routes unless required.
- Scrutinize any new 'use client' components to keep bundles small.