CLI · module

cem add module

Scaffold a complete, domain-driven feature module — controller, service, model, route, validation, interface, constants — and auto-wire it into the router.

bash
cem add module Task

You'll be prompted for optional extras:

📌 Include a constants file (ENUMs, search fields)? Yes
🛠️  Include a utils file for helper functions? No

What gets generated

src/app/modules/Task/
├── task.constant.ts
├── task.controller.ts
├── task.interface.ts
├── task.model.ts
├── task.route.ts
├── task.service.ts
└── task.validation.ts

The convention

Every file inside a module folder MUST be prefixed with the lowercase module name (e.g. task.controller.ts, not controller.ts). The architecture guard enforces this at build time.

Why this matters

  • Searching task.service jumps straight to the right file.
  • No two modules can ever shadow each other's filenames.
  • Code reviewers can pinpoint which module a stack trace came from instantly.

Removing a module

bash
cem remove module Task

Prompts for confirmation, then deletes the entire module folder AND unwires its router from src/app/routes/index.ts.