Implementa S02: config, main bootstrap y manejo de errores - #20
Merged
JoelVR17 merged 1 commit intoJun 19, 2026
Conversation
20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16
PR title
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
feat)fix)Changes made
src/config/env.validation.ts— Joi schema that validates all environmentvariables 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 schemasrc/main.ts— Production-ready bootstrap: Helmet, compression, CORS from env,global ValidationPipe (whitelist + forbidNonWhitelisted), URI versioning
/v1,Swagger at
/v1/docs, graceful shutdownsrc/common/filters/http-exception.filter.ts— Global exception filter thatcatches 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:devstarts without errors.envcauses server to refuse startup with a clear messageGET /v1/nonexistentreturns JSON{ statusCode, message, timestamp, path }— not NestJS default HTMLhttp://localhost:3000/v1/docsnpm run lintpasses with zero errorsnpm run start:devMigrations / database
N/A
Checklist
Closes #with the correct issue numbernpm run lintandnpm run testpass without errors