This project is built for spec-driven development with a small, inspectable codebase. Keep changes focused, follow existing patterns, and validate behavior before updating the roadmap.
- Prefer existing patterns in
app/,components/,lib/services/, andlib/db/. - Keep route handler behavior explicit: validate input, check auth when needed, call
QueryService, return clear JSON responses. - Keep database access behind
QueryServiceandAppDatabase. - Keep shared input validation in
lib/validation.ts. - Avoid new dependencies unless they clearly improve a real project need.
- Keep docs aligned with source files and scripts.
| Area | Pattern |
|---|---|
| Pages | App Router pages under app/, with server-side data loading where practical. |
| Forms | Client components that submit to route handlers and show inline feedback. |
| API routes | Route handlers in app/api/, exporting dynamic = 'force-dynamic' for runtime data. |
| Auth | Browser state in AuthProvider, page protection in middleware.ts, API protection in lib/auth/middleware.ts. |
| Data | SQL in QueryService, runtime D1 adapter, SQLite-compatible test path. |
| Styles | PicoCSS plus project CSS in styles/layout.css and styles/admin-layout.css. |
npm test -- --run
npm run lint
npm run buildAdditional useful commands:
npm run test
npm run test:ui
npm run test:coverage
npm run workers:buildRun npm run workers:build when a change touches runtime APIs, middleware, database adapters, deployment config, or anything Cloudflare-specific.
| Area | Examples |
|---|---|
| Database and schema | lib/db/*.test.ts, tests/db.test.ts |
| Auth | tests/auth.test.tsx, tests/auth-context.test.tsx, tests/middleware.test.ts |
| API routes | tests/api-routes.test.ts, tests/demo-reset.test.ts |
| App and components | tests/app.test.tsx, component tests, booking form tests |
Tests use Vitest, React Testing Library, and jsdom where needed.
- Read the relevant spec in
specs/. - Inspect the current implementation before editing.
- Make the smallest cohesive change that satisfies the spec.
- Add or update tests when behavior changes.
- Run targeted tests while working.
- Run the standard checks before finalizing:
npm test -- --run
npm run lint
npm run build- Update
CHANGELOG.mdandspecs/roadmap.mdwhen a phase or visible feature is completed.
When changing project behavior, update the docs page that owns the topic:
- Setup or commands: Getting Started
- Architecture or flow: Architecture
- Routes, validation, seed data, or persistence: API And Data
- Auth, roles, cookies, or secrets: Auth And Security
- Deployment: Cloudflare Workers Deployment
- Operations or troubleshooting: Operations And Troubleshooting
There is no version-controlled CI/CD pipeline in the current MVP. Treat local validation commands as the required quality gate until a future phase adds automated CI.