Install

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

Today
0
This week
0
This month
0
All time
0

npm registry downloads

Today
0
This week
0
This month
0
All time
0

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.

create-express-modular/src/telemetry.tsts
// 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:

bash
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+, yarn v1.22+, pnpm v8+, or bun v1.0+

Global install (recommended)

Installing globally gives you the short cem command everywhere:

bash
# 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-modular

Verify it is on your path:

bash
cem --version
cem --help

One-shot run

If you prefer not to install, run the latest version directly. CEM detects the package manager automatically.

bash
# 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-api

Quick mode flags

Pass -y or --yes to skip every prompt and scaffold with the recommended stack.

bash
cem my-api -y

Defaults 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

bash
# 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 cookies

What 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 + scripts

Key files explained

FilePurpose
cem-cli.jsonTracks the chosen stack so later add/remove commands stay consistent.
src/app/config/index.tsOne typed place for env vars and app-wide constants.
src/app/routes/index.tsAuto-wires every module's router. New modules plug in here.
src/app/errors/AppError.tsStructured errors with statusCode, message and stack.
src/app/middlewares/auth.tsJWT guard — generated when auth is enabled.
src/app/utils/catchAsync.tsWraps async route handlers so errors reach the error middleware.

Run it

bash
cd my-api
npm install
cem dev

Open http://localhost:5000 to see the CEM welcome page, health check, and a link to the interactive Swagger docs at /docs.