Install create-express-modular
The exact commands, flags, and files. Choose a one-shot run or a global install — then scaffold in seconds.
Developers scaffolding with CEM
The top row counts real cem my-api runs reported by the CLI itself. The bottom row is the npm registry download count for the package.
Projects scaffolded · live from the CLI
npm registry downloads
Reporting a run from the CLI
After a successful scaffold, CEM sends one anonymous ping. No project name, path, email or IP is stored — only the command, CLI version, package manager, Node version and OS.
// src/telemetry.ts — called once after a successful scaffold
import os from 'node:os';
import { randomUUID } from 'node:crypto';
const ENDPOINT =
'https://create-express-modular.lovable.app/api/public/install-ping';
export async function reportInstall(command = 'create') {
if (process.env.CEM_TELEMETRY === 'off') return;
try {
await fetch(ENDPOINT, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
command,
cliVersion: process.env.npm_package_version ?? 'unknown',
packageManager: (process.env.npm_config_user_agent ?? '').split('/')[0],
nodeVersion: process.version,
os: `${os.platform()}-${os.arch()}`,
anonId: randomUUID(),
}),
});
} catch {
/* telemetry must never break a scaffold */
}
}Read the current totals at any time:
curl https://create-express-modular.lovable.app/api/public/install-ping
# { "today": 3, "week": 21, "month": 84, "total": 512 }Prerequisites
- Node.js
v18+ - One of: npm
v9+, yarnv1.22+, pnpmv8+, or bunv1.0+
Global install (recommended)
Installing globally gives you the short cem command everywhere:
# npm
npm install -g create-express-modular
# yarn
yarn global add create-express-modular
# pnpm
pnpm add -g create-express-modular
# bun
bun add -g create-express-modularVerify it is on your path:
cem --version
cem --helpOne-shot run
If you prefer not to install, run the latest version directly. CEM detects the package manager automatically.
# npm
npx create-express-modular my-api
# yarn
yarn create express-modular my-api
# pnpm
pnpm dlx create-express-modular my-api
# bun
bunx create-express-modular my-apiQuick mode flags
Pass -y or --yes to skip every prompt and scaffold with the recommended stack.
cem my-api -yDefaults applied in quick mode:
- Database / ORM: Mongoose (MongoDB)
- Validator: Zod
- Auth: JWT with HTTP-only cookies
- Docker files included
- Swagger / OpenAPI 3.0 docs included
Override individual choices
# Pick a different database / ORM
cem my-api -y --db prisma
cem my-api -y --db drizzle
# Pick a different validator
cem my-api -y --validator joi
# Skip optional features
cem my-api -y --no-auth
cem my-api -y --no-docker
cem my-api -y --no-swagger
# Token delivery style
cem my-api -y --header # Authorization header instead of cookiesWhat gets generated
After the wizard finishes, my-api/ contains a fully wired, domain-driven Express + TypeScript project.
my-api/
├── src/
│ ├── app/
│ │ ├── config/index.ts # typed, centralized config
│ │ ├── config/swagger.ts # OpenAPI 3.0 spec generator (Swagger only)
│ │ ├── errors/ # AppError + error handler
│ │ ├── middlewares/ # auth, rate-limit, error, 404
│ │ ├── modules/ # feature modules (auto-wired)
│ │ │ └── Auth/ # generated when --auth is true
│ │ ├── routes/index.ts # router registry
│ │ └── utils/ # catchAsync, sendResponse, QueryBuilder...
│ ├── app.ts # Express app instance
│ └── server.ts # DB connection + listen
├── .env # local environment variables
├── .env.example # documented env template
├── cem-cli.json # CEM manifest (tracks stack & features)
├── Dockerfile # multi-stage production image
├── docker-compose.yml # local MongoDB / app orchestration
├── eslint.config.js # lint rules
├── .prettierrc # format rules
├── tsconfig.json # TypeScript config
└── package.json # deps + scriptsKey files explained
| File | Purpose |
|---|---|
| cem-cli.json | Tracks the chosen stack so later add/remove commands stay consistent. |
| src/app/config/index.ts | One typed place for env vars and app-wide constants. |
| src/app/routes/index.ts | Auto-wires every module's router. New modules plug in here. |
| src/app/errors/AppError.ts | Structured errors with statusCode, message and stack. |
| src/app/middlewares/auth.ts | JWT guard — generated when auth is enabled. |
| src/app/utils/catchAsync.ts | Wraps async route handlers so errors reach the error middleware. |
Run it
cd my-api
npm install
cem devOpen http://localhost:5000 to see the CEM welcome page, health check, and a link to the interactive Swagger docs at /docs.