Skip to content

Implementa S02: config, main bootstrap y manejo de errores - #20

Merged
JoelVR17 merged 1 commit into
Ding-Payments:developfrom
YAustinXYZ:Implementa-S02--config,-main-bootstrap-y-manejo-de-errores
Jun 19, 2026
Merged

Implementa S02: config, main bootstrap y manejo de errores#20
JoelVR17 merged 1 commit into
Ding-Payments:developfrom
YAustinXYZ:Implementa-S02--config,-main-bootstrap-y-manejo-de-errores

Conversation

@YAustinXYZ

Copy link
Copy Markdown
Contributor

⚠️ REQUIRED — Linked issue

Closes #16


PR title

feat(config): bootstrap ConfigModule, production main.ts and global exception filter

Description

Implements S02 — Application core for the Ding Payments server.

Sets up the foundational layer that every future module depends on:
validated environment configuration, a production-ready server bootstrap,
and a uniform error format across all API responses.

Without this deliverable, no other module can be safely built — missing
env vars would cause silent failures and error responses would be inconsistent.


Type of change

  • New feature (feat)
  • Bug fix (fix)
  • Refactor / internal improvement
  • Database migration (Prisma)
  • Documentation
  • Tests
  • Other

Changes made

  • src/config/env.validation.ts — Joi schema that validates all environment
    variables on startup; server refuses to boot if any required variable is missing
  • src/config/configuration.ts — Typed configuration object grouped by domain
    (app, database, supabase, stellar, webauthn, payments, throttle)
  • src/app.module.ts — Global ConfigModule registration with Joi validation schema
  • src/main.ts — Production-ready bootstrap: Helmet, compression, CORS from env,
    global ValidationPipe (whitelist + forbidNonWhitelisted), URI versioning /v1,
    Swagger at /v1/docs, graceful shutdown
  • src/common/filters/http-exception.filter.ts — Global exception filter that
    catches NestJS HttpExceptions, Prisma errors (P2002, P2025), and unexpected
    errors; always returns uniform JSON format; never exposes stack traces in production

Test plan

  • npm run start:dev starts without errors
  • Removing a required env var from .env causes server to refuse startup with a clear message
  • GET /v1/nonexistent returns JSON { statusCode, message, timestamp, path } — not NestJS default HTML
  • Swagger UI accessible at http://localhost:3000/v1/docs
  • npm run lint passes with zero errors
  • Unit / e2e tests updated or added
  • Tested locally with npm run start:dev

Migrations / database

N/A


Checklist

  • I included Closes # with the correct issue number
  • Code follows project conventions (NestJS, modules, etc.)
  • npm run lint and npm run test pass without errors
  • Prisma migrations generated and tested (if applicable)
  • Updated documentation if the change requires it

@JoelVR17 JoelVR17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@JoelVR17
JoelVR17 merged commit fd83d62 into Ding-Payments:develop Jun 19, 2026
1 check failed
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.

[S02] Application core: config, main.ts and error handling

2 participants