NestJS CLI to create projects with DDD and Prisma
nestack scaffolds a NestJS application already structured
with a layered architecture, Prisma driver adapters, Zod, Swagger,
Vitest and optional JWT auth — then keeps evolving it with generators.
Install
Globally, or straight from npx without installing:
npm install -g nestack
npx nestack new my-app
What you get
Layered architecture
A domain / infra layout you can keep growing, instead of a flat
src/ dump.
Prisma driver adapters
@prisma/adapter-pg — no engine binary in the app
container.
Validation & docs
Zod schemas with a validation pipe, Swagger out of the box.
Tests wired up
Vitest with unit and e2e configs, aliases and seed helpers.
Optional JWT auth
RS256 tokens, guard, strategy and a @Public()
decorator — chosen at creation time.
Generators
Entity, repository, use case, controller, module, DTO, presenter, event or a full resource.
Quick start
- Create the project:
nestack new my-app - Start Postgres:
docker compose up -d --wait - Run the migration:
npx prisma migrate dev --name init - Boot the API:
npm run start:dev
The API listens on http://localhost:3333 and Swagger on
http://localhost:3333/docs.
Commands
| Command | Description |
|---|---|
nestack new <name> [--yes] |
Create a Nest project |
nestack make:<type> <name> |
Generate file(s) with base code |
nestack migrate [name] |
Shortcut for prisma migrate dev |
nestack db:seed |
Shortcut for prisma db seed |
Generator types: entity, repository,
use-case, controller, module,
dto, presenter, event,
resource.
nestack make:entity user -m forum
nestack make:use-case create-user -m forum
nestack make:resource user -m forum
Generated stack
- NestJS
- Prisma +
@prisma/adapter-pg - PostgreSQL
- Zod (validation)
- Swagger (documentation)
- Vitest (tests)
- bcryptjs (hashing)
- Optional JWT RS256
Links
npm package · GitHub repository · Full README · Em português