Phase 0-3 Build Plan (this scaffold's working core)
Historical scope note: this doc describes the plan for the very first build pass (Phase 0-3 only). Everything through Phase 20 is now WORKING — see
docs/phase-plan/roadmap.md's "Current status vs. what's still ahead" anddocs/architecture/service-catalog.mdfor the up-to-date picture. The local dev topology described below (no Kubernetes, plain Node processes, gateway reverse-proxy, Docker only for infra) still holds for the whole repo, not just Phase 0-3 — that part of this doc remains current.
Scope
Repo foundation + tooling (Phase 0), API gateway + auth (Phase 1), merchant onboarding/RBAC/API keys (Phase 2), seller identity federation (Phase 3) — implemented with real logic, not stubs, in the very first build pass. (Everything else has since graduated to WORKING too — see the note above.)
Local dev topology
No Kubernetes, no container orchestration for application code. Each Phase 0-3 service is its
own NestJS process on its own port; api-gateway reverse-proxies to them. Only infra
dependencies (Postgres, Redis, OpenSearch, MinIO) run in Docker via
infra/docker/docker-compose.dev.yml — with a documented native-install fallback since Docker
Desktop isn't confirmed installed on this machine.
| Port | Service |
|---|---|
| 3000 | services/api-gateway |
| 3001 | services/auth-service |
| 3002 | services/merchant-service |
| 3003 | services/seller-identity-service |
| 3004 | services/event-service |
| 4000 | apps/docs-site |
| 3100 | apps/merchant-dashboard |
| 3200 | apps/exchange-web |
| 5432 | Postgres (docker-compose) |
| 6379 | Redis (docker-compose) |
| 9200 | OpenSearch (docker-compose) |
| 9000 | MinIO (docker-compose) |
Build order actually followed in this scaffold
- Root tooling (
package.jsonworkspaces,tsconfig.base.json, lint/format/commit hooks). docs/— business model, conflicts, pricing, architecture, API, security, legal flags, roadmap — written before code so every service's README can correctly reference the resolved logic instead of drifting from it.packages/db-schema— Prisma schema for all Phase 0-3 tables plus the Phase 4-10 core tables (listings/offers/trade-sessions/etc.) that are cheap to define now and expensive later.packages/types,utils,config,event-contracts,core-auth— shared code the working services depend on, built before the services themselves.packages/openapi-spec— Phase 0-3 resources fully specified.services/auth-service,services/merchant-service,services/seller-identity-service,services/event-service,services/api-gateway— in this order, since each depends on the previous (gateway last, since it routes to all the others).packages/sdk-js,packages/sdk-typescript— generated/hand-ergonomic clients over the now- real Phase 0-3 API surface.- Every remaining
apps/*,services/*,packages/*folder — generated as STUBs viatools/scripts/new-service.jsso the full target architecture is visible and individually runnable, without pretending business logic exists where it doesn't. infra/,tools/— compose file, env examples, codegen/seed scripts.- Install, build, migrate, seed, verify the federation flow end-to-end, report status.
Definition of done for "WORKING" in this pass
A service is WORKING if: it boots, its documented endpoints exist and return real data backed by
Postgres (not mocks), the specific business rules called out in
docs/business/conflict-resolution-log.md that apply to it are actually enforced (e.g.
seller-identity-service really does require sequential email-then-phone OTP before linking, not
just an email check), and it has at least one test exercising its core flow.