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
# Single module
cem add module Task

# Batch — scaffold several at once
cem add module Task Category Comment

You'll be prompted for optional extras for each module:

📌 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 modules

bash
cem remove module Task
cem remove module Task Category Review
cem rm module Task Category

Deletes each module folder AND unwires their router imports from src/app/routes/index.ts. Missing modules are skipped with a warning.