create-express-clean v1.0.6
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-clean
Interactive 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-clean
2. Navigate to Project Directory
cd your-project-name
3. Configure Environment Variables
cp .env.example .env
4. 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_password
MongoDB 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