Skip to content

The practical implementation of .NET Aspire using Microservices

License

Notifications You must be signed in to change notification settings

foxminchan/BookWorm

Repository files navigation

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

  • Building a cloud-native application with .NET Aspire
  • Using Vertical Slice Architecture to organize the codebase
  • Using Domain-Driven Design to design the domain model
  • Implement the CQRS pattern with MediatR
  • Using RabbitMQ on top MassTransit for messaging
  • Using gRPC for inter-service communication
  • API versioning
  • Health checks
  • OpenAPI/Swagger
  • AuthN/AuthZ with Duende IdentityServer
  • Observability with .NET Aspire
  • Add MailDev for local email testing
  • CI/CD with GitHub Actions
  • Testing
    • Service unit tests
    • Integration tests with TestContainers
  • 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.