Backend
The backend is the part of an application that runs on the server: it processes requests, applies business rules, stores data, and checks permissions. In .NET applications it is usually ASP.NET Core with a database behind it.
The backend is the part of an application that users do not see: it runs on the server, accepts requests, applies business rules, reads and writes data, and checks who may do what. Its counterpart is the frontend.
What happens in the backend
For .NET developers, the backend is usually an ASP.NET Core application. Microsoft describes ASP.NET Core as a cross-platform, open-source framework with a modular request pipeline, the Kestrel web server, built-in dependency injection, configuration per environment, and logging and metrics. Typical tasks:
- Accepting and answering requests, for example through a web API
- Validating input and running business rules
- Storing data in a database, in .NET often with Entity Framework Core
- Enforcing sign-in and permissions, for example with Microsoft Entra ID
- Doing background work, such as sending emails or querying other systems' interfaces
In Azure, a backend often runs in a container, for example in Azure Container Apps, or on Azure App Service. Both are managed services in which the provider maintains the operating system and the platform (see cloud computing).
An example from the Kladde
In the Kladde, the business rules, such as calculating the free appointment slots for the public booking page, are a pure function in a project of their own, Kladde.Core. The web project Kladde.Web accepts requests, calls these rules, stores data in SQL Server, and starts background work: outgoing emails go through an outbox table, and a background service works through it. So the backend consists of several layers, not just endpoints.
Common misconceptions
- The backend is not the same as the database. The database is one part; the backend is the application in front of it.
- Backend and frontend cannot always be separated. With Blazor and server-side rendering, the user interface is created on the server, and both parts are written in C#. Whoever builds both does full-stack development.
- A backend without tests is a risk. Business rules written as pure functions are easy to secure with unit tests.
In the course
The backend takes shape in K2, module 2.3, with The first web API and Dependency injection. Data storage follows in module 2.4 with EF Core: DbContext and mapping, background services in module 2.8 with The outbox pattern.
Further reading on the blog
Sources
- Microsoft Learn, Overview of ASP.NET Core: https://learn.microsoft.com/aspnet/core/overview?view=aspnetcore-10.0
- Microsoft Learn, Shared responsibility in the cloud: https://learn.microsoft.com/azure/security/fundamentals/shared-responsibility