Reference

CLI Reference

The complete command surface — project management, add/remove operations, quick-mode flags, generated scripts, and what happens when you mistype.

Project management

CommandDescription
cem devStart the dev server with live reload and a pretty terminal UI
cem buildMiddleware guard + architecture guard + compile TypeScript to dist/
cem startStart the production server with preflight checks and safety guards
cem checkType check, lint (ESLint v10) and format check in one go (supports --fix)
cem fixAuto-fix ESLint issues and Prettier code formatting in one rapid step
cem ejectInline standalone scripts into package.json and decouple from the CLI dependency
cem list · cem lsList modules, middlewares, env vars and Swagger status

Add commands

CommandDescription
cem add module <Name...> [-y]Scaffold one or more complete feature modules (-y skips interactive questions)
cem add env <KEY...>Add env vars to .env, .env.example and config/index.ts
cem add middleware <name...>Create one or more middlewares in src/app/middlewares/

Remove commands

CommandDescription
cem remove module <Name...> [-y]Delete module folder(s) and unwire from routes/index.ts (-y skips confirmation)
cem remove middleware <name...>Delete custom middleware file(s)
cem remove env <KEY...>Remove env var(s) from all three config locations

cem rm is an alias for cem remove and works with every subcommand.

Quick mode (-y / --yes)

Skip every prompt and scaffold with the recommended stack:

bash
cem my-api -y
# or
npx create-express-modular my-api --yes
# or bun
bunx create-express-modular my-api -y

Defaults applied: Mongoose · Zod · JWT auth · HTTP-only cookies · Docker · Swagger.

Overriding flags

bash
# Prisma + PostgreSQL instead of Mongoose
cem my-api -y --db prisma

# Skip Docker
cem my-api -y --no-docker

# Drizzle, Joi and header-based auth
cem my-api -y --db drizzle --validator joi --header

# Skip npm install (for CI/CD or custom pipelines)
cem my-api -y --no-install
cem my-api -y --skip-install

# Explicit package manager selection
cem my-api -y --pm bun

Configuration schema (cem-cli.schema.json)

Scaffolded projects include a cem-cli.schema.json file. Editors like VS Code and WebStorm use it to provide instant autocompletion and validation when editing cem-cli.json.

Generated project scripts

npmyarn / pnpm / bunEquivalent to
npm run start:devyarn start:dev · pnpm start:dev · bun start:devcem dev
npm run buildyarn build · pnpm build · bun run buildcem build
npm run checkyarn check · pnpm check · bun run checkcem check
npm run fixyarn fix · pnpm fix · bun run fixcem fix
npm startyarn start · pnpm start · bun startcem start
npm run lintyarn lint · pnpm lint · bun run linteslint src
npm run lint:fixyarn lint:fix · pnpm lint:fix · bun run lint:fixeslint src --fix
npm run prettier:fixyarn prettier:fix · pnpm prettier:fix · bun run prettier:fixprettier --write src

Unknown commands

Pass an unknown flag and the CLI prints the full command list instead of a stack trace:

✖  Unknown flag: "--foo"

⚠  Available commands:
   cem [project-name]              — scaffold a new project
   cem dev                         — start dev server with hot reload
   cem build                       — compile TypeScript to dist/
   cem start                       — start the production server
   cem check                       — run type-check, lint, and format check (supports --fix)
   cem fix                         — auto-fix linting and formatting issues
   cem eject                       — inline standalone scripts into package.json
   cem list                        — list modules, middlewares, and env vars
   cem add module <name...>        — generate one or more feature modules (-y supported)
   cem add middleware <name...>    — generate one or more custom middlewares
   cem add env <KEY...>            — add one or more env variables
   cem remove module <name...>     — delete module(s) and unwire routes (-y supported)
   cem remove middleware <name...> — delete middleware file(s)
   cem remove env <KEY...>         — remove env var(s) from all config files
   cem --version                   — print the installed version
   cem --help                      — show this help message