ROUTER_MODULE_GUIDE

Resolve nested module route recognition in NestJS RouterModule.register() path prefixing.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/mthang1801/go-domain-driven-design --skill router-module-guide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ROUTER_MODULE_GUIDE
Source: https://github.com/mthang1801/go-domain-driven-design/tree/main/.claude/skills/ROUTER_MODULE_GUIDE
Command: npx skills add https://github.com/mthang1801/go-domain-driven-design --skill router-module-guide

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When using RouterModule.register() to prefix routes, controllers inside nested imported modules are not recognized, leading to missing routes.

Core Features & Use Cases

  • Ensures controllers are declared in the module registered with RouterModule to enable correct route prefixing in nested module architectures.
  • Provides architectural guidance for library vs presentation modules and router configuration to fix route discovery issues.
  • Use cases include multi-package NestJS apps with dynamic modules and nested imports.

Quick Start

Configure your presentation module to register its controllers and wire it into RouterModule with the desired path prefix.

Frequently Asked Questions about ROUTER_MODULE_GUIDE

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

FAQPage Schema
Why are my NestJS RouterModule routes missing when using nested module imports?

NestJS RouterModule routes go missing because controllers inside nested imported modules are not recognized. You must declare controllers directly in the presentation module registered with RouterModule.register() to ensure proper route prefixing and route discovery.

How do I configure RouterModule.register() for path prefixing in a multi-module NestJS app?

Configure your presentation module to register its controllers directly, then wire it into RouterModule.register() with the desired path prefix. This ensures controllers are properly recognized and prefixed in dynamic multi-package NestJS applications.

Does NestJS RouterModule support dynamic module routing for library and presentation modules?

Yes, NestJS RouterModule supports dynamic module routing by enforcing that controllers are declared directly in the registered module. This architectural pattern separates library and presentation modules to fix route discovery issues in multi-package apps.

What is the correct architecture for NestJS modular routing to avoid unrecognized nested controllers?

The correct modular routing architecture requires declaring controllers directly within the module registered to RouterModule, rather than relying on nested imports. This enforces proper route prefixing and ensures all presentation module routes are discovered.

Can I use nested imports to automatically prefix routes with NestJS RouterModule?

No, NestJS RouterModule does not recognize controllers inside nested imported modules for path prefixing. You must declare controllers directly in the specific module registered with RouterModule.register() to ensure correct route discovery and prefix application.