- TypeScript + Fastify skeleton under project/ (src/modules, shared, infrastructure, app) - scripts/check-module-boundaries.mjs enforcing module public-API rules (tested with fixtures) - GET /health endpoint, error envelope without stack leakage - specs/F-001-scaffold (SPEC/DESIGN/TASKS/TESTS), spec/tech.md dependency justification - 30-ticket MercadoDeVida roadmap in backlog/features.json, spec/roadmap.md - All gates approved: reviewer, security, qa; verify.sh green
1.9 KiB
1.9 KiB
SPEC — F-001 Scaffold modular monolith skeleton
Problem
No codebase exists. MercadoDeVida vNext needs a boring, typed, modular home before any business feature.
Goal
TypeScript modular monolith skeleton with strict module boundaries and a green toolchain.
Non-goals
- No business logic
- No database access
- No frontend
User story
As a developer (human or AI), I can run install/build/lint/typecheck/test from project/ and get a running HTTP app with a health endpoint, so every later feature starts from a known green base.
Functional requirements
project/contains a Node + TypeScript app with Fastify.- Layout:
src/modules/,src/shared/,src/infrastructure/,src/app/. - Every module folder exposes its public API through
index.ts. - A boundary checker fails when a module imports another module's internal files.
GET /healthreturns 200{"status":"ok"}.
Business rules
- Modules communicate only through public interfaces (
index.ts). - Composition happens only in
src/app(composition root).
Inputs
GET /health: none.
Outputs
GET /health:200 application/json {"status":"ok"}.
Edge cases
- Invalid route → 404 JSON envelope.
- Server start failure (port busy) → non-zero exit with clear error.
Acceptance criteria
npm install,npm run build,npm run lint,npm run typecheck,npm testall green inproject/.GET /healthreturns HTTP 200 with{"status":"ok"}.src/modules,src/shared,src/infrastructure,src/appexist.- A module importing another module's internal file fails the boundary check (demonstrated by test).
./scripts/verify.shgreen at repo root.
Dependencies
- None (first ticket).
Security implications
- No secrets, no auth surface. Error responses must not leak stack traces.
SEO implications
- None.
Performance implications
- None measurable yet; baseline latency observable via test only.