create-express-clean
v1.0.6
Published
Generate Express.js project with Clean Architecture
Readme
Express Clean Architecture Generator
🚀 A powerful CLI tool for generating Express.js projects with Clean Architecture principles baked in.
Features • Installation • Quick Start • Documentation • Contributing
🌟 Overview
Express Clean Architecture Generator is a CLI tool designed to streamline the process of creating robust Express.js applications. It implements Uncle Bob's Clean Architecture principles, providing a solid foundation for building scalable and maintainable Node.js applications.
✨ Features
Architecture & Structure
- 🏗️ Clean Architecture Implementation
- Domain-driven design approach
- Clear separation of concerns
- Modular and maintainable structure
Database Integration
🐘 PostgreSQL Support
- Built-in connection setup
- Repository pattern implementation
- Migration structure
🍃 MongoDB Support
- Mongoose integration
- Schema templates
- Repository abstractions
Developer Experience
🛠️ Pre-configured Tools
- ESLint for code linting
- Prettier for code formatting
- Jest for testing
- Nodemon for development
📝 Documentation
- Comprehensive inline comments
- API documentation setup
- Swagger integration ready
🚀 Quick Start
Installation
npx create-express-cleanInteractive Setup
📂 Project name: your-project-name
──────────────────────────────────────────────────
🔧 Select your database engine:
──────────────────────────────────────────────────
1. 🐘 PostgreSQL - Robust relational database
2. 🍃 MongoDB - Flexible NoSQL database
3. ❌ None - No database setup
──────────────────────────────────────────────────📁 Project Structure
src/
├── app.js # Application setup
├── server.js # Server entry point
│
├── application/ # Application business rules
│ ├── services/ # Application services
│ └── use-cases/ # Use case implementations
│
├── domain/ # Enterprise business rules
│ ├── entities/ # Business entities
│ ├── repositories/ # Repository interfaces
│ ├── services/ # Domain services
│ └── value-objects/ # Value objects
│
├── infrastructure/ # Frameworks & drivers
│ ├── logger/ # Logging implementation
│ └── security/ # Security configurations
│
└── interfaces/ # Interface adapters
├── controllers/ # Request handlers
├── middlewares/ # Express middlewares
├── routes/ # Route definitions
└── validators/ # Input validation🛠️ Getting Started
1. Create Your Project
npx create-express-clean2. Navigate to Project Directory
cd your-project-name3. Configure Environment Variables
cp .env.example .env4. Start Development Server
npm run dev⚙️ Configuration
PostgreSQL Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=your_database
DB_USER=your_username
DB_PASSWORD=your_passwordMongoDB Configuration
MONGODB_URI=mongodb://localhost:27017/your_database📜 Available Scripts
| Command | Description |
|---------|-------------|
| npm run dev | Start development server with hot-reload |
| npm start | Start production server |
| npm test | Run tests |
| npm run lint | Run ESLint |
| npm run format | Format code with Prettier |
📚 Documentation
Architecture Overview
Our implementation follows the Clean Architecture principles:
- Domain Layer: Contains business logic and rules
- Application Layer: Orchestrates the flow of data
- Infrastructure Layer: Implements technical capabilities
- Interfaces Layer: Handles external communications
Database Setup
PostgreSQL Integration
// Example repository implementation
class UserRepository implements IUserRepository {
async findById(id: string): Promise<User> {
// Implementation
}
}MongoDB Integration
// Example mongoose schema
const userSchema = new Schema({
name: { type: String, required: true },
email: { type: String, unique: true }
});🤝 Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
Created with ❤️ by Afauzi
Show your support
Give a ⭐️ if this project helped you!
Built with Clean Architecture principles • Made for modern Node.js development • Open for community contributions
