Skip to content

chore: finalize MVP with health endpoint, healthchecks and end-to-end coverage - #11

Merged
lmoraesdev merged 4 commits into
mainfrom
chore/finalize-mvp
May 16, 2026
Merged

chore: finalize MVP with health endpoint, healthchecks and end-to-end coverage#11
lmoraesdev merged 4 commits into
mainfrom
chore/finalize-mvp

Conversation

@lmoraesdev

Copy link
Copy Markdown
Owner

What

Closes the MVP scope of the project. Four small but load-bearing pieces:

  • /api/health endpoint as a liveness probe
  • Healthchecks on both app and postgres services in docker-compose.yml, with app waiting for postgres to be healthy before starting
  • A single end-to-end test that exercises the full happy path: create a charge → simulate the provider's webhook → verify the charge moved to PAID
  • README aligned with the shipped state (roadmap items checked off, decisions list updated, links to error catalog and Swagger docs)

Why

The project had every individual piece tested, but no test that wired them all together end-to-end. The new e2e test catches the kind of integration drift that unit tests alone can't: a controller misroutes, a filter doesn't fire, a guard runs in the wrong order. One green test now confirms the system works as a whole.

The healthchecks make docker compose up deterministic — the app no longer races Postgres on first boot. The /health endpoint is what any orchestrator (Docker, Kubernetes, ECS) hits to decide if the service is up.

Approach

Four atomic commits:

  1. feat: add /health endpoint
  2. chore: add healthchecks to docker-compose services
  3. test: add end-to-end happy path covering charge creation through webhook
  4. docs: align README with shipped MVP

Tests

The new e2e walks through:

  1. POST /charges with Idempotency-Key201, captures charge_id
  2. GET /charges/:id200, status is AWAITING_PAYMENT
  3. POST /webhooks/provider with valid X-Webhook-Signature and a payment.confirmed event → 200
  4. GET /charges/:id200, status is now PAID

Together with the existing suite, this means every layer of the system has both isolated and integrated coverage.

Notes

  • start_period: 20s on the app healthcheck gives NestJS time to bootstrap before the first probe — without it, Docker can mark the app unhealthy during the first build pass.
  • The README roadmap now reflects MVP scope: cancel/refund, BullMQ retry, expiration job, and Prisma migration remain as future work, separated from delivered features.

GET /health returns { status: 'ok' } as a liveness probe, registered in
a dedicated HealthModule imported by AppModule.
postgres healthcheck now includes -d flag so it validates the target
database. app service gets a wget-based probe against /health with
start_period: 20s to give the app time to boot before checks begin.
Single scenario: POST /charges → GET /charges/:id (AWAITING_PAYMENT) →
POST /webhooks/provider (HMAC-signed payment.confirmed) → GET /charges/:id
(PAID). Exercises idempotency, signature guard, state machine, dedup, and
persistence across both controllers in a shared in-memory module.
Roadmap split into shipped/v2 sections marking logs, error catalog, CI,
and health probe as done. Added AsyncLocalStorage decision entry.
Added GET /health to the API section.
@lmoraesdev
lmoraesdev merged commit 1033787 into main May 16, 2026
1 check passed
@lmoraesdev
lmoraesdev deleted the chore/finalize-mvp branch May 16, 2026 21:40
@lmoraesdev
lmoraesdev restored the chore/finalize-mvp branch May 19, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant