Development setup
Prereqs
Section titled “Prereqs”- Node.js ≥ 20 LTS.
- Docker (for Postgres + Redis via the compose dev profile).
- A GitHub account with access to the repo.
Clone + install
Section titled “Clone + install”git clone https://github.com/workforce0/workforce0cd workforce0git submodule update --init --recursive # vendored skills + subagents
cd backend && npm installcd ../frontend && npm installcd ../agent && npm installcd ../docs-site && npm installBoot infra
Section titled “Boot infra”Lightweight dev profile brings up Postgres + Redis only:
docker compose -f docker-compose.dev.yml up -dCheck health:
docker compose -f docker-compose.dev.yml psEnvironment
Section titled “Environment”cp .env.example .env# Edit .env:# REDIS_URL=redis://localhost:6379# JWT_SECRET=<openssl rand -hex 32># GEMINI_API_KEY=... (or any other provider)Run the services
Section titled “Run the services”# Terminal 1 — backendcd backendnpm run db:generatenpm run db:migratenpm run dev # http://localhost:3000
# Terminal 2 — frontendcd frontendnpm run dev # http://localhost:3001
# Terminal 3 — docs site (this site, while you're editing docs)cd docs-sitenpm run dev # http://localhost:4321
# Terminal 4 — agent daemon (optional; for dev/QA code-gen)cd agentWORKFORCE0_AGENT_TOKEN=<from-UI> npm run devDatabase UI
Section titled “Database UI”cd backendnpm run db:studio # Prisma Studio at localhost:5555Project scripts
Section titled “Project scripts”Per-workspace scripts:
backend
npm run dev— auto-restart on change.npm run build— production build.npm run start— run the production build.npm test— Vitest unit + integration.npm run typecheck— TS strict pass.npm run lint— ESLint.
frontend
npm run dev— Next.js dev server.npm run build— static export.npm run start— serve build.npm test— Vitest.npm run e2e— Playwright.npm run typecheck— TS pass.
docs-site
npm run dev— Astro dev.npm run build— static build.npm run preview— preview build.
Git workflow
Section titled “Git workflow”- Branch:
git checkout -b feat/short-name. - Commit convention:
feat: …,fix: …,refactor: …,docs: …,test: …,chore: …. - Push:
git push -u origin feat/short-name. - Open PR against
main. CI runs typecheck + tests + e2e. - Address review; rebase if needed; merge.
Pre-commit checks
Section titled “Pre-commit checks”We use a lightweight pre-push hook (.husky/):
npm run typecheck(per workspace).npm teston changed workspaces.
Bypass with --no-verify only for emergency fixes; the CI still
runs them.
Code style
Section titled “Code style”- TypeScript strict mode. No
anyunless genuinely dynamic. - Prettier + ESLint for formatting / lint.
- 2-space indent. Semicolons.
- Comments only when the “why” isn’t obvious from the code.
Testing discipline
Section titled “Testing discipline”- Unit tests live in
__tests__/next to the code. - Integration tests hit real Postgres + Redis (see the
workforce0-test-*dev containers). - Mock LLM clients in unit tests; real LLMs in integration tests only when behind a feature flag.
- Aim for coverage on business logic services. UI components get e2e coverage.
Schema changes
Section titled “Schema changes”- Edit
backend/prisma/schema.prisma. cd backend && npx prisma migrate dev --name descriptive_name.- Verify the generated SQL in
prisma/migrations/. - Commit the migration file.
What NOT to do
Section titled “What NOT to do”- Don’t commit
.env. - Don’t commit node_modules.
- Don’t bypass the RLS middleware.
- Don’t import provider SDKs directly — go through
ModelRegistryService. - Don’t
rm -rf node_modulesas your first debugging step.