Skip to content

arielsrv/Turbo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

47 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Turbo - CQRS API

A modern, high-performance CQRS (Command Query Responsibility Segregation) API built with .NET 9, featuring reactive programming patterns and clean architecture principles.

๐Ÿš€ Features

  • CQRS Pattern: Clear separation between commands (write operations) and queries (read operations)
  • Reactive Programming: Built with System.Reactive for efficient event handling
  • Clean Architecture: Well-structured layers with dependency injection
  • In-Memory Repository: Fast development and testing with in-memory data storage
  • OpenAPI Support: Auto-generated API documentation
  • Docker Support: Containerized deployment ready
  • Comprehensive Testing: Full test coverage with unit tests

๐Ÿ—๏ธ Architecture

The project follows CQRS pattern with the following structure:

Turbo.API/
โ”œโ”€โ”€ Commands/          # Write operations (Create, Update, Delete)
โ”œโ”€โ”€ Queries/           # Read operations (Get, GetAll)
โ”œโ”€โ”€ Controllers/       # API endpoints
โ”œโ”€โ”€ Models/            # Domain entities
โ”œโ”€โ”€ DTOs/              # Data Transfer Objects
โ”œโ”€โ”€ Repositories/      # Data access layer
โ”œโ”€โ”€ Mediation/         # Command/Query handlers
โ””โ”€โ”€ Tests/             # Unit tests

๐Ÿ› ๏ธ Technology Stack

  • .NET 9: Latest .NET framework
  • ASP.NET Core: Web API framework
  • MediatR: Mediator pattern implementation
  • System.Reactive: Reactive programming support
  • OpenAPI: API documentation
  • Docker: Containerization

๐Ÿ“‹ Prerequisites

  • .NET 9 SDK
  • Docker (optional, for containerized deployment)
  • Your favorite IDE (Visual Studio, VS Code, Rider)

๐Ÿš€ Getting Started

1. Clone the Repository

git clone <repository-url>
cd Turbo

2. Run the Application

Option A: Using .NET CLI

cd Turbo.API
dotnet restore
dotnet run

Option B: Using Docker

docker-compose up --build

3. Access the API

  • API Base URL: https://localhost:7001 (or http://localhost:5001)
  • OpenAPI Documentation: https://localhost:7001/openapi (in development)

๐Ÿ“š API Documentation

Users Endpoints

Create User

POST /api/users
Content-Type: application/json

{
  "name": "John Doe",
  "email": "[email protected]"
}

Get User by ID

GET /api/users/{id}

Get User by Email

GET /api/users/email/{email}

Get All Users

GET /api/users

Update User

PUT /api/users/{id}
Content-Type: application/json

{
  "name": "John Updated",
  "email": "[email protected]"
}

Delete User

DELETE /api/users/{id}

๐Ÿงช Testing

Run the test suite:

cd Turbo.API.Tests
dotnet test

๐Ÿ—๏ธ Project Structure

Commands

  • CreateUserCommand: Creates a new user
  • UpdateUserCommand: Updates an existing user
  • DeleteUserCommand: Deletes a user

Queries

  • GetUserByIdQuery: Retrieves a user by ID
  • GetUserByEmailQuery: Retrieves a user by email
  • GetAllUsersQuery: Retrieves all users

Models

  • User: Domain entity representing a user

DTOs

  • UserDto: Data transfer object for user operations
  • UserResponse: Response model for user operations
  • UsersResponse: Response model for multiple users

๐Ÿ”ง Configuration

The application uses standard ASP.NET Core configuration:

  • appsettings.json: Production settings
  • appsettings.Development.json: Development settings

๐Ÿณ Docker

The project includes Docker support with:

  • Dockerfile: Multi-stage build for optimized container
  • compose.yaml: Docker Compose configuration
  • .dockerignore: Excludes unnecessary files from build context

๐Ÿค Contributing

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

๐Ÿ†˜ Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Contact the maintainers

๐Ÿ”ฎ Roadmap

  • Database integration (Entity Framework Core)
  • Event sourcing implementation
  • Message queue integration
  • Authentication and authorization
  • API rate limiting
  • Caching layer
  • Performance monitoring

Built with โค๏ธ using .NET 9 and CQRS patterns

About

CRQS + MediatR + RX + Moq

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •