gen-ex-app
v0.1.0
Published
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.
Downloads
91
Maintainers
Readme
🚀 Generate Express App
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.
✨ Features
🎯 Core Framework
- Express.js — Fast, minimalist web framework for Node.js
- TypeScript & JavaScript Support — Choose your preferred language or switch between them seamlessly
🧪 Testing & Quality
- 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
🏗️ Architecture
- 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
🔧 Built-in Utilities
- dotenv — Environment variable management
- cors — Cross-Origin Resource Sharing
- express-rate-limit — Rate limiting
- helmet — Security headers
🗂️ Project Structure
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 suite🏁 Getting Started
1. Creating the project
This 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 .3. Development
Start the development server with hot-reloading:
npm run devType-check in watch mode: for (Typescript only)
npm run dev:type-check4. Build and Run
Build 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-start5. Linting and Formatting
Check linting errors:
npm run lintFix linting errors:
npm run lint:fixFormat code with Prettier:
npm run formatCheck formatting:
npm run format:check6. Testing
Run all tests:
npm test📡 Example Endpoint
GET /— Returns"Hello World"
🛠️ Customization
- Add new routes in
src/routes/ - Add new controllers in
src/controllers/ - Add tests in
tests/
