- Next.js 14 App Router + TypeScript strict + pnpm + Tailwind - Clerk auth middleware (routes /dashboard protected, /sign-in exposed) - Drizzle ORM + Postgres schema: users, wallets, addresses, transactions, price_snapshots, categories with proper enums + FKs - OpenSpec 1.4.1 initialized with Claude Code skills/commands - openspec/project.md: CTO architecture decisions (BCH Q1, oracle Q2, auth Q6, DB/ORM, polyrepo, k8s hosting) - openspec/config.yaml: spec-driven schema + project context - openspec/changes/scaffold-app: first change with specs (5 ADDED requirements, validate --all passes) - Multi-stage Dockerfile (deps → builder → runner, node:20-alpine) - k8s manifests: namespace, deployment, service, ingress (infra/k8s/) Co-Authored-By: Paperclip <noreply@paperclip.ing>
2.7 KiB
ADDED Requirements
Requirement: Repository and toolchain
The repository MUST be a standalone polyrepo (using-cash/app) with pnpm as package manager, Next.js 14 App Router, TypeScript strict mode, and Tailwind CSS.
Scenario: Fresh developer setup
Given the developer has Node.js 20 and pnpm installed
When they clone git.falkvinge.net/using-cash/app and run pnpm install
Then all dependencies resolve without errors and pnpm run build produces a working Next.js output
Requirement: Authentication integration
The app MUST integrate Clerk (@clerk/nextjs) for user authentication, protecting all routes under /dashboard and exposing sign-in/sign-up at /sign-in and /sign-up.
Scenario: Unauthenticated dashboard access
Given a user who is not signed in
When they navigate to /dashboard
Then they are redirected to /sign-in by the Clerk middleware
Scenario: Authenticated access
Given a user with a valid Clerk session
When they navigate to /dashboard
Then the page renders without redirect
Requirement: Database connectivity
The app MUST connect to PostgreSQL 16 via Drizzle ORM using the DATABASE_URL environment variable. The initial schema SHALL define tables for users, wallets, addresses, transactions, price_snapshots, and categories as specified in src/db/schema.ts.
Scenario: Schema generation
Given the Drizzle schema in src/db/schema.ts
When pnpm db:generate is run
Then Drizzle Kit generates SQL migration files without type errors
Scenario: Missing database URL
Given DATABASE_URL is not set
When the app starts in production mode
Then it fails with a clear configuration error before accepting requests
Requirement: OpenSpec workflow gate
All changes to this codebase MUST have an OpenSpec proposal in openspec/changes/<slug>/ before implementation. The command openspec validate --all SHALL pass in CI before any PR is merged.
Scenario: CI validation gate
Given a new change proposal exists in openspec/changes/<slug>/
When openspec validate --all is run in CI
Then it exits 0 only if the proposal and all specs are structurally valid
Requirement: Container and deployment
The app MUST ship as a multi-stage Docker image deployable to the existing k8s cluster. Deployment manifests SHALL live in infra/k8s/ following the PRO-148 conventions.
Scenario: Docker build
Given the Dockerfile at the repo root
When docker build -t using-cash-app . is run
Then the build completes and the resulting image starts with node server.js
Scenario: k8s manifest apply
Given the manifests in infra/k8s/
When kubectl apply -f infra/k8s/ is run against the target cluster
Then the namespace, deployment, service, and ingress resources are created without errors