Installation guide

Install the CLI and create your first NestJS project with DDD.

The @koalarx/nest package exposes the kl-nest command. You can use it in three ways.

Install once and use kl-nest from any folder:

bash
npm install -g @koalarx/nest
# or: bun install -g @koalarx/nest
# or: pnpm add -g @koalarx/nest

kl-nest new
kl-nest --help

Run the published version directly:

bash
bunx @koalarx/nest new
npx @koalarx/nest new

Useful for testing a specific version:

bash
bunx @koalarx/nest@latest new
npx @koalarx/nest@latest new

The new command prompts for:

  • project name;
  • package manager (bun, npm, or pnpm — Bun recommended);
  • template (Default or CRUD Example);
  • authentication strategy (JWT or OAuth2 — required on CRUD);
  • extra features (Default: cache, health, cron, events; CRUD: health check only — auth, Redis cache, and jobs are bundled).

The core module installs only essentials (@koalarx/utils, @nestjs/config, @nestjs/swagger, typeorm, pg, zod, @scalar/nestjs-api-reference). Extra dependencies are added based on selected options:

Option Additional packages
JWT / OAuth2 @nestjs/jwt, passport, cookie-parser, …
Cache (Redis) ioredis + ICacheService
Cron jobs cron-parser + background-services bases
Health check @nestjs/terminus + GET /health (DB and optional Redis)

OAuth2 and cron jobs automatically install in-memory cache (without ioredis) when Redis was not selected. See Koala Utils and Cache (Redis).

Command Description
kl-nest new Creates a new project (interactive flow)
kl-nest add [items] Adds features to an existing project
kl-nest version Displays the CLI version
kl-nest help Lists available commands

From an existing project root:

bash
cd my-api

# interactive — lists only what is not installed yet
kl-nest add

# direct
kl-nest add cache
kl-nest add auth jwt
kl-nest add health cron events
Item Command Notes
JWT auth kl-nest add auth jwt Installs cookie-parser and global guards
OAuth2 auth kl-nest add auth oauth2 Includes in-memory cache for OAuth state
Redis cache kl-nest add cache Adds ioredis; on CRUD, restores list caching
Health check kl-nest add health Terminus: PostgreSQL ping + Redis (when configured)
Cron jobs kl-nest add cron Requires in-memory cache (installed automatically)
Event jobs kl-nest add events On CRUD, restores example handlers

Default — DDD structure ready to start from scratch, without example domain code.

CRUD Example — includes the complete Person module with auth, Redis cache, cron jobs, and event jobs pre-installed. Only health check is optional during creation.

After creating the project, configure a .env at the root:

env
PORT=3000
NODE_ENV=develop
DATABASE_URL=postgresql://postgres:root@localhost:5432/koala_nest

kl-nest new configures scripts for the package manager you choose. Equivalent examples:

Bun (recommended)

bash
bun run start:dev
bun run start:prod
bun test
bun test --watch
bun run test:e2e
bun run migration:generate
bun run migration:run
bun run migration:revert

npm

bash
npm run start:dev
npm run start:prod
npm run test
npm run test:watch
npm run test:e2e
npm run migration:generate
npm run migration:run
npm run migration:revert

pnpm

bash
pnpm run start:dev
pnpm run start:prod
pnpm run test
pnpm run test:watch
pnpm run test:e2e
pnpm run migration:generate
pnpm run migration:run
pnpm run migration:revert

To contribute or test local changes:

bash
git clone https://github.com/igordrangel/koala-nest.git
cd koala-nest
bun install
bun run build
bun kl-nest new

Koala Nest

A facilitator for building NestJS APIs with DDD architecture. Code copied into your repository — readable, adaptable, and under your control.

Creator

igordrangel.com.br

Design, back-end, and product strategy.

Quick Commands

Global CLI and scripts in the generated project

  • bun install -g @koalarx/nest
  • kl-nest new
  • kl-nest add cache
  • bun run migration:run # CRUD template
  • kl-nest --help
© 2026 Koala NestBuilt for NestJS developers and AI-assisted workflows.