Building AI-Powered Applications (Part 2 - Pivot to .NET Aspire)
Version: 1.00 Data: 20/02/24
Introduction
We continue our series on "Building AI-Powered Applications," this post I am excited to share with you that .NET Aspire is now ready for me to pivot to using it in our application, and this also means I am moving from .NET 7 to .NET 8. Some may wonder why the change?
When I started writing this series, .NET Aspire was new, and I wanted to work with something more solid, so I decided to give .NET Aspire some time to mature and get the bugs sorted. I did not wish to work with something not 100% ready, as this would be my blog web application serving people. Recently, I have been using .NET Aspire and am now confident to pivot this project to utilize Aspire. With the pivot comes so many new features and options, with the big one, we will build towards a Microservices architecture. Also, use Microsoft Azure Apps for Containers for hosting, a serverless platform to house our application services. The significant benefits of Microsoft Azure. Apps for Containers is the low touch; it's not like dealing with Kubernetes, where one has to get into the platform a little more. With Microsoft Azure. Apps for Containers: I can focus on the application, leave the platform to Microsoft Azure, and still get most of the benefits of containers and microservices.
What is .NET Aspire?
Microsoft .NET Aspire is an opinionated, cloud-ready stack designed for building observable, production-ready, distributed applications12. It's delivered through a collection of NuGet packages that handle specific cloud-native concerns1. These components are designed to simplify connections to popular services and platforms, such as Redis or PostgreSQL.
.NET Aspire streamlines the configuration and interconnection of different parts of your cloud-native app. It provides valuable abstractions for managing service discovery, environment variables, and container configurations without handling low-level implementation detail.
It also includes local orchestration capabilities to simplify the developer's inner loop and reusable opinionated components for integrating with commonly used application dependencies3. With .NET Aspire, developers can focus more on their business logic and less on the complexity of the cloud.
You can get a complete introduction to .NET Aspire here.
Architecture Changes
The main architecture changes have been to the use of .NET Aspire, enabling the ability to now host on Azure Container App Service. The other major architectural change is adding a YouTube service from Google that lets me get a list of videos from my YouTube channel and display them in the bar on the right-hand side of the blog home page. I also added Redis as a caching layer to improve speed and cash frequently used data; I will have a post on this later in the series. Here is the new architecture diagram: