nestjs-domain

Structure NestJS domain layers with entities, value objects, and repository ports.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/johnnystefan/test-saas-business --skill nestjs-domain
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-domain
Source: https://github.com/johnnystefan/test-saas-business/tree/main/skills/nestjs-domain
Command: npx skills add https://github.com/johnnystefan/test-saas-business --skill nestjs-domain

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It keeps NestJS domain layers free of framework and persistence details, ensuring teams do not accidentally leak infrastructure into entities, value objects, and use cases while preserving tenant isolation.

Core Features & Use Cases

  • Resource Entity Pattern describes how to create entities with tenant IDs, state validation, primitive conversion helpers, and rich business methods without direct dependencies on NestJS or Prisma.
  • Immutable Value Objects enforce validation rules in their constructors so names, IDs, and statuses always stay valid and thread-safe within SaaS modules.
  • Repository Ports and Pure Use Cases lay out tenant-aware contracts and minimal orchestration logic so services such as auth, club, inventory, booking, and finance can avoid side effects while returning primitives.

Quick Start

Create a Resource entity using immutable value objects, a tenant-scoped repository, and a pure use case matching the described pattern.

Frequently Asked Questions about nestjs-domain

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

FAQPage Schema
How do I keep NestJS domain entities free from infrastructure and persistence details?

Structure NestJS domain layers using a Resource Entity pattern with rich business methods and immutable value objects, ensuring entities have no direct dependencies on framework or persistence layers like Prisma.

What is the best way to enforce multi-tenancy validation in NestJS domain layers?

Enforce multi-tenancy in NestJS by creating domain entities with tenant IDs and using immutable value objects that validate rules in their constructors, ensuring tenant isolation within SaaS modules.

How do I implement repository ports and pure use cases for DDD in NestJS?

Implement repository ports and pure use cases by defining tenant-aware contracts and minimal orchestration logic, allowing services to avoid side effects while returning primitives for infrastructure-agnostic domain operations.

Does domain-driven design work with NestJS for SaaS microservices like auth and finance?

Domain-driven design works with NestJS for SaaS microservices by applying tenant-scoped validation, repository contracts, and pure use cases across modules like auth, club, inventory, booking, and finance.

Can I use immutable value objects for state validation in NestJS SaaS modules?

You can use immutable value objects to enforce validation rules in their constructors, ensuring that names, IDs, and statuses always remain valid and thread-safe within NestJS SaaS modules.