Express.js boilerplate with a clean, layered architecture designed for rapid backend development. Built with flexibility in mind, supporting both TypeScript and JavaScript to match your preferences.
- Express.js — Fast, minimalist web framework for Node.js
- TypeScript & JavaScript Support — Choose your preferred language or switch between them seamlessly
- Jest — Comprehensive testing framework with built-in mocking and coverage
- Babel Integration — Pre-configured for seamless Jest compatibility, ensuring tests always work reliably
- ESLint — Strict linting rules for consistent code quality
- Prettier — Opinionated code formatting for unified style across your team
- Layered Architecture — Clean separation of concerns with dedicated layers:
- Controllers — Handle request/response logic
- Routes — Define API endpoints and middleware
- Configs — Centralized configuration management
- Services — Business logic layer (ready to extend)
- Production-Ready Structure — Organized for scalability and maintainability
- dotenv — Environment variable management
- cors — Cross-Origin Resource Sharing
- express-rate-limit — Rate limiting
- helmet — Security headers
src/
├── index # Application entry point
├── config/ # Configuration layer
│ └── limiter.config # Rate limiting configuration
│ └── cors.config # CORS configuration
├── controllers/ # Controller layer
│ └── getter.controller # Example controller
└── routes/ # Routing layer
└── getter.route # Example route definition
tests/
└── getHello.test # Example test suiteThis creates the directory and install the package
npx gen-ex-app <project-name>or
This uses the current directory and install the package
npx gen-ex-app .Start the development server with hot-reloading:
npm run devType-check in watch mode: for (Typescript only)
npm run dev:type-checkBuild the project (Only if using Typescript, you can proceed to 'npm start' if using Javascript):
npm run buildStart the server:
npm startOr build and start in one step: (Typescript only)
npm run build-startCheck linting errors:
npm run lintFix linting errors:
npm run lint:fixFormat code with Prettier:
npm run formatCheck formatting:
npm run format:checkRun all tests:
npm testGET /— Returns"Hello World"
- Add new routes in
src/routes/ - Add new controllers in
src/controllers/ - Add tests in
tests/