gen-express-cli
gen-express-cli copied to clipboard
A alternative to express-generator supporting ES Module, TypeScript, Jest, Dockerfile, ESLint & Prettier and path alias.
GEN-EXPRESS-CLI
π Introduction
gen-express-cli is a powerful and modern alternative to the default express-generator, designed to help you build structured, scalable, and production-ready Express applicationsβfast.
With just a single command, it scaffolds a clean, opinionated project layout powered by TypeScript, ESM, testing, validation, environment configs, and more. Whether you're building a quick prototype or a maintainable backend for a real-world product, gen-express-cli provides everything you need to get startedβwithout the boilerplate.
Forget the chaos of manually setting up tools and project structure. This CLI gives you best practices out of the box, while keeping the flexibility and simplicity of Express.
β¨ Features
- π¦ Full ESM Support (TypeScript module: NodeNext)
- π Organized Folder Structure (controllers, services, routes, middlewares, etc.)
- π§ TypeScript with readyβtoβuse build scripts
- π§° ESLint v9 (Flat Config) & Prettier preconfigured
- π§ͺ Unit Testing with Jest (ESMβready setup)
- π£οΈ Path Aliases (
#src/) with runtime resolution - π³ Dockerfile for production builds
- βοΈ Environment Config Setup
- β Request Validation (with zod)
- π§Ύ Logger (with winston) & Error Handling
- βοΈ CI Templates (with GitHub Actions format/lint/test)
π Quick Start
npx gen-express-cli@latest <project-name>
npm run dev # for development
npm run start # for production
npm run build # for typescript build
npm run lint # for eslint
npm run lint:fix # for eslint fix
npm run format # for prettier
npm run format:check # for prettier check
npm run typecheck # for typescript type check
npm run test # for unit test
npm run test:watch # for unit test in watch mode
npm run test:cov # for test coverage
docker build -t my-express-app:1.0 .
docker run -p 8000:8000 --env-file ./.env my-express-app:1.0
π Folder Structure
ts
ββ .dockerignore
ββ .nvmrc
ββ .prettierignore
ββ .prettierrc.json
ββ Dockerfile
ββ eslint.config.js
ββ jest.config.ts
ββ package-lock.json
ββ package.json
ββ README.md
ββ src
β ββ app.ts
β ββ config
β β ββ env.ts
β ββ middlewares
β β ββ error-handler.ts
β β ββ index.ts
β β ββ logger.ts
β β ββ validate.ts
β ββ modules
β β ββ healthcheck
β β β ββ healthcheck.controller.ts
β β β ββ healthcheck.route.ts
β β ββ user
β β ββ user.controller.ts
β β ββ user.route.ts
β β ββ user.schema.ts
β β ββ user.service.test.ts
β β ββ user.service.ts
β β ββ user.types.ts
β ββ server.ts
ββ tsconfig.build.json
ββ tsconfig.json
π License
This project is licensed under the terms of the MIT license.
π€ Contributing
Contributions, issues and feature requests are welcome! Feel free to give your feedback and give me a star if you like this project.