Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

booking-microservices

> DevOps
Open source

A practical microservices with the latest technologies and architectures like Vertical Slice Architecture, Event Sourcing, CQRS, DDD, gRpc, MongoDB, RabbitMq,

1.4K stars0 likes0 views
WebsiteGitHub

About

A practical microservices with the latest technologies and architectures like Vertical Slice Architecture, Event Sourcing, CQRS, DDD, gRpc, MongoDB, RabbitMq,

A practical microservices with the latest technologies and architectures like Vertical Slice Architecture, Event Sourcing, CQRS, DDD, gRpc, MongoDB, RabbitMq, Wolverine, and Aspire in .Net 10.

You can find other version of this project here:

  • Booking with Modular Monolith Architecture
  • Booking with Monolith Architecture

Table of Contents

  • The Goals of This Project
  • Technologies - Libraries
  • Key Features
  • When to Use
  • Challenges
  • The Domain and Bounded Context - Service Boundary
  • Structure of Project
  • Development Setup
    • Dotnet Tools Packages
    • Husky
    • Upgrade Nuget Packages
  • How to Run
    • Config Certificate
    • Aspire
    • Docker Compose
    • Kubernetes
    • Build
    • Run
    • Test
  • Documentation Apis
  • Support
  • Contribution

The Goals of This Project

  • :sparkle: Using Vertical Slice Architecture for architecture level.
  • :sparkle: Using Domain Driven Design (DDD) to implement all business logic.
  • :sparkle: Using Rabbitmq on top of Wolverine for Event Driven Architecture.
  • :sparkle: Using gRPC for internal communication.
  • :sparkle: Using CQRS implementation with MediatR library.
  • :sparkle: Using Postgres for write side database.
  • :sparkle: Using MongoDB for read side database.
  • :sparkle: Using Event Store for write side of Booking Microservice/Module to store all historical change of aggregate.
  • :sparkle: Using Wolverine durable Inbox Pattern for ensuring message idempotency for receiver and Exactly once Delivery.
  • :sparkle: Using Wolverine durable Outbox Pattern for ensuring no message is lost and there is at At Least One Delivery.
  • :sparkle: Using Wolverine durable local queues for internal commands and asynchronous in-process workflows.
  • :sparkle: Using Unit Testing for testing small units and mocking our dependencies with Nsubstitute.
  • :sparkle: Using End-To-End Testing and Integration Testing for testing features with all dependencies using testcontainers.
  • :sparkle: Using Contract Testing with PactNet for verifying producer and consumer compatibility.
  • :sparkle: Using Fluent Validation and a Validation Pipeline Behaviour on top of MediatR.
  • :sparkle: Using Minimal API for all endpoints.
  • :sparkle: Using AspNetCore OpenApi for generating built-in support OpenAPI documentation in ASP.NET Core.
  • :sparkle: Using Health Check for reporting the health of app infrastructure components.
  • :sparkle: Using Docker-Compose and Kubernetes for our deployment mechanism.
  • :sparkle: Using Kibana on top of Serilog for logging.
  • :sparkle: Using OpenTelemetry for distributed tracing on top of Jaeger.
  • :sparkle: Using OpenTelemetry for monitoring on top of Prometheus and Grafana.
  • :sparkle: Using IdentityServer for authentication and authorization base on OpenID-Connect and OAuth2.
  • :sparkle: Using Yarp as a microservices gateway.
  • :sparkle: Using Kubernetes to achieve efficient scaling and ensure high availability for each of our microservices.
  • :sparkle: Using Nginx Ingress Controller for load balancing between our microservices top of Kubernetes.
  • :sparkle: Using cert-manager to Configure TLS in kubernetes cluster.
  • :sparkle: Using Aspire for service discovery, observability, and local orchestration of microservices.

Technologies - Libraries

  • ✔️ .NET 10 - .NET Framework and .NET Core, including ASP.NET and ASP.NET Core.
  • ✔️ MVC Versioning API - Set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core.
  • ✔️ EF Core - Modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
  • ✔️ AspNetCore OpenApi - Provides built-in support for OpenAPI document generation in ASP.NET Core.
  • ✔️ Wolverine - Durable messaging and local workflow library for .NET with RabbitMQ transport, inbox/outbox support, and local queues.
  • ✔️ MediatR - Simple, unambitious mediator implementation in .NET.
  • ✔️ FluentValidation - Popular .NET validation library for building strongly-typed validation rules.
  • ✔️ Scalar - Scalar provides an easy way to render beautiful API references based on OpenAPI/Swagger documents.
  • ✔️ Swagger UI - Swagger tools for documenting API's built on ASP.NET Core.
  • ✔️ Serilog - Simple .NET logging with fully-structured events
  • ✔️ Polly - Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.
  • ✔️ Scrutor - Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection
  • ✔️ Opentelemetry-dotnet - The OpenTelemetry .NET Client
  • ✔️ DuendeSoftware IdentityServer - The most flexible and standards-compliant OpenID Connect and OAuth 2.x framework for ASP.NET Core.
  • ✔️ EasyCaching - Open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier.
  • ✔️ Mapster - Convention-based object-object mapper in .NET.
  • ✔️ Hellang.Middleware.ProblemDetails - A middleware for handling exception in .Net Core.
  • ✔️ NewId - NewId can be used as an embedded unique ID generator that produces 128 bit (16 bytes) sequential IDs.
  • ✔️ Yarp - Reverse proxy toolkit for building fast proxy servers in .NET.
  • ✔️ Tye - Developer tool that makes developing, testing, and deploying microservices and distributed applications easier.
  • ✔️ gRPC-dotnet - gRPC functionality for .NET.
  • ✔️ EventStore - The open-source, functional database with Complex Event Processing.
  • ✔️ MongoDB.Driver - .NET Driver for MongoDB.
  • ✔️ xUnit.net - A free, open source, community-focused unit testing tool for the .NET Framework.
  • ✔️ Respawn - Respawn is a small utility to help in resetting test databases to a clean state.
  • ✔️ Testcontainers - Testcontainers for .NET is a library to support tests with throwaway instances of Docker containers.
  • ✔️ PactNet - Contract testing library for verifying consumer-provider compatibility in .NET services.
  • ✔️ K6 - Modern load testing for developers and testers in the DevOps era.
  • ✔️ Aspire - .NET stack for building and orchestrating observable, distributed cloud-native applications.

Key Features

  1. Independent Services: Each service is a separate project with its own database and deployment pipeline, enabling independent development and deployment.
  2. Decentralized Communication: Services communicate via APIs (REST, gRPC) or message brokers (RabbitMQ, Kafka), ensuring loose coupling and resilience.
  3. Scalability: Services can be scaled independently based on demand, allowing efficient resource utilization.
  4. Fault Tolerance: Failures are isolated, preventing cascading failures and ensuring high availability.
  5. Technology Agnostic: Services can use different technologies, frameworks, or databases, providing flexibility.

When to Use

  1. Large and Complex Projects: Ideal for applications with complex business logic that can be broken into smaller, manageable services.
  2. High Scalability Needs: Suitable for applications requiring independent scaling of components.
  3. Fault Tolerance and High Availability: Perfect for systems where failure isolation and uptime are critical.
  4. Distributed Teams: Enables teams to work independently on different services.
  5. Frequent Updates: Supports continuous deployment and A/B testing for individual services.
  6. Technology Diversity: Allows the use of different technologies for different services.

Challenges

  • Increased complexity in management, DevOps overhead, data consistency, latency, and higher costs.

The Domain And Bounded Context - Service Boundary

  • Identity Service: The Identity Service is a bounded context for the authentication and authorization of users using Identity Server. This service is responsible for creating new users and their corresponding roles and permissions using .Net Core Identity and Jwt authentication and authorization.

  • Flight Service: The Flight Service is a bounded context CRUD service to handle flight related operations.

  • Passenger Service: The Passenger Service is a bounded context for managing passenger information, tracking activities and subscribing to get notification for out of stock products.

  • Booking Service: The Booking Service is a bounded context for managing all operation related to booking ticket.

Structure of Project

In this project, I used vertical slice architecture at the architectural level and feature folder structure to structure my files.

I treat each request as a distinct use case or slice, encapsulating and grouping all concerns from front-end to back. When adding or changing a feature in an application in n-tire architecture, we are typically touching many "layers" in an application. We are changing the user interface, adding fields to models, modifying validation, and so on. Instead of coupling across a layer, we couple vertically along a slice. We minimize coupling between slices, and maximize coupling in a slice.

With this approach, each of our vertical slices can decide for itself how to best fulfill the request. New features only add code, we're not changing shared code and worrying about side effects.

Instead of grouping related action methods in one controller, as found in traditional ASP.net controllers, I used the REPR pattern. Each action gets its own small endpoint, consisting of a route, the

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#aspireaspnetcoreclean-architecturecqrs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理