DEV Community

Jeiel2013
Jeiel2013

Posted on

NestForge - An CLI for NestJS projects

Hey everyone!

I've been working quite a bit on NestForge, an open-source CLI for generating NestJS projects without having to configure the same stack from scratch every time.

It's published on npm and currently supports:

  • TypeScript or JavaScript
  • Prisma, TypeORM, Drizzle, or no ORM
  • PostgreSQL, MySQL, and SQLite
  • MongoDB with Prisma
  • JWT, Session/Cookies, OAuth-only, or no authentication
  • Docker
  • Swagger/OpenAPI
  • Zod validation
  • Redis, BullMQ, email, and Mailpit
  • RBAC and permissions
  • Automatic .env generation
  • Health checks and Prometheus metrics
  • Unit and E2E tests
  • GitHub Actions

The CLI can still be used interactively:

npx nestforge

But it now also supports partial or fully non-interactive generation:

npx nestforge my-api --orm prisma --database postgres

npx nestforge my-api --yes

There are also commands like:

--help, --version, --list and --doctor

NestForge validates project names before creating anything, won't overwrite existing directories, and removes files, dependencies, modules, and configs that aren't needed based on the options you choose.

It also checks for newer npm releases on startup, while still working normally offline.

There's now a proper website for the project too:

Website:

GitHub:

GitHub logo jeiel2013 / NestForge

A production-ready NestJS project generator with Prisma, TypeORM, Drizzle, authentication, Docker, testing, observability and more.

NestForge

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-generator
Enter fullscreen mode Exit fullscreen mode

Run the locally installed CLI:

npx nestforge
Enter fullscreen mode Exit fullscreen mode

At startup, the CLI checks npm for a newer stable release. It can download and restart with the latest version, continue with the installed version, or hide the reminder until the next day. The check is cached and never blocks offline use.

Repository structure

/
├── 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…

There's still a lot I want to improve, especially broader MongoDB support and more complete smoke testing with real PostgreSQL and MySQL services.

If you try it out, feedback, issues, feature ideas, and contributions are always welcome.

And if you find it useful, consider leaving a ⭐ on the repo.

Top comments (0)