BookWorm icon indicating copy to clipboard operation
BookWorm copied to clipboard

The practical implementation of .NET Aspire using Microservices

trafficstars

BookStore: The practical .NET Aspire

Introduction

⭐ This is a pet project to demonstrate the practical use of .NET Aspire. The project is a cloud-native application with applying Domain-Driven Design (DDD) and Vertical Slice Methodology to organize the codebase.

The Goals of the Project

  • [x] Building a cloud-native application with .NET Aspire
  • [x] Using Vertical Slice Architecture to organize the codebase
  • [x] Using Domain-Driven Design to design the domain model
  • [x] Implement the CQRS pattern with MediatR
  • [x] Using RabbitMQ on top MassTransit for messaging
  • [x] Using gRPC for inter-service communication
  • [x] API versioning
  • [x] Health checks
  • [x] OpenAPI/Swagger
  • [x] AuthN/AuthZ with Duende IdentityServer
  • [x] Observability with .NET Aspire
  • [x] Add MailDev for local email testing
  • [x] CI/CD with GitHub Actions
  • [x] Testing
    • [x] Service unit tests
    • [ ] Integration tests with Aspire Testing & WireMock
  • [ ] Output Caching, Response Caching and Distributed Caching with Redis
  • [ ] Deployment with Aspirate on k3d
  • [ ] EDA document with EventCatalog

Domain Business & Bounded Contexts - Services Boundaries

  • Catalog: Display books with pagination and search functionality.
  • Basket: Add books to the shopping cart and place an order.
  • Ordering: Display orders with pagination and search functionality.
  • Identity: Register, login, and manage user profile.
  • Notification: Send email notifications.
  • Rating: Rate books.

Domain Business & Bounded Contexts

How to run the project

Prerequisites

Setting up user secrets

  1. Open a terminal
  2. Run the following command to set the user secrets for the BookWorm.AppHost project
dotnet user-secrets set "Parameters:SqlUser" "postgres"
dotnet user-secrets set "Parameters:SqlPassword" "yourcomplexpassword"
dotnet user-secrets set "Parameters:FromEmail" "yourfromemail"
dotnet user-secrets set "ConnectionStrings:openai" "Key=yourapikey"

[!NOTE] You need and OpenAI API key to run the project. You can get one here.

Running the project

  1. Clone the repository
git clone [email protected]:foxminchan/BookWorm.git
  1. Run the project
dotnet run --project src/BookWorm.AppHost/BookWorm.AppHost.csproj

[!WARNING] Ensure that you have Docker running on your machine.

Contributing

  • Fork the repository
  • Create a new branch for your feature
  • Make your changes
  • Create a pull request

[!CAUTION] Do not change namespaces for Integration Events as it will break the messaging system.

Project References

License

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