Getting Started

Install & scaffold

Spin up a production-ready Express + TypeScript backend in under a minute.

Prerequisites

  • Node.js v18+
  • npm v9+
  • A database (MongoDB, PostgreSQL) — local or cloud

Scaffold a new project

Use the one-shot npx form (no install required):

bash
npx create-express-modular my-api

Or install the CLI globally and use the short alias:

bash
npm install -g create-express-modular
cem my-api

The wizard

The CLI asks you a handful of questions to tailor the generated project:

bash
? Project name: my-api
? Database / ORM: Mongoose  (MongoDB)
? Validator: Zod  (recommended)
? Include JWT Auth module? Yes
? Auth token delivery: HTTP-only cookies  (recommended)
? Include Docker setup? Yes

Project structure

CEM generates an opinionated, domain-driven layout:

my-api/
├── src/
│   ├── app/
│   │   ├── config/index.ts          # typed, centralized config
│   │   ├── errors/                  # AppError + Mongoose handler
│   │   ├── middlewares/             # auth, rate-limit, error, 404
│   │   ├── modules/                 # feature modules (auto-wired)
│   │   │   └── Auth/
│   │   ├── routes/index.ts          # router registry
│   │   └── utils/                   # catchAsync, sendResponse, QueryBuilder...
│   ├── app.ts                       # Express app
│   └── server.ts                    # DB + listen
├── .env / .env.example
├── Dockerfile / docker-compose.yml
└── package.json

Run it

bash
cd my-api
npm install
cem dev

Open http://localhost:5000 — you'll see CEM's branded welcome page with live metadata and a clickable health check.