Skip to content

Implement Phase 1 foundation: monorepo, database, auth, CI#29

Merged
fusion94 merged 7 commits intomainfrom
feat/phase1-foundation
Feb 9, 2026
Merged

Implement Phase 1 foundation: monorepo, database, auth, CI#29
fusion94 merged 7 commits intomainfrom
feat/phase1-foundation

Conversation

@fusion94
Copy link
Contributor

@fusion94 fusion94 commented Feb 9, 2026

Summary

  • Scaffold npm workspaces monorepo with shared Zod schemas, Fastify API, and Vite + React frontend
  • Set up SQLite database with Drizzle ORM (6 tables, FTS5 search, WAL mode) and realistic seed data
  • Implement JWT authentication with access/refresh token rotation and reuse detection
  • Add GitHub Actions CI pipeline and local development workflow tooling

Changes

  • monorepo: Root workspace config with TypeScript 5.7, ESLint 9 flat config, Prettier, Vitest
  • packages/shared: Zod validation schemas, inferred TypeScript types, and constants for all entities (wines, bottles, tasting notes, storage locations, users, auth)
  • apps/api: Fastify 5 server with CORS, Zod type provider, pino logging, graceful shutdown
  • apps/api/db: Drizzle ORM schema for 6 tables with indexes, FTS5 virtual table with sync triggers, migration runner, seed script (~50 wines, ~130 bottles, ~30 tasting notes)
  • apps/api/auth: @fastify/jwt plugin with access (15min) and refresh (7d) namespaces, bcrypt password hashing, refresh token rotation with reuse detection, requireAuth/requireAdmin middleware
  • apps/api/routes: Health endpoint (GET /api/health), auth endpoints (login, refresh, logout)
  • apps/web: Vite 6 + React 19 placeholder app with API proxy config
  • ci: GitHub Actions workflow with lint, typecheck, unit tests, functional tests, and e2e test jobs
  • dev workflow: .env.example, updated .gitignore, README with quick start guide and test accounts

Test Plan

  • Clone repo, run npm install && cp .env.example .env && npm run db:migrate && npm run db:seed && npm run dev
  • Verify curl http://localhost:3001/api/health returns {"status":"ok",...}
  • Verify login: curl -X POST http://localhost:3001/api/auth/login -H 'Content-Type: application/json' -d '{"email":"admin@cellarsync.local","password":"adminpassword1"}' returns tokens
  • Verify token refresh with returned refresh token returns new token pair
  • Verify logout with refresh token returns 204, then refresh with same token returns 401
  • Verify http://localhost:5173 loads React app and shows API health status
  • Verify npm run lint && npm run typecheck pass with zero errors

Set up monorepo structure with packages/shared (Zod schemas, types,
constants), apps/api (Fastify 5), and apps/web (Vite 6 + React 19).
Configure TypeScript, ESLint 9 flat config, Prettier, and Vitest.
Define 6 Drizzle ORM tables (users, wines, bottles, tasting_notes,
storage_locations, refresh_tokens) with indexes. Add FTS5 virtual
table with sync triggers, migration runner, and seed script with
~50 wines, ~130 bottles, and sample tasting notes.
Implement buildServer() factory with CORS, Zod type provider, pino
logging, and structured error handler. Add GET /api/health endpoint
with graceful shutdown on SIGINT/SIGTERM.
Add @fastify/jwt plugin with access (15min) and refresh (7d) token
namespaces. Implement login, refresh, and logout endpoints with
bcrypt password verification, refresh token rotation, and reuse
detection. Add requireAuth and requireAdmin middleware.
Configure CI pipeline with lint-and-typecheck, unit-tests, and
functional-tests jobs running in parallel after lint passes. Add
e2e-tests job with Playwright and coverage artifact uploads.
Add .env.example with all configuration variables documented.
Update .gitignore for data/, .drizzle/, playwright artifacts.
Rewrite README with quick start guide, test accounts, and
available scripts reference.
@fusion94 fusion94 added type:feature New feature or capability type:setup Project scaffolding and configuration area:backend Fastify API, services, middleware area:database SQLite schema, migrations, queries area:infra GCP, Nginx, CI/CD, deployment area:security Auth, validation, hardening labels Feb 9, 2026
@fusion94 fusion94 merged commit 10b9955 into main Feb 9, 2026
4 checks passed
@fusion94 fusion94 deleted the feat/phase1-foundation branch February 9, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Fastify API, services, middleware area:database SQLite schema, migrations, queries area:infra GCP, Nginx, CI/CD, deployment area:security Auth, validation, hardening type:feature New feature or capability type:setup Project scaffolding and configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant