What generating a NestJS app from requirements produces
When you describe your product in Archiet's Blueprint Wizard (entities, user stories, compliance needs, integrations), the pipeline emits a complete NestJS application. The structure below is representative:
src/
├── main.ts # NestJS bootstrap; Swagger, global pipes, cookie-parser
├── app.module.ts # Root module; all feature modules registered
├── auth/
│ ├── auth.module.ts
│ ├── auth.controller.ts # POST /auth/register, /auth/login, /auth/logout
│ ├── auth.service.ts # JWT cookie issuance; bcrypt password hashing
│ ├── jwt.strategy.ts
│ └── guards/
│ ├── jwt-auth.guard.ts
│ └── roles.guard.ts
├── users/
│ ├── users.module.ts
│ ├── users.controller.ts
│ ├── users.service.ts
│ └── entities/user.entity.ts # TypeORM entity; tenant-scoped queries
├── {entity}/ # One module directory per entity in your PRD
│ ├── {entity}.module.ts
│ ├── {entity}.controller.ts # Full CRUD + pagination
│ ├── {entity}.service.ts # Business logic; all queries filter by workspaceId
│ ├── dto/
│ │ ├── create-{entity}.dto.ts # class-validator DTOs
│ │ └── update-{entity}.dto.ts
│ └── entities/{entity}.entity.ts
├── billing/ # Stripe module (when billing is in genome)
└── database/
└── migrations/ # TypeORM migration per schema change
What NestJS-specific patterns Archiet gets right
Tenant-scoped queries throughout. Every entity service filters by workspaceId or organizationId. The pattern is enforced at the service layer, not left to individual developers:
async findAll(workspaceId: number, page = 1): Promise<Order[]> {
return this.ordersRepository.find({
where: { workspaceId },
order: { createdAt: 'DESC' },
take: 25,
skip: (page - 1) * 25,
});
}
JWT in httpOnly cookies, not localStorage. Auth cookies are issued with httpOnly: true, secure: true, sameSite: 'lax'. No localStorage.setItem in the generated frontend. XSS cannot extract session tokens.
Guards on every protected route. @UseGuards(JwtAuthGuard) on every controller that requires authentication. @Roles('admin') on admin-only endpoints. No route is accidentally left unprotected.
class-validator DTOs on every request body. ValidationPipe applied globally. Every incoming request is validated against its DTO before reaching the service layer. No raw req.body access.
Swagger decorators synced with implementation. @ApiOperation, @ApiResponse, and @ApiBody decorators match the actual behaviour. The generated openapi.yaml is produced from the same genome as the DTOs, so the spec and implementation stay consistent.
Supported NestJS integrations
The Blueprint Wizard lets you flag integrations that appear in your PRD. Each integration generates a NestJS module with a provider and service:
- Stripe — subscription lifecycle, webhook handler, customer portal redirect
- SendGrid / Postmark — transactional email service with templated methods
- Redis — cache module, session store, or BullMQ job queue
- AWS S3 — file upload service with pre-signed URLs
- Sentry — error tracking interceptor wired at the app module level
Integrations generate only when they are in your PRD — unused modules are not included.
What is included beyond the NestJS backend
- Next.js frontend — all screens from your screen manifest (auth, dashboard, settings, billing, entity CRUD pages, onboarding, forgot-password, verify-email)
- React Native / Expo mobile app — with App Store compliance files
- Docker — multi-stage Dockerfile +
docker-compose.yml(NestJS + PostgreSQL + Redis when Celery included + Nginx) - GitHub Actions CI/CD — eslint → Jest tests → build → deploy pipeline
- Architecture docs — ADRs for every material technical decision under
docs/decisions/ - Compliance docs — GDPR DPIA, HIPAA risk assessment, PCI scope statement (when compliance flags set)
- Quality gate — ARCHVERIFY blocks delivery below 80/100 quality score
FAQ
Does Archiet generate NestJS with TypeORM or Prisma?
TypeORM by default. Prisma support is on the roadmap. TypeORM was chosen because it aligns with NestJS's module pattern — each entity is a TypeORM entity decorated class, which makes the generated code idiomatic NestJS.
Does the generated NestJS app support microservices?
For larger blueprints (enterprise tier), Archiet can generate a microservices architecture — separate NestJS applications per bounded context, communicating via a message broker. For most use cases, a modular monolith (single NestJS app with separate modules) is generated by default. This aligns with NestJS's own recommendation: modular monolith first, extract services when you have a clear reason.
What database is used?
PostgreSQL. The generated app.module.ts uses TypeORM with a PostgreSQL connection configured from environment variables. SQLite is not supported.
How long does generation take?
Typically 60-120 seconds for a complete blueprint.
Can I use the generated NestJS app with any frontend?
Yes. The generated backend exposes a REST API (with OpenAPI 3.1 spec). Archiet generates a Next.js frontend by default, but you can use any frontend that can make HTTP requests. The OpenAPI spec makes it straightforward to generate a client SDK in any language.