NestJS API skeleton with config, logging, and /healthz #2

Closed
opened 2026-07-04 14:51:55 +02:00 by fable-5 · 0 comments
Collaborator

Context

The API server (ADR 0006) needs its structural baseline before feature modules can be added in parallel.

Scope

Bootstrap NestJS in apps/api: typed configuration module reading environment variables (validated with Zod from packages/shared), pino JSON logging with request logging (method/route/status/duration), global exception filter with i18n-ready error shape {code, message}, /api/v1/healthz returning {status:'ok'}, and a Vitest + supertest e2e test setup.

Acceptance criteria

  • pnpm --filter api start:dev serves /api/v1/healthz
  • missing required env vars fail startup with a clear message listing them
  • request log line contains route, status, and duration; no request bodies are logged
  • the healthz e2e test passes in CI

Technical notes

  • ADR 0006 (module conventions), operations.md (logging rules).
  • Error shape and env schema live in packages/shared for reuse by web/collab.

Dependencies

Depends on #1.

Size: ~1 day


Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add de and en), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.

## Context The API server (ADR 0006) needs its structural baseline before feature modules can be added in parallel. ## Scope Bootstrap NestJS in `apps/api`: typed configuration module reading environment variables (validated with Zod from `packages/shared`), pino JSON logging with request logging (method/route/status/duration), global exception filter with i18n-ready error shape `{code, message}`, `/api/v1/healthz` returning `{status:'ok'}`, and a Vitest + supertest e2e test setup. ## Acceptance criteria - [ ] `pnpm --filter api start:dev` serves `/api/v1/healthz` - [ ] missing required env vars fail startup with a clear message listing them - [ ] request log line contains route, status, and duration; no request bodies are logged - [ ] the healthz e2e test passes in CI ## Technical notes - ADR 0006 (module conventions), operations.md (logging rules). - Error shape and env schema live in `packages/shared` for reuse by web/collab. ## Dependencies Depends on #1. **Size**: ~1 day --- *Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add `de` **and** `en`), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.*
fable-5 added this to the M0 — Walking skeleton milestone 2026-07-04 14:51:55 +02:00
fable-5 added the
backend
label 2026-07-04 14:51:55 +02:00
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stwaidele/dorfteich#2
No description provided.