nestjs-api

Structure NestJS APIs with Hexagonal Architecture, DDD, and CQRS patterns.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/oversio/personal-finances --skill nestjs-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-api
Source: https://github.com/oversio/personal-finances/tree/main/apps/api/skills/nestjs-api
Command: npx skills add https://github.com/oversio/personal-finances --skill nestjs-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Architects and developers often struggle with building scalable NestJS APIs that are easy to maintain, test, and evolve as business rules change. This Skill provides a proven structure using Hexagonal Architecture, DDD, and CQRS to separate concerns and align code organization with domain concepts.

Core Features & Use Cases

  • Hexagonal Architecture: isolates the core domain from adapters and infrastructure, enabling independent testing and evolution of each boundary.
  • CQRS and DDD: defines clear write and read models with commands, queries, domain events, and repository interfaces for robust business logic.
  • Modular API skeleton: offers a scalable project structure spanning application, domain, and infrastructure layers for NestJS APIs, including modules, controllers, and persistence.
  • Use Case: when building a complex enterprise API, structure features as cohesive modules with ports/adapters and testable boundaries to reduce coupling and accelerate delivery.

Quick Start

Install dependencies and start the development server:

  • npm install
  • npm run start:dev

Frequently Asked Questions about nestjs-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a NestJS API with hexagonal architecture and DDD?

Structure a NestJS API with hexagonal architecture by isolating the core domain from infrastructure adapters. This approach enforces clean separation of concerns using ports and adapters, enabling independent testing and evolution of domain boundaries across enterprise services.

What is the best way to implement CQRS in a NestJS API?

Implement CQRS in a NestJS API by defining clear write and read models. This pattern separates commands and queries, and supports domain events alongside repository interfaces to handle complex business logic robustly without coupling operations.

How do I separate domain logic from infrastructure in a NestJS module?

Separate domain logic from infrastructure in a NestJS module by applying ports and adapters. This isolates application, domain, and infrastructure layers, reducing coupling and aligning code organization directly with domain concepts for cohesive boundaries.

Does this NestJS API structure support Swagger-based validation?

Yes, this NestJS API structure supports Swagger-based validation. It integrates validation within a modular API skeleton spanning application, domain, and infrastructure layers to ensure scalable enterprise-grade services.

When should I use hexagonal architecture for a NestJS API?

Use hexagonal architecture for a NestJS API when building complex enterprise services requiring easy maintenance and evolution. It aligns code organization with domain concepts, ensuring testable boundaries and clean separation as business rules change.