English | Português
NestForge monorepo: an interactive CLI that generates production-ready NestJS projects with authentication, authorization, databases, queues, observability, tests, and documentation.
Install the package locally:
npm install nestforge-generatorRun the locally installed CLI:
npx nestforge/
├── packages/
│ └── cli/ → `nestforge-generator` package published on npm
└── templates/
├── prisma/ → NestJS template with Prisma
├── typeorm/ → NestJS template with TypeORM
└── drizzle/ → NestJS template with Drizzle ORM
packages/cli— CLI source code, including prompts, generator, transformations, and automated tests.templates/prisma— complete NestJS project using Prisma.templates/typeorm— complete NestJS project using TypeORM and repositories.templates/drizzle— complete NestJS project using Drizzle ORM.
During the build, the templates are copied into the CLI package so that they remain available after publication to npm.
After installing nestforge-generator, run npx nestforge to answer the interactive prompts and receive a NestJS project configured according to your choices.
- Project name — free text — ✅ Available
- Language — TypeScript or JavaScript — ✅ Both available
- ORM / Query Builder — Prisma, TypeORM, or Drizzle — ✅ Available
- ORM / Query Builder — None — ⏳ Not implemented yet
- Database — PostgreSQL, MySQL, or SQLite — ✅ Available
- Database — MongoDB — ⏳ Not implemented yet
- Docker — yes or no — ✅ Real toggle
- Swagger/OpenAPI — yes or no — ✅ Real toggle
- Global validation with Zod — yes or no — ✅ Real toggle
- Redis, queues, and email — yes or no — ✅ Real toggle
- Authentication — JWT, Session/Cookies, OAuth-only, or None — ✅ All available
- RBAC and Permissions — yes or no — ✅ Real toggle
- Create
.env— yes or no — ✅ Real toggle
Legend:
- ✅ Currently works.
- ⏳ Not implemented yet; the CLI rejects the option with a clear message.
The JavaScript option is generated automatically from the TypeScript templates while the project is being created.
The Prisma template includes:
- Prisma Client;
- declarative schema;
- migrations;
- seed;
- PostgreSQL, MySQL, and SQLite;
- Prisma store for Session/Cookies;
- Prisma-based health check.
The TypeORM template includes:
- decorator-based entities;
- repositories injected with
TypeOrmModule.forFeature; - a database-specific
DataSource; - migrations;
- seed;
- PostgreSQL with
pg; - MySQL with
mysql2; - SQLite with
better-sqlite3; - persistent store with
connect-typeorm; DataSource-based health check.
The Drizzle template includes:
- database-specific typed schemas;
- typed query builder;
- Drizzle Kit configuration;
- SQL migrations;
- seed;
- PostgreSQL with
pg; - MySQL with
mysql2; - SQLite with
better-sqlite3; DrizzleSessionStorefor Session/Cookies;- health check using the selected native driver;
- transactions adapted to SQLite behavior.
The CLI keeps only the template, schema, and driver required for the selected ORM and database.
The available strategies are:
- JWT with access and refresh tokens;
- database-backed Session/Cookies;
- Google and GitHub OAuth;
- OAuth-only;
- no authentication.
The JWT strategy includes:
- refresh token rotation;
- unique refresh tokens;
- revocation;
- logout;
- password recovery;
- email verification when Redis and email are enabled.
The Session/Cookies strategy includes:
httpOnlycookie;- session regeneration;
- database persistence;
SessionAuthGuard;- CSRF protection with a token associated with the session;
- logout with session destruction.
With the “None” option, the src/auth and src/users directories are removed.
The templates include:
ADMIN,MANAGER, andUSERroles;- granular permissions;
RolesGuard;PermissionsGuard;- decorators for protecting endpoints.
- CRUD;
- pagination;
- filters;
- search;
- avatar upload;
- safe serialization;
- removal of
passwordHashfrom responses.
When enabled:
- Redis;
- BullMQ;
- email queues;
- Nodemailer;
- Mailpit in development;
- password recovery;
- email verification;
- Redis health check.
When disabled, related files and dependencies are removed.
- Helmet;
- configurable CORS;
- rate limiting;
- Zod;
- serialization with
ClassSerializerInterceptor; - password hashing with bcrypt;
- refresh token hashing;
- CSRF protection for Session/Cookies;
- secure cookies in production;
- environment variable validation.
- structured logging with Pino;
- health check at
/health; - Prometheus metrics at
/metrics; - database, Redis, memory, and disk indicators.
- unit tests with Vitest;
- E2E tests with Supertest;
- isolated test database;
- helpers for initializing the application;
- table cleanup between tests;
- JWT and Session/Cookies-specific tests;
- CSRF tests;
- RBAC tests;
- health check tests.
- multi-stage Dockerfile;
- Docker Compose;
- PostgreSQL or MySQL according to the selected option;
- SQLite without an external service;
- Redis and Mailpit when applicable;
- GitHub Actions;
- migration generation and execution;
- build, lint, unit tests, and E2E tests.
The following TypeORM combinations were validated with complete smoke tests:
- TypeScript + TypeORM + SQLite + JWT;
- TypeScript + TypeORM + SQLite + Session/Cookies.
The following Drizzle combinations were validated with complete smoke tests:
- TypeScript + Drizzle + SQLite + JWT;
- TypeScript + Drizzle + SQLite + Session/Cookies.
The smoke tests initially ran:
npm install
npm run build
npm testFor TypeORM, they also ran:
npm run migration:generate
npm run migration:run
npm run seed
npm run test:e2eFor Drizzle, they also ran:
npm run drizzle:generate
npm run drizzle:migrate
npm run seed
npm run test:e2eThe generator's automated tests also cover:
- PostgreSQL;
- MySQL;
- SQLite;
- Prisma;
- TypeORM;
- Drizzle;
- TypeScript;
- JavaScript;
- JWT;
- OAuth-only;
- Session/Cookies;
- projects without authentication;
- removal of optional features;
- rejection of options that are not implemented yet.
PostgreSQL and MySQL have automated coverage for generation, schema configuration, and removal of unused drivers. Full smoke tests for these databases still require local services or Docker.
- Drizzle template README
- Drizzle template architecture
- Drizzle template roadmap
- Drizzle template documentation
From the monorepo root:
npm install
cd packages/cli
npm run devTo run the CLI's automated tests:
npm testTo test it as an installed CLI:
npm run build
npm link
nestforgeThe complete guide is available in TESTING.
cd packages/cli
npm run build
npm pack --dry-run
npm publishThe build compiles the CLI and copies the Prisma, TypeORM, and Drizzle templates into the published package.
Planned next steps:
- an option without an ORM;
- MongoDB;
- complete package name validation;
- expand the smoke-test matrix with databases running as real services;
- automated deployment examples.
Detailed status is available in the CLI README.
MIT — see: