3b4c220a45c45e6cd5efc1708e19691397d68652
Phase 0 research resolves the library choices (jsonwebtoken + bcryptjs, chosen partly to avoid native-build friction on Windows dev environments), the Redis-backed revocation-denylist shape (reusing 002's own jti-replay-protection pattern exactly), a 4-hour token lifetime, and why fastify.authenticate populating the already-shared reqContext.actorId/actorType retroactively makes every audit trail since 007 accurate for real agent/admin actions instead of always 'unknown'. Also surfaces and scopes a real gap found along the way: User (login identity) and Agent (routing/skills profile) have never been linked. Adds Agent.userId as a nullable FK now (cheap, additive) without building the actual linking workflow, which belongs in 006's own identity/agents admin screens as a later, separate piece of work. Phase 1 adds data-model.md, the login/self-identity/account-creation/ logout contract, and five quickstart scenarios including a specific requirement to re-verify at least one already-shipped admin route per module (002-009), not just this feature's own new endpoints. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
SupportHub API
Development (Docker)
- Start all services:
docker compose --env-file .env.development -f docker-compose.development.yml up -d --build - Start only database & cache (for local app development):
docker compose --env-file .env.development -f docker-compose.development.yml up -d postgres redis
Test (Docker)
docker compose --env-file .env.test -f docker-compose.test.yml up --build
Production (Docker)
docker compose --env-file .env.prod -f docker-compose.prod.yml up --build -d
Stop / Down
- Stop production:
docker compose -f docker-compose.prod.yml down - Stop development:
docker compose -f docker-compose.development.yml down - Stop development & wipe volumes:
docker compose --env-file .env.development -f docker-compose.development.yml down -v
List Containers & Logs
- List containers:
docker compose --env-file .env.development -f docker-compose.development.yml ps - Follow logs:
docker compose --env-file .env.development -f docker-compose.development.yml logs -f
Local Development (Host)
- Start database & cache in Docker:
docker compose --env-file .env.development -f docker-compose.development.yml up -d postgres redis - Start API server in watch mode:
npm run dev
Database Migrations & Prisma
-
Generate Prisma Client:
npm run prisma:generate -
Run / Apply Dev Migrations:
npx dotenv-cli -e .env.development -- npm run prisma:migrate -
Deploy Migrations (Production/CI):
npx dotenv-cli -e .env.development -- npm run prisma:deploy -
Push Schema directly (Sync schema without migration files):
npx dotenv-cli -e .env.development -- npx prisma db push
Database Seeding
- Seed Database (Roles, Products, Categories, Hierarchy & Demo data):
npx dotenv-cli -e .env.development -- npm run prisma:seed
Languages
TypeScript
93.2%
PowerShell
6.5%
JavaScript
0.2%