Skip to content

feat(nestjs): generate complete NestJS application bootstrap #14

Description

@dev-queiroz

Summary

Generate production-ready NestJS application structure with zero manual configuration required.

Motivation

Forge currently generates individual pieces (DTOs, controllers, services) but not a cohesive application. Developers must manually create app.module.ts, main.ts, configure Swagger, exception handling, etc.

This feature generates a complete executable NestJS application from contracts.

Scope

In Scope

  • app.module.ts with all modules imported
  • main.ts with app.listen() and graceful shutdown
  • Swagger UI on /api/docs
  • Global exception filter
  • Global validation pipe
  • CORS enabled
  • Health check endpoint (/health)
  • Ready to run: npm install && npm run start

Out of Scope

  • Authentication (future feature)
  • Custom business logic
  • API key management

Acceptance Criteria

  • app.module.ts generated with AppController, all service modules
  • main.ts generated with proper bootstrapping
  • Swagger UI auto-configured on /api/docs
  • GlobalExceptionFilter decorates app
  • GlobalValidationPipe applies to all endpoints
  • CORS configured with localhost (configurable)
  • HealthController with GET /health endpoint
  • Generated project starts without manual config
  • All tests pass (no regressions)
  • TypeScript strict mode

Files to Create/Modify

  • packages/generators/src/nest/templates/app.module.template.ts (NEW)
  • packages/generators/src/nest/templates/main.template.ts (NEW)
  • packages/generators/src/nest/generator.ts (MODIFY)
  • tests/nest-bootstrap.test.mjs (NEW)

Test Strategy

  • Generate NestJS project from contract
  • Install dependencies
  • Start application (npm run start)
  • Verify Swagger loads at http://localhost:3000/api/docs
  • Test health endpoint returns 200
  • Verify CORS headers present
  • Verify no manual configuration needed

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions