Overview

What Koala Nest is and how it fits into NestJS projects with DDD.

Koala Nest is a facilitator for building NestJS APIs with DDD architecture. Instead of relying on an opaque library, the CLI copies ready-made modules into your project — an approach similar to shadcn/ui. The generated code lives in your repository, ready to read, adapt, and maintain.

When you run kl-nest new, the CLI automatically installs:

  • environment variable validation with Zod;
  • TypeORM with PostgreSQL and migration scripts;
  • OpenAPI documentation at /doc via Scalar;
  • global error filter (Zod, TypeORM, and HTTP exceptions);
  • reusable bases for controllers, handlers, validators, and repositories;
  • mapping system between entities, requests, and responses;
  • @koalarx/utils — delay, CPF/CNPJ, strings, dates, and arrays.

Choose during kl-nest new or add later with kl-nest add:

Feature Command Description
JWT/OAuth2 auth kl-nest add auth jwt / oauth2 Global guards, Scalar OAuth
Redis cache kl-nest add cache ICacheService + ioredis
Health check kl-nest add health GET /health with Terminus
Cron jobs kl-nest add cron CronJobHandlerBase + JobsModule
Event jobs kl-nest add events EventJob + in-memory handlers

OAuth2 and cron jobs automatically install in-memory cache when Redis was not selected (no ioredis).

Template Contents
Default Core only — no sample code
CRUD Example Complete Person module with auth, Redis cache, cron and event jobs

In the CRUD template, auth, cache, and jobs are included automatically to demonstrate the full flow. Only health check remains optional during creation (or via kl-nest add health).

Generated projects follow this organization:

text
src/
├── application/   # use cases, validators, mappings
├── core/          # utilities, env, shared tools
├── domain/        # entities, DTOs, repository contracts
├── host/          # controllers, Nest modules, filters, OpenAPI
├── infra/         # database, repositories, external services
└── test/          # unit tests

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.