Architecture
Overview
The scaffolded project is a single Cloudflare Worker that serves both the API and the SPA. In development, Vite proxies /api/* requests to the Worker.
┌─────────────┐ /api/rpc/* ┌──────────────┐
│ React SPA │ ──────────────────→ │ Hono Worker │
│ (Vite) │ │ (Wrangler) │
│ │ ←────────────────── │ │
│ :5173 │ JSON/superjson │ :8787 │
└─────────────┘ └──────┬───────┘
│
┌──────┴───────┐
│ D1 (SQLite) │
│ R2 (Storage)│
│ Images │
└──────────────┘Monorepo layout
apps/
├── api/ # Hono API — routes, lib, tests
└── web/ # React SPA — pages, components, hooks
packages/
├── core/ # Shared DB schema, auth, utilities, services
└── ui/ # Radix UI components (Button, Card, Badge, etc.)Key decisions
| Concern | Choice |
|---|---|
| API framework | Hono — lightweight, fast, CF Worker-native |
| Frontend | React 19 + react-router-dom v7 |
| Styling | Tailwind CSS v4 + tw-animate-css |
| Database | Drizzle ORM + Cloudflare D1 |
| Auth | Better Auth — Drizzle adapter, email/password |
| UI components | Radix primitives + class-variance-authority |
| Data fetching | TanStack Query |
| Serialization | Superjson — Date, Map, Set survive RPC |
| Monorepo | Turborepo |
| Lint/format | Biome |
| Testing | Vitest |
| Deployment | Cloudflare Workers — single Worker, API + SPA |