Blog

Vertical Slice Architecture in .NET: a microservices example

CleanArchitecture
DDD
EDA
C#
VSA
Backend

How I'm adapting a Vertical Slice Architecture template with DDD, events and .NET Aspire for a hotel reservation system on Azure.

Vertical Slice Architecture in .NET: a microservices example

I’m modifying a Vertical Slice Architecture template to make microservices easier to maintain and scale. The goal is a reservation management system on Azure where services talk to each other asynchronously through events (Event-Driven Architecture).

This architecture is the base I’ll build the rest of the system on, so I wanted to get it right from the start.

What I’ve added to the template

So far I’ve combined five pieces.

1. Domain-Driven Design (DDD)

I reorganized the application so each domain has clear boundaries and modules don’t depend on each other without a reason. The design is easier to read, and I can change one module without dragging the others along.

2. Screaming Architecture

The folder structure and namespaces now reflect the business domain instead of technical details. The first thing the code tells you is what the business does.

3. .NET Aspire

I use Aspire to orchestrate the services. It makes dependency management and configuration simpler, and running all the microservices locally is much easier.

4. Event-Driven Architecture (EDA)

Services communicate through events. That keeps them decoupled, helps them scale, and makes distributed transactions easier to handle.

5. Migration Service

I added a service whose only job is evolving the database schema, so migrations are applied automatically and in a controlled way.

What I’ve gained so far

The services are more modular and it’s clearer what each one does, which should pay off in long-term maintenance. And thanks to Aspire, integrating and deploying the services takes a lot less effort, both locally and in the cloud.

What’s next

I’ll keep writing about how the system evolves and the problems I run into along the way. If you use other strategies to keep your microservices in shape, I’d like to hear about them.

The code is on my GitHub: GitHub repository


Comments

No comments yet. Be the first!

Leave a Comment

Your name and comment will be published once approved. More in the privacy policy.