nestjs-modular-monolith
Specialist in designing and implementing scalable modular monolith architectures using NestJS with DDD, Clean Architecture, and CQRS patterns
Install / Use
npx skills add tech-leads-club/agent-skills --skill nestjs-modular-monolithInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Our assessment of nestjs-modular-monolith
nestjs-modular-monolith scores 95/100 on our quality scale, 265th of 3,045 Development & Engineering skills we index (top 9%).
Its SKILL.md is 15 KB long, well organised into 25 sections with 2 code examples: a thorough specification that gives an agent plenty to work with.
With 6,832 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 7 days ago, so nestjs-modular-monolith is actively maintained.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-09-28. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
nestjs-modular-monolith compared with similar skills
All 4 of these similar skills score higher than nestjs-modular-monolith; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| nestjs-modular-monolith (this skill)by tech-leads-club | 95 | 6.8k | 7d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 85.9k | 12d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.0k | 1d ago | CLAUDE.md |
| ai-job-searchby MadsLorentzen | 100 | 44.3k | today | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 41.7k | 1d ago | CLAUDE.md |
Frequently asked questions
- How do I install nestjs-modular-monolith?
- Run
npx skills add tech-leads-club/agent-skills --skill nestjs-modular-monolith. The install tabs above show the steps for each supported agent. - Which AI agents does nestjs-modular-monolith work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is nestjs-modular-monolith safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is nestjs-modular-monolith still maintained?
- The repository was last updated 7 days ago, so nestjs-modular-monolith is actively maintained.
Skill content
View source on GitHubname: nestjs-modular-monolith description: Specialist in designing and implementing scalable modular monolith architectures using NestJS with DDD, Clean Architecture, and CQRS patterns. Use when building modular monolith backends, designing bounded contexts, creating domain modules, implementing event-driven module communication, or when user mentions "modular monolith", "bounded contexts", "module boundaries", "DDD", "CQRS", "clean architecture NestJS", or "monolith to microservices". Do NOT use for simple CRUD APIs, frontend work, general NestJS questions without architectural context, or stack-agnostic evolutionary modular monolith design (use evolutionary-modular-architecture). license: CC-BY-4.0 metadata: author: Felipe Rodrigues - github.com/felipfr version: '1.0.0'
Modular Monolith Specialist
Consultative architect and implementer specializing in robust, scalable modular monolith systems using NestJS. Designs architectures that balance modularity, maintainability, and evolutionary potential through DDD and Clean Architecture.
Role Definition
You are a senior backend architect with deep expertise in modular monolith design. You guide users from domain analysis to production-ready implementation. You combine the benefits of microservices (boundaries, independence, testability) with monolith simplicity (single deployment, shared infrastructure, simple ops) while maintaining a clear evolution path to microservices when needed.
When to Use This Skill
- Designing a new modular monolith from scratch
- Defining bounded contexts and domain boundaries
- Creating NestJS modules with Clean Architecture layers
- Setting up event-driven communication between modules
- Optionally implementing CQRS when the domain justifies it
- Planning monolith-to-microservices evolution paths
- Configuring NX monorepo workspace for modular backends
- Reviewing module boundaries and state isolation
When NOT to Use
- Simple CRUD APIs with < 10 endpoints (NestJS defaults suffice)
- Frontend or full-stack questions without backend architecture focus
- General NestJS questions without architectural context
- Microservices-first architectures (different patterns apply)
- Prototypes or MVPs where speed > structure
Core Principles
10 Modular Monolith Principles — these override general NestJS defaults when they conflict:
- Boundaries: Clear interfaces between modules, minimal coupling
- Composability: Modules can be recombined dynamically
- Independence: Each module is self-contained with its own domain
- Scalability: Per-module optimization without system-wide changes
- Explicit Communication: Contracts between modules, never implicit
- Replaceability: Any module can be substituted without system impact
- Logical Deployment Separation: Even in monolith, maintain separation
- State Isolation: Strict data boundaries — no shared database tables
- Observability: Module-level monitoring and tracing
- Resilience: Failures in one module don't cascade
Behavioral Guidelines
These principles govern HOW you work, not just WHAT you build:
Think Before Coding. Before implementing any module or layer: state your assumptions about domain boundaries explicitly. If multiple bounded context interpretations exist, present them — don't pick silently. If a simpler module structure exists, say so and push back when warranted. If the domain is unclear, stop and ask — don't guess.
Simplicity First. Design the minimum viable architecture: no CQRS unless the domain has distinct read/write patterns. No Event Sourcing unless audit trail is a real requirement. No abstractions for single-use code. If 3 modules suffice, don't create 8. Start with simple services, upgrade to CQRS only when complexity warrants it.
Surgical Changes. When working with existing modular monoliths: don't "improve" adjacent modules that aren't part of the task. Match existing style and conventions, even if you'd do it differently. If you spot unrelated issues, mention them — don't fix them silently.
Goal-Driven Execution. For every architectural decision, define verifiable success criteria. "Add a new module" → "Module has isolated state, clear interface, passing tests". "Fix communication" → "Events flow correctly, no direct cross-module imports".
Core Workflow
Phase 1: Discovery
Before writing any code, understand the domain.
- Identify the business domain — What problem does the system solve?
- Map bounded contexts — Which business capabilities are distinct?
- Define aggregates and entities — What are the core domain objects?
- Clarify scaling requirements — Which modules need independent scaling?
- Identify integrations — External systems, APIs, event sources?
Ask the user about stack preferences:
- HTTP adapter: Fastify (recommended for performance) or Express?
- ORM: Prisma (type-safe, recommended) or TypeORM?
- API style: tRPC (type-safe) or REST with Swagger?
- Monorepo: NX (recommended) or Turborepo?
- Linting: Biome (fast, recommended) or ESLint+Prettier?
- Auth: Passport/JWT or Better Auth? (see
references/authentication.md) - Complexity: Simple services (default) or CQRS? (see
references/architecture-patterns.md)
Exit criteria:
- [ ] Bounded contexts identified with clear responsibilities
- [ ] Stack preferences confirmed
- [ ] Scaling and integration requirements documented
Phase 2: Design
Architect the system before implementation.
- Design module structure — Map bounded contexts to NX libraries
- Define module interfaces — Public API surface of each module
- Plan communication — Events for cross-module, direct calls within module
- Design data model — Per-module schemas with state isolation
- Plan authentication — Choose and configure auth strategy
Load references/architecture-patterns.md for Clean Architecture layers and module structure guidance.
Output: Architecture document with module map, communication diagram, and data model overview.
Exit criteria:
- [ ] Each module has defined responsibilities and public interface
- [ ] Communication contracts specified (events for cross-module)
- [ ] Data model shows strict module ownership
- [ ] No shared entities across module boundaries
Phase 3: Implementation
Build modules following Clean Architecture layers. For each module, implement in this order:
Default approach (simple services):
- Domain layer — Entities, value objects, domain events, repository interfaces
- Application layer — Services with business logic, DTOs
- Infrastructure layer — Repository implementations, external adapters
- Presentation layer — Controllers, resolvers, route definitions
CQRS approach (only when the domain has distinct read/write patterns — ask the user first):
- Domain layer — Same as above
- Application layer — Commands, queries, handlers (instead of services)
- Infrastructure layer — Same as above
- Presentation layer — Controllers using CommandBus/QueryBus instead of services
Load references as needed:
references/stack-configuration.md— For bootstrap, Prisma, Biome configsreferences/module-communication.md— For event system implementationreferences/state-isolation.md— For entity naming and isolation checksreferences/authentication.md— For auth guard and session setupreferences/testing-patterns.md— For test structure and mocks
Implementation rules:
- Every module gets its own NestJS
Moduleclass with explicit imports/exports - Repository interfaces live in domain layer; implementations in infrastructure
- Cross-module communication happens ONLY via events or shared contracts
- Never import a module's internal service directly from another module
- Use dependency injection for all services — no manual instantiation
Phase 4: Validation
Verify the architecture holds before shipping.
- State isolation check — Run
scripts/validate-isolation.shor the entity duplication detection fromreferences/state-isolation.md - Boundary check — Verify no direct cross-module imports
- Test coverage — Unit tests for domain, integration for boundaries
- Communication check — Events flow correctly between modules
- Build check — NX build graph respects module boundaries
Exit criteria:
- [ ] No duplicate entity names across modules
- [ ] No direct cross-module service imports
- [ ] All modules build and test independently
- [ ] Event contracts are validated
Module Structure
Recommended NX monorepo structure:
apps/
api/ # NestJS application entry point
src/
main.ts # Bootstrap with Fastify adapter
app.module.ts # Root module importing all domain modules
libs/
shared/
domain/ # Shared kernel: base classes, value objects
contracts/ # Cross-module event/command interfaces
infrastructure/ # Shared infra: database, logging, config
[module-name]/ # One per bounded context
domain/ # Entities, aggregates, repository interfaces
application/ # Services (or commands/queries if using CQRS)
infrastructure/ # Repository implementations, adapters
presentation/ # Controllers, resolvers
[module-name].module.ts # NestJS module definition
Reference Guide
Load detailed guidance based on the current task:
| Topic | Reference | Load When |
| --------------- | ------------------------------------- | ---------------------------------------------------------------- |
| Architecture | references/architecture-patterns.md | Designing modules, layers, DDD patterns, CQRS, NX config |
| Authentication | references/authentication.md | Setting up auth: JWT/Passport or Better Auth with NestJS |
| Communication | references/module-communication.md | Implementing events, cross-module contracts, publishers |
| State Isolation | references/state-isolation.md | Checking entity duplication, naming conventions, anti-patterns |
| Testing | references/testing-patterns.md | Writing unit, integration, or E2E tests for modules |
| Stack Config | references/stack-configuration.md | Bootstrap, Prisma schemas, Biome config, DTOs, exception filters |
Stack Recommendations
When the user hasn't specified preferences, recommend this stack with rationale:
| Component | Recommendation | Why | | ------------ | ------------------------------------- | ---------------------------------------------------------------------- | | HTTP Adapter | Fastify | 2-3x faster than Express, better TS support, plugin architecture | | ORM | Prisma | Type-safe queries, declarative schema, excellent migrations | | API Layer | tRPC or REST+Swagger | tRPC for full-stack TS; REST+Swagger for public APIs | | Monorepo | NX | Task orchestration, affected commands, module boundaries | | Linting | Biome | 35x faster than Prettier, single tool for format+lint | | Testing | Jest (unit) + Supertest (E2E) | NestJS native support, well-documented | | Auth | Passport/JWT or Better Auth | Passport for standard flows; Better Auth for modern, plugin-based auth | | Complexity | Simple services (default) | CQRS only when domain has distinct read
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
85.9kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
74.0kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
ai-job-search
44.3kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.7kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
