
Build AI powered distributed architectures with dotnet aspire to create catalog and basket microservices, integrate PostgreSQL, Redis, RabbitMQ, Keycloak, and Semantic Kernel, and deploy to Azure Container Apps.
Review prerequisites and set up dotnet nine with Visual Studio 2022, ASP.Net web development, and the dotnet aspire workload. Install Docker Desktop; access GitHub source and lecture resources slides.
Set up and run the eShop microservices project, activating Postgres, Redis output caching, a distributed cache, RabbitMQ, and Keycloak, with catalog and basket services and a Blazor client.
Discover cloud native distributed architectures through microservices, containers, and Kubernetes-style orchestration, enabling scalable banking services, LMS integrations, and vector databases with CI/CD, monitoring, and observability.
Explore backing services for cloud-native architectures, including databases, caching, messaging, and authentication, shown as external, swappable resources like PostgreSQL, Redis, RabbitMQ, and Keycloak.
Explore using llms and vector databases as cloud-native banking services in a microservices architecture. Learn about ulama local inference, embeddings, cosine similarity, and augmented generation with semantic kernel integration.
Discover dotnet aspire, a cloud native framework on the .NET platform that accelerates distributed microservice development with templates, scaffolding, and seamless integration with Docker, Kubernetes, and cloud services.
Explore dotnet aspire core concepts—orchestration, integrations, and service discovery—to automate containerized microservices, coordinate dependencies, and enable scalable, cloud-native distributed architectures.
Define the app model and app host orchestrator in dotnet aspire to automate provisioning, deploying, configuring, and connecting microservices, databases, caches, and external services.
Discover how dotnet aspire integrations enable hosting and client layers to provision, reference, and connect resources—via NuGet packages and environment variables—while adding telemetry, observability, health checks, and resilience.
Discover dotnet aspire service discovery and environment variable injection that lets microservices locate each other without hard-coded addresses. See how front-end projects obtain cache, catalog, and basket endpoints via references.
Launch your first dotnet aspire app by scaffolding a starter template in Visual Studio, building a Blazor frontend, a web API, and Redis caching for a basic distributed architecture.
Run the dotnet aspire solution to observe how the front end interacts with the API and Redis cache, then explore the dotnet aspire dashboard with resources, traces, and metrics.
Understand Aspire project organization for the starter application, including Aspire Sample host, service defaults, API service, and web project, and how they form a distributed app with logging and tracing.
Examine the dotnet aspire host project as the orchestrator for distributed cloud native apps. It wires microservices, api and web projects with a Redis cache, service discovery, and environment variables.
Examine dotnet aspire service defaults to enforce consistent configuration across distributed microservices, covering resilience, service discovery, OpenTelemetry, logging, and tracing, with centralized health checks and automatic runtime integration.
Discover how dotnet aspire enables inter-service communication in cloud native architectures via service discovery and endpoint injection, with a Blazor frontend calling api services through a typed http client.
Add dotnet aspire to an existing dotnet application, replacing docker compose with aspire orchestrator for integrated container orchestration, service discovery, and cross-cutting configurations across api and frontend microservices.
Orchestrate a distributed eShop architecture with dotnet aspire, building catalog and basket microservices backed by PostgreSQL, Redis, and RabbitMQ, secured by Keycloak and git bearer tokens, with AI integration.
Create a new blank solution in Visual Studio and organize three folders—aspire, services, and frontend—for a distributed application with microservices such as Catalog and Basket and a consuming frontend.
Create dotnet aspire s5 projects to orchestrate a distributed app with an aspire host and service defaults, centralizing logging, tracing, and health checks while wiring Redis and PostgreSQL.
Develop a step-by-step distributed e shop with catalog and basket microservices, synchronous service discovery, rabbitmq messaging, keycloak security, and a blazor frontend deployed on azure container apps.
Develop catalog microservices with PostgreSQL in dotnet aspire, covering domain models, use cases, Rest API, and Entity Framework core DbContext for distributed architecture.
Analyze catalog microservices domain model centered on product, with id, name, description, price, and image URL, and implement CRUD use cases, price change events, REST APIs, and PostgreSQL with EF Core.
Analyze catalog microservices in a four-layer architecture (domain, data access, business logic, presentation) using simple patterns, dependency injection, minimal APIs, and EF Core with PostgreSQL via Aspire.
Create a catalog microservice web API and integrate it into dotnet aspire orchestration. Configure project defaults, service discovery, health checks, and standard endpoints for a consistent distributed architecture.
Develop product domain entity models in catalog microservices. Define the product entity with id, name, description, price, and image URL in the domain layer and activate the PostgreSQL backing service.
Explore hosting and client integrations in .NET Aspire, provisioning PostgreSQL databases, caches, and queues. Configure client projects for dependency injection, telemetry, health checks, and environment variables to resources via DbContext.
Orchestrate PostgreSQL as a backing service for the catalog microservices using dotnet aspire, enabling infrastructure as code and containerized databases in the app host.
Install Aspire PostgreSQL Entity Framework Core packages in the catalog microservice, register the DbContext, and automatically fetch the connection strings from environment variables for the catalog DB.
Develop EF Core product DbContext in catalog microservices data layer, expose a product DbSet for CRUD, and register it in Program.cs with a PostgreSQL connection string from environment variables.
Learn to generate Entity Framework Core migrations for ProductDbContext using a code-first approach, install EF Core tools, and apply migrations to create a PostgreSQL database.
Automate database migrations at app startup with a use migration extension method for EF Core, seeding initial products in PostgreSQL via a data seeder in catalog microservices.
Test auto migration for catalog microservices and verify startup, seeding, and EF Core migrations in a PostgreSQL container. Confirm persistence by validating data volume and restart behavior.
Develop catalog application use case development by implementing the product service with EF Core DbContext to perform create, read, update, and delete operations, using dependency injection in the catalog microservices.
Develop update product async and delete product async using the product DbContext, updating attributes from an input product model and removing the deleted product, with find async calls and SaveChangesAsync.
Develop queries using the product db context with get products async and get by id async, plus create, update, and delete operations in the product service class using EF Core.
Register the product service with the ASP.NET Core dependency injection container in catalog program.cs, using add scope with the product Dbcontext, to enable per-request instances and inject into endpoints.
Create catalog api endpoints using asp.net minimal APIs by building a static product endpoints extension that maps get, post, put, and delete routes and wires into program.cs.
Register product endpoints by calling the map product endpoints extension in Program.cs to expose catalog microservices http endpoints and configure the http request pipeline.
To skip timeout exceptions when debugging,
goto ServiceDefaults/Extensions.cs
Turn off AddStandardResilienceHandler and configure for 2 minutes:
builder.Services.ConfigureHttpClientDefaults(http =>
{
// Turn on resilience by default
// http.AddStandardResilienceHandler();
http.AddStandardResilienceHandler(config =>
{
TimeSpan timeSpan = TimeSpan.FromMinutes(2);
config.AttemptTimeout.Timeout = timeSpan;
config.CircuitBreaker.SamplingDuration = timeSpan * 2;
config.TotalRequestTimeout.Timeout = timeSpan * 3;
config.Retry.MaxRetryAttempts = 1;
});
Develop basket microservices with Redis in dotnet aspire, covering domain and technical analyses, entity models, hosting integration, and minimal API endpoints for get, create, and delete basket.
Analyze domain models for basket microservices, including shopping cart and cart item with price. Design rest endpoints for get, upsert, and delete baskets and implement a Redis distributed cache.
Create a basket microservices web api and enlist it in dotnet aspire orchestration; scaffold the basket project, configure defaults, and verify integration via the aspire dashboard.
Develop the basket domain models by creating shopping cart and shopping cart item entities, using username as the distributed cache key and calculating the total price from items.
Learn to integrate a Redis-backed distributed cache in a dotnet aspire environment by adding the Aspire hosting Redis package, configuring backing services, and wiring the cache into basket microservice.
connects the basket microservices to a redis cache by installing the Aspire Stackexchange Redis distributed caching package and registering the redis client in program.cs using environment variables.
Develop a basket service using IDistributedCache in the business layer to handle get, update, and delete basket operations with AI distributed cache, serialize basket data, and register for dependency injection.
Develop basket api endpoints with ASP.NET core minimal APIs by mapping get, post, and delete routes in a presentation layer, using Redis cache to upsert and fetch a shopping cart.
Register basket endpoints into program.cs and map HTTP routes for the shopping cart, ensuring the basket microservice is wired into the ASP.NET Core HTTP pipeline.
Test basket microservice endpoints using the Radius distributed cache with http get, post, and delete operations, and verify results via the cache explorer.
Leverage dotnet aspire service discovery to enable synchronous communication between basket and catalogue microservices, fetch product data such as prices via http, avoiding hardcoded urls and enabling name-based calls.
Implement synchronous communication to update a shopping basket by calling catalog microservices, fetching latest product prices and names, and refreshing basket items for accuracy.
Add with reference catalog into the basket microservice to enable service discovery with dotnet aspire, injecting the catalog endpoint via environment variables.
Develop a catalog api client for synchronous http communication in the basket microservice, using http client get from json async to fetch product by id and register in program.cs.
Register the catalog API client in the basket microservice using the HTTP client extension method, configure dependency injection, and expose catalog endpoints to the basket business layer.
Inject catalog api client into the basket service; in update basket, call get product by id for each item to refresh price and name, then save basket to redis.
To skip timeout exceptions when debugging,
goto ServiceDefaults/Extensions.cs
Turn off AddStandardResilienceHandler and configure for 2 minutes:
builder.Services.ConfigureHttpClientDefaults(http =>
{
// Turn on resilience by default
// http.AddStandardResilienceHandler();
http.AddStandardResilienceHandler(config =>
{
TimeSpan timeSpan = TimeSpan.FromMinutes(2);
config.AttemptTimeout.Timeout = timeSpan;
config.CircuitBreaker.SamplingDuration = timeSpan * 2;
config.TotalRequestTimeout.Timeout = timeSpan * 3;
config.Retry.MaxRetryAttempts = 1;
});
Develop asynchronous communication between catalog and basket microservices using RabbitMQ and MassTransit under dotnet aspire, publishing product price change events to update carts in real time.
Analyze asynchronous communication between catalog and basket microservices using product price change events and integration events via rabbitmq and mass transit. Shows http post endpoint /products and amqp-based price updates.
Install the dotnet aspire hosting rabbitmq package to spin up a RabbitMQ container as a backing service, inject environment variables into catalog and basket microservices, and enable asynchronous communication.
Develop shared messaging folders and classes for the product price change integration event using a shared messaging class library and service defaults, enabling cross-cutting concerns across microservices.
Develop mass transit extension methods to register the RabbitMQ connection for catalog and basket microservices, enabling asynchronous communication via dotnet aspire environment variables and endpoint auto-configuration.
Register mass transit packages into catalog and basket DI in program.cs to enable asynchronous communication with RabbitMQ, publishing product price change events and subscribing as needed.
Enable dotnet Aspire trace for MassTransit operations by centralizing OpenTelemetry configuration in the service default, and add MassTransit as a tracing source for publish, consume, send, and receive.
Develop asynchronous catalog updates by publishing the product price change integration event to RabbitMQ via MassTransit, enabling basket services to react to price updates.
Basket microservices subscribe to the product price change integration event and update basket items with the new price using MassTransit and a Redis distributed cache.
To skip timeout exceptions when debugging,
goto ServiceDefaults/Extensions.cs
Turn off AddStandardResilienceHandler and configure for 2 minutes:
builder.Services.ConfigureHttpClientDefaults(http =>
{
// Turn on resilience by default
// http.AddStandardResilienceHandler();
http.AddStandardResilienceHandler(config =>
{
TimeSpan timeSpan = TimeSpan.FromMinutes(2);
config.AttemptTimeout.Timeout = timeSpan;
config.CircuitBreaker.SamplingDuration = timeSpan * 2;
config.TotalRequestTimeout.Timeout = timeSpan * 3;
config.Retry.MaxRetryAttempts = 1;
});
Learn to host Keycloak in dotnet aspire, spin up a Keycloak container, and wire it as the authentication and authorization provider for basket microservices, with environment variables and service discovery.
Configure Keycloak as an OpenID Connect provider for the eShop apps. Create a realm, client, and test user, then obtain and verify a token for basket microservice access.
Secure basket microservice endpoints by integrating Keycloak authentication and authorization. Install Keycloak NuGet packages and configure authentication, authorization, and require authorization on each endpoint.
Test secured basket endpoints with Keycloak JWT tokens by obtaining an access token and using bearer authorization. Verify 401 without a token and 200/201/204 with a valid token.
In this course, we are designing and implementing cloud-native distributed architectures using the .NET Aspire framework, while integrating Generative AI capabilities (GenAI) through Microsoft-Extensions-AI and Semantic Kernel.
From microservices fundamentals to Advanced AI-driven features, you’ll gain hands-on experience architecting an E-Shop system where Catalog and Basket microservices work in tandem using PostgreSQL, Redis and RabbitMQ for messaging.
You’ll also discover how to incorporate intelligent features such as Q&A chatbots and semantic product search, powered by Ollama’s Llama/Phi models and RAG (Retrieval-Augmented Generation) flows.
Throughout the course, you’ll learn:
Cloud-Native Distributed Architecture Essentials
Dive into microservices architecture, containerization, and the Twelve-Factor App methodology.
Learn best practices for resiliency, scalability, and DevOps workflows.
.NET Aspire Framework for Cloud-Native Development
Understand how .NET Aspire simplifies building distributed services.
Set up new projects, manage configurations, and apply cross-cutting concerns like logging and observability.
Catalog Microservice with PostgreSQL and RabbitMQ:
Store and manage product data in PostgreSQL.
Publish integration events (e.g., ProductPriceChanged) to RabbitMQ.
Basket Microservice with Redis:
Maintain fast, session-based data using Redis.
Syncs with the Catalog service when adding items to the basket.
Consume integration events from RabbitMQ to keep basket prices in sync.
Secure basket endpoints with Keycloak using JWT Bearer token.
Messaging and Event-Driven Patterns with RabbitMQ
Explore publish/subscribe patterns, exchanges, routing keys, and best practices for handling retries.
Implement robust error handling and ensure reliable event-driven communication across microservices.
Deployment, Security, and Observability
Containerize microservices and deploy them to Azure Container Apps using the azd up and azd down commands.
Follow .NET Aspire’s project structure for streamlined CI/CD workflows.
Introduction to .NET GenAI with Semantic Kernel
Discover the foundations of Generative AI and large language models (LLMs).
Integrate Microsoft-Extensions-AI and Semantic Kernel to power advanced AI functionalities.
Ollama, Llama, and Phi Models Setup
Install and configure Ollama locally or via containers.
Run Llama or Phi models for inference directly within your .NET microservices.
GenAI Use Cases in E-Shop
Customer Support Q&A Chatbot:
Leverage semantic kernel and prompt engineering for context-aware Q&A.
Integrate Ollama to deliver real-time responses to users’ questions.
Product Semantic Search with Vector Store (RAG Flow):
Generate embeddings for product data using Ollama’s All-MiniLM model.
Use a vector database to retrieve, rank, and deliver personalized product recommendations.
By the end of this course, you’ll have built a fully functional, AI-powered E-Shop platform that demonstrates the power of event-driven microservices coupled with .NET Aspire and GenAI