booking-microservices README

The project's README from github.com/evangelosvlachos96-dotcom/booking-microservices. As one markdown file: README.md.

booking-microservices

ci-status

Booking Microservices

A practical flight-booking system built as microservices with .NET 10, using Vertical Slice Architecture, DDD, CQRS, Event Sourcing, gRPC, RabbitMQ, Wolverine, PostgreSQL, MongoDB and .NET Aspire.

Developed by Evangelos Vlachos.

Table of Contents

Overview

This repository demonstrates how to design and run a production-style microservices system end to end: independent services with their own databases, asynchronous messaging with durable inbox/outbox, synchronous gRPC calls between services, an API gateway, centralized identity, observability and container/Kubernetes deployment.

Key goals:

Architecture

architecture diagram

Each service owns its data and exposes a small REST surface through minimal APIs. Commands mutate the write store (PostgreSQL or EventStoreDB) and publish integration events through Wolverine's durable outbox to RabbitMQ. Consumers process those events through the durable inbox and project them into MongoDB read models. Queries read from MongoDB only. Cross-service reads that must be synchronous (for example Booking validating a flight or passenger) go over gRPC.

vertical slice architecture

Services

Service Responsibility Write store Read store
Identity Users, roles, tokens (IdentityServer) PostgreSQL -
Flight Flights, airports, aircraft, seats PostgreSQL MongoDB
Passenger Passenger profiles PostgreSQL MongoDB
Booking Booking a seat on a flight for a passenger EventStoreDB MongoDB
ApiGateway Single public entry point (YARP) - -
Aspire AppHost Local orchestration and dashboard - -

Technology Stack

Project Structure

.
├── src
│   ├── ApiGateway/            # YARP gateway
│   ├── Aspire/                # Aspire AppHost and service defaults
│   ├── BuildingBlocks/        # Shared cross-cutting code (Core, EFCore, Mongo, Wolverine, Jwt, Logging, OpenTelemetry, Polly, TestBase, ...)
│   └── Services
│       ├── Booking/           # src/Booking, src/Booking.Api, tests/
│       ├── Flight/
│       ├── Identity/
│       └── Passenger/
├── deployments
│   ├── configs/               # otel-collector, prometheus, grafana configs
│   ├── docker-compose/        # infrastructure and full-stack compose files
│   └── kubernetes/            # manifests + cert-manager
├── assets/                    # diagrams and logo
├── booking.rest               # REST Client requests for manual API testing
└── booking-microservices.sln

Inside every service, code is grouped by feature (for example Flights/Features/CreatingFlight/V1/) rather than by technical layer. Each feature folder holds its endpoint, command/query, handler, validator and any events it raises, so a change to one use case touches only that folder.

Getting Started

Prerequisites

Dev Certificate

Create and trust a development HTTPS certificate so the containers can serve TLS.

Windows (PowerShell):

dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p password
dotnet dev-certs https --trust

macOS / Linux:

dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p password
dotnet dev-certs https --trust

Run with Aspire

The fastest way to get everything up locally, with a dashboard for logs, traces and metrics:

aspire run

The Aspire dashboard is available at http://localhost:18888.

Run with Docker Compose

Infrastructure only (RabbitMQ, PostgreSQL, EventStoreDB, MongoDB, Redis, Jaeger, Zipkin, OTel Collector, Prometheus, Grafana):

docker-compose -f ./deployments/docker-compose/docker-compose.infrastructure.yaml up -d

Full stack including the services:

docker-compose -f ./deployments/docker-compose/docker-compose.yaml up -d

Run with Kubernetes

Install cert-manager first, then apply the TLS issuer and the application manifests:

kubectl apply -f ./deployments/kubernetes/booking-cert-manager.yml
kubectl apply -f ./deployments/kubernetes/booking-microservices.yml

The manifests reference images under the evangelosvlachos96/ Docker Hub namespace. Build and push the service images there (or change the image names) before deploying.

Build, Run and Test manually

Build the whole solution from the repository root:

dotnet build

Run a single service from its *.Api project folder (for example src/Services/Flight/src/Flight.Api):

dotnet run

Run all tests (integration and end-to-end tests start their dependencies with Testcontainers, so Docker must be running):

dotnet test

API Documentation

Every service exposes OpenAPI documentation at /swagger (Swagger UI) and /scalar/v1 (Scalar).

For quick manual testing, open booking.rest with the VS Code REST Client extension. Seeded users are van1 / Admin@123456 (admin) and van2 / User@123456 (user).

Development Tooling

.NET tools (CSharpier formatter, dotnet-outdated) are declared in .config/dotnet-tools.json:

dotnet tool restore

Husky + commitlint enforce Conventional Commits and run the formatter before each commit:

npm install

Upgrade NuGet packages across the solution:

dotnet outdated -u

booking-microservices (evangelosvlachos96-dotcom/booking-microservices)

Searching Database…

Что это?Практичная система бронирования авиабилетов, построенная как микросервисы на .NET 10, с использованием Vertical Slice Architecture, DDD, CQRS, Event Sourcing, gRPC, RabbitMQ, Wolverine, PostgreSQL, MongoDB и .NET Aspire.
Это переиспользуемый фреймворк или полноценный пример приложения?Это полная запускаемая система-пример с пятью независимыми сервисами (Identity, Flight, Passenger, Booking, ApiGateway), у каждого своя база данных; её задумано запускать целиком и изучать, а не импортировать как библиотеку.
Как запустить весь стек?Самый быстрый путь — .NET Aspire, который запускает каждый сервис плюс дашборд с логами, трассировками и метриками; альтернативно используйте Docker Compose (только инфраструктура или весь стек) или примените манифесты Kubernetes после установки cert-manager.
Что должно быть установлено перед запуском?Нужны .NET 10 SDK и Docker Desktop; Node.js требуется для commit-хуков Husky, а .NET Aspire CLI/kubectl — опциональные дополнения для соответствующих сценариев.
Можно ли развернуть манифесты Kubernetes как есть?Не из коробки — манифесты указывают на Docker-образы в собственном пространстве имён автора 'evangelosvlachos96/' на Docker Hub, поэтому нужно собрать и отправить свои образы (или переименовать их), прежде чем деплой реально заработает.
Настройка dev-сертификата HTTPS различается по ОС?Да, README даёт отдельные инструкции о доверии dev-сертификату на Windows (PowerShell) и на macOS/Linux, прежде чем контейнеры смогут отдавать TLS.
Почему только сервис Booking использует Event Sourcing вместо обычной базы данных?Booking — записывающая сторона, которой больше всех выгодна полная история изменений состояния, поэтому она использует EventStoreDB, тогда как Flight и Passenger используют обычные таблицы PostgreSQL; все три проецируют свои данные в MongoDB для быстрого чтения.
Как чтение и запись остаются синхронными между сервисами?Команды пишут в PostgreSQL или EventStoreDB и публикуют события через персистентный outbox Wolverine в RabbitMQ; потребители обрабатывают их через персистентный inbox и проецируют результаты в MongoDB, из которой запросы и читают — это единственное хранилище для чтений.
Как войти и попробовать API, не создавая аккаунт?В системе предустановлены два пользователя: van1/Admin@123456 (админ) и van2/User@123456 (пользователь), и каждый сервис открывает документацию OpenAPI на /swagger и /scalar/v1.
Какие виды автоматических тестов есть в проекте?Есть модульные, интеграционные, сквозные и контрактные тесты на xUnit, NSubstitute, Testcontainers и PactNet; интеграционные и e2e-тесты поднимают свои зависимости через Testcontainers, поэтому Docker должен быть запущен.
Size
0.9 MB
Stars
756
Updated
CommitSep 13
Age
1mo
Commits · 90 Days