π Title
Wire Helmet, CORS, Swagger, and global exception filter β all currently missing from `main.ts`
π Description
`src/main.ts` bootstraps the Fastify app but never enables several critical production requirements that are already partially configured in the codebase:
- Helmet is installed (`package.json`) but `app.register(helmet)` is never called β no HTTP security headers (CSP, HSTS, X-Frame-Options, etc.)
- CORS is not configured β all cross-origin requests are either blocked or unconstrained depending on Fastify defaults
- Swagger β `src/config/swagger.ts` exists and defines the document options but is never imported or mounted β no API docs available
- Global exception filter β `docs/development/guards-filters.md` documents the expected `HttpExceptionFilter` registered via `APP_FILTER`, but `src/common/filters/` contains only a `.gitkeep`. Unhandled errors currently leak raw stack traces and internal messages in the HTTP response body.
β
Tasks to complete
π Documentation/context for AI
(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs
Relevant files:
- `src/main.ts`
- `src/config/swagger.ts`
- `src/config/env.ts`
- `src/app.module.ts`
- `src/common/filters/` (currently empty)
ποΈ Additional notes
- Swagger should be conditionally mounted: available in `development` and `staging`, disabled or bearer-protected in `production`
- For helmet + Fastify adapter use: `await app.register(require('@fastify/helmet'), { ... })` before `app.listen()`
- CORS allowed origins should come from `ConfigService` to avoid hardcoding
- The all-exceptions filter must log the original error with full stack before sending the 500 response
π Title
Wire Helmet, CORS, Swagger, and global exception filter β all currently missing from `main.ts`
π Description
`src/main.ts` bootstraps the Fastify app but never enables several critical production requirements that are already partially configured in the codebase:
β Tasks to complete
π Documentation/context for AI
(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs
Relevant files:
ποΈ Additional notes