nestjs-clean-architecture

Define NestJS project structure using Clean Architecture layers and boundaries.

Updated Oct 24, 2024
One-click install
npx skills add https://github.com/tuannguyen151/nestjs-clean-architecture --skill nestjs-clean-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-clean-architecture
Source: https://github.com/tuannguyen151/nestjs-clean-architecture/tree/main/.claude/skills/nestjs-clean-architecture
Command: npx skills add https://github.com/tuannguyen151/nestjs-clean-architecture --skill nestjs-clean-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a structured blueprint for implementing new features in NestJS using Clean Architecture, ensuring proper separation of domain, use cases, adapters, and infrastructure.

Core Features & Use Cases

  • Clear domain/use-case separation and module wiring across domain, use-cases, adapters, and infrastructure.
  • Guidelines for repositories, DTOs, presenters, controllers, and dependency injection to enforce architectural rules.
  • Practical reference to layer examples and best practices to onboard new developers and review code structure.

Quick Start

Plan and implement a new feature in NestJS following the Clean Architecture guidelines outlined here.

Frequently Asked Questions about nestjs-clean-architecture

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

FAQPage Schema
How do I structure a NestJS project using Clean Architecture?

To structure a NestJS project using Clean Architecture, you separate domain models, use cases, adapters, and infrastructure layers, enforcing boundaries with repository interfaces and symbol-based dependency injection.

What is the best way to separate domain logic from infrastructure in NestJS?

The best way to separate domain logic from infrastructure in NestJS is by defining repository interfaces in the domain layer and implementing them externally using symbol-based dependency injection.

How does Clean Architecture work with NestJS dependency injection?

Clean Architecture works with NestJS dependency injection by using symbol-based DI to wire modules, ensuring use cases depend on repository interfaces rather than concrete infrastructure implementations.

Can I use domain-driven design patterns to refactor existing NestJS applications?

Yes, you can use domain-driven design patterns to refactor existing NestJS applications by applying this blueprint to reorganize code placement into domain models, use cases, and adapters.

When do I need to implement use cases and presenters in NestJS?

You need to implement use cases and presenters in NestJS when adding new features that require strict separation between application business rules and interface delivery mechanisms.

What are the limitations of enforcing strict layer boundaries in NestJS?

Limitations of enforcing strict layer boundaries in NestJS include increased boilerplate for DTOs, presenters, and controllers, which may require more onboarding time for new developers.