create-express-starter-kit
v1.0.3
Published
CLI to scaffold production-ready Express backends with auth, DB, caching, validation, and Docker support.
Downloads
764
Maintainers
Readme
create-express-starter-kit
A powerful CLI tool that interactively scaffolds a production-ready Express.js backend. By answering a few quick questions, it generates a robust, modular, and fully configured codebase tailored to your specific stack requirements.
📦 Usage
You can generate your project in an empty directory without installing the package globally. Run one of the following commands:
pnpm dlx create-express-starter-kitOR
npx create-express-starter-kit✨ Features & Available Integrations
The CLI prompts you with several configuration choices to automatically wire up your project dependencies, middleware, and project structure:
- Package Manager 📦:
- npm
- pnpm
- yarn
- Authentication 🔐:
- None
- Custom JWT-based Auth (with Access & Refresh Tokens, bcrypt, and cookies)
- Clerk Auth Support
- Database 🗄️:
- MongoDB (via Mongoose)
- PostgreSQL (via Prisma ORM - automatically initializes schemas)
- None
- In-Memory Cache / DB ⚡:
- Redis (via ioredis)
- Valkey
- None
- Validation 🛡️:
- Zod (generates validation middlewares and example schemas)
- None
- File Uploads ☁️:
- Multer + Cloudinary
- Multer + AWS S3
- None
- Docker 🐳:
- Automatically generates a
docker-compose.ymlfor your selected databases so you can start them with one click (includes MongoDB, Postgres, pgAdmin, Redis Stack, and Valkey configurations).
- Automatically generates a
Base Folder Structure
When the setup begins, the CLI scaffolding lays down a lean, base Express app using domain-driven design:
.
├── controllers/
│ └── example.controller.js
├── middlewares/
│ └── example.middleware.js
├── public/
├── routers/
│ └── example.route.js
├── utils/
│ ├── ApiError.js
│ ├── ApiResponse.js
│ └── asyncHandler.js
├── app.js
└── index.js🔄 How Selections Modify the Codebase
Based on your exact selections, files are cleanly swapped or generated so you are never left with useless "dead code":
Custom JWT Auth Replaces example files with full Register/Login/Logout/Refresh token functionality.
.
├── controllers/
│ └── user.controller.js
├── middlewares/
│ └── auth.middleware.js
├── routers/
│ └── user.route.js
├── app.js (updated)
└── index.js (updated)Clerk Auth
Rewrites app.js to mount Clerk's strict express middleware.
.
└── app.js (updated with @clerk/express)Database (MongoDB/Mongoose) Adds database connection and relevant model schemas.
.
├── models/
│ └── user.model.js (or example.model.js)
└── utils/
└── connectDB.jsDatabase (PostgreSQL/Prisma) Initializes Prisma schema and singleton database clients.
.
├── prisma/
│ └── schema.prisma
└── utils/
├── connectDB.js
└── prismaClient.jsValidation (Zod) Injects validation middleware and Zod schema definitions.
.
├── middlewares/
│ └── validate.middleware.js
└── schemas/
└── user.schema.jsIn-Memory Cache (Redis / Valkey) Drops a configured client instance strictly for the chosen service.
.
└── utils/
└── redis.js (or valkey.js)File Uploads (Cloudinary / AWS S3) Generates local disk storage middleware and dedicated SDK upload service.
.
├── middlewares/
│ └── multer.middleware.js
└── utils/
└── cloudinary.js (or uploadS3.js)Docker Writes a custom compose file defining services uniquely based on databases/caches opted into.
.
└── docker-compose.yml🛠️ What it Does Under the Hood
- Initializes the Project: Creates your
package.jsonconfigured with ESM (type: "module") and sets up adevscript usingnode --watch. - Installs Dependencies: Dynamically installs only the packages you need (e.g.,
express,cors,zod,mongoose,prisma,multer, etc.) using your chosen package manager (npm, pnpm, or yarn). - Scaffolds Structure: Sets up a clean domain-driven directory structure including
controllers/,routers/,models/,middlewares/,utils/, and error-handling utilities likeApiErrorandApiResponse. - Writes Boilerplate: Injects full, ready-to-use boilerplate code (e.g., fully-functional JWT Login/Register/Refresh flows, Prisma connections, Zod error validators) based on your exact technology stack.
- Generates Environment Variables: Appends the necessary secrets, Database URIs, and config keys directly into a
.envfile so you know exactly what is required.
🚀 Getting Started
Once the CLI finishes running:
- Open the
.envfile and fill in your missing credentials (like DB connection strings, JWT secrets, Cloudinary/AWS keys). - Start up your Docker containers (if generated):
docker-compose up -d - Run the development server:
npm run dev
📄 License
MIT
