Skip to content

Alkamal01/RustKit

Repository files navigation

RustKit

A professional Microservice Starter Kit built with Rust, implementing Domain-Driven Design (DDD) and Clean Architecture.

RustKit is a production-ready template designed to accelerate the development of scalable and maintainable microservices. It leverages the power of Rust's ecosystem to provide a robust foundation for enterprise-grade applications.

🚀 Key Features

  • Domain-Driven Design (DDD): Strictly enforces separation of concerns through Domain, Application, Infrastructure, and Presentation layers.
  • Clean Architecture: Ensures business logic remains independent of frameworks and external agents.
  • CQRS Pattern: Implements Command Query Responsibility Segregation for optimized data handling.
  • High Performance: Built on Actix Web and Tokio for asynchronous, non-blocking execution.
  • Reliable Storage: Integrated PostgreSQL with Diesel ORM and migration management.
  • OpenAPI Documentation: Automatic API documentation generation with Swagger UI.
  • Container Native: Docker and Docker Compose configurations included for effortless deployment.
  • Testing Model: Pre-configured integration testing environment using Testcontainers.

🏗️ Architecture

The project is organized into four distinct layers, adhering to the Dependency Rule:

  1. Domain Layer: The core of the system, containing entities, value objects, and business rules. It has zero external dependencies.
  2. Application Layer: Contains application specific business rules and use cases. It orchestrates the flow of data to and from the domain entities.
  3. Infrastructure Layer: Provides implementations for interfaces defined in the application layer (e.g., database persistence, external API calls).
  4. Presentation Layer: The entry point for the application, handling HTTP requests and routing them to the appropriate application logic.

🛠️ Tech Stack

🏁 Getting Started

Prerequisites

  • Rust (Latest Stable)
  • Docker & Docker Compose

Installation

  1. Clone the project

    git clone https://github.com/yourusername/rustkit.git
    cd RustKit
  2. Start the environment Launch the database and service using the provided script.

    cd deployment/docker
    ./docker-compose-all.sh up --build -d
  3. Explore the API Once running, the API documentation is available at: http://localhost:8080/swagger-ui/

  4. Run Locally You can also run the service directly with Cargo (ensure the database is running):

    cargo run --package starter

⚙️ Configuration

Configuration is centralized in config.app.toml and can be overridden by environment variables.

Default Configuration:

[service]
http_url = '127.0.0.1:8181'
service_name = 'rustkit_service'

[database]
database_url = 'postgres://postgres:postgres@localhost:5432/rustkit_db'

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ by kaftandev

About

A professional Microservice Starter Kit built with Rust, implementing Domain-Driven Design (DDD) and Clean Architecture.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages