1.0.6 • Published 7 months ago

create-express-clean v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Express Clean Architecture Generator

NPM Version Downloads License: MIT

šŸš€ 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

CommandDescription
npm run devStart development server with hot-reload
npm startStart production server
npm testRun tests
npm run lintRun ESLint
npm run formatFormat code with Prettier

šŸ“š Documentation

Architecture Overview

Our implementation follows the Clean Architecture principles:

  1. Domain Layer: Contains business logic and rules
  2. Application Layer: Orchestrates the flow of data
  3. Infrastructure Layer: Implements technical capabilities
  4. 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:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

8 months ago

1.0.0

8 months ago