From Zero to Hero: Vertical Slice Architecture

Learn how to structure your codebases using the Vertical Slice Architecture

About This Course

The vertical slice architectural style is a relatively new way of architecting applications that has been gaining a lot of traction and popularity. In essence, it boils down to organizing your code in vertical slices instead of in the more traditional horizontal or concentric layers. It was envisioned with request-response style applications in mind, making it a great fit for web applications and APIs. In this course, you will learn what it is and how to implement it, from scratch. You'll learn how to enhance it with the mediator and chain of responsibility patterns, how the CQRS pattern fits in, how to add logging & metrics, how to deal with validation and domain events, how to secure it and more.

Course Curriculum

6h 4m 9 sections
Welcome
01:28 Free preview
What will you learn in this course?
03:26 Free preview
Who is the course for and prerequisites
01:27 Free preview
Section Introduction
00:43
Introducing Vertical Slice Architecture
12:35
A Few Truths About Software Architecture
05:02
Comparing Vertical Slice Architecture to Other Popular Styles
04:32
Introducing the Demo Scenario
00:49
A First Look at the Code, Project and Folder Structure
08:52
Should You Separate Your Code Across Different Projects?
05:11
Section Summary
00:51
Section Introduction
00:40
Deciding on a Feature Folder Structure
04:25
Implementing the SearchDestinations Slice
07:17
Design Improvements: Outer Model Mapping, Cancellation Support and Abstractions
07:48
Designing the Domain
04:13
Adding a Database
13:07
Implementing the GetItineraries Slice
09:04
Implementing the GetStops Slice
07:06
Improving Error Responses with the Problem Details RFC
01:32
Section Summary
01:53
Section Introduction
00:57
Introducing the REPR, Mediator & Chain of Responsibility Patterns
09:38
Mediator and Chain of Responsibility Pattern Implementations: MediatR
02:56
Adding MediatR to Our Project
02:05
Using MediatR in Our Slices
12:40
Design Improvement: Auto-registering Endpoints
08:53
Section Summary
01:59
Section Introduction
01:16
Leveraging MediatR Behaviours and Pipelines
01:44
Using an IRequestPreProcessor for Logging
03:39
Observability and Metrics
02:35
Using an IPipelineBehavior for Metrics
08:16
Handling Exceptions
05:18
Section Summary
01:17
Section Introduction
00:38
Vertical Slice Architecture and CQRS
02:29
Implementing the CreateStop Slice (a Command Slice)
11:23
Implementing Model Validation
10:27
Optimizing Query Slices for Reading Data
03:03
Looking Into the Different Levels of CQRS
08:29
Section Summary
01:05
Section Introduction
00:32
What Are Domain Events?
04:35
Supporting Domain Events
10:21
Approaches for Publishing Domain Events
04:54
Publishing Domain Events
02:22
Code Duplication Vs Abstraction
10:45
Reorganizing Code When Needed
03:20
Section Summary
01:46
Section Introduction
00:21
Authentication and Authorization for APIs
08:25
Requiring and Validating a Token
05:33
Generating a Token
06:15
The Case for a CurrentUserService, and Implementing It
05:16
Authorization Policies
05:28
Implementing a Feature-specific Authorization Policy
04:47
Implementing an Action-specific Authorization Policy
04:16
A Word of Caution on Using Tokens for Fine-grained Authorization
04:01
Section Summary
01:35
Section Introduction
00:19
Testability in Vertical Slice Architecture
06:01
Test Automation
06:50
Adding a Unit Test with xUnit
10:36
Improving Test Isolation with Moq
07:05
Getting Ready for Integration Testing
21:39
Writing an Integration Test
05:22
Pragmatism in Test Automation
03:16
Improving the Integration Test Infrastructure
05:42
Scalability in Vertical Slice Architecture
06:59
Section Summary
01:54

Meet Your Instructor

Kevin Dockx

Kevin Dockx

Kevin is a freelance solution architect, author & consultant, living in Antwerp (Belgium). He started working in the IT sector over 20 years ago, and is an 11-time Microsoft MVP. He's focused on architecture & security for web applications & integration components, using .NET and Azure. He's a keen proponent of open-source software. Also: wine.

View all courses by Kevin Dockx

What's New

Deep Dive: Solution Architecture
course

Deep Dive: Solution Architecture

Master solution architecture and turn business needs into scalable, maintainable systems.

Learn More
Migrating: ASP.NET Web APIs to ASP.NET Core
course

Migrating: ASP.NET Web APIs to ASP.NET Core

A step-by-step process to migrate ASP.NET Web APIs from .NET Framework to ASP.NET Core.

Learn More
Getting Started: Caching in .NET
course

Getting Started: Caching in .NET

Let's make the hardest thing in programming easy for .NET software engineers.

Learn More
From Zero to Hero: Testing with xUnit in C#
course

From Zero to Hero: Testing with xUnit in C#

Learn how to test any codebase in .NET with the latest version of xUnit, the industry-standard testing library.

Learn More
Create a ChatGPT Console AI Chatbot in C#
blog

Create a ChatGPT Console AI Chatbot in C#

This walkthrough is your hands-on entry point to create a basic C# console application that talks to ChatGPT using the OpenAI API.

Learn More