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
| Command | Description |
|---|---|
| cem dev | Start the dev server with live reload and a pretty terminal UI |
| cem build | Middleware guard + architecture guard + compile TypeScript to dist/ |
| cem start | Start the production server with preflight checks and safety guards |
| cem check | Type check, lint (ESLint v10) and format check in one go (supports --fix) |
| cem fix | Auto-fix ESLint issues and Prettier code formatting in one rapid step |
| cem eject | Inline standalone scripts into package.json and decouple from the CLI dependency |
| cem list · cem ls | List modules, middlewares, env vars and Swagger status |
Add commands
| Command | Description |
|---|---|
| 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
| Command | Description |
|---|---|
| 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 -yDefaults 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 bunConfiguration 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
| npm | yarn / pnpm / bun | Equivalent to |
|---|---|---|
| npm run start:dev | yarn start:dev · pnpm start:dev · bun start:dev | cem dev |
| npm run build | yarn build · pnpm build · bun run build | cem build |
| npm run check | yarn check · pnpm check · bun run check | cem check |
| npm run fix | yarn fix · pnpm fix · bun run fix | cem fix |
| npm start | yarn start · pnpm start · bun start | cem start |
| npm run lint | yarn lint · pnpm lint · bun run lint | eslint src |
| npm run lint:fix | yarn lint:fix · pnpm lint:fix · bun run lint:fix | eslint src --fix |
| npm run prettier:fix | yarn prettier:fix · pnpm prettier:fix · bun run prettier:fix | prettier --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