Solution Overview Guide
The Nano ASP.NET Boilerplate is an ASP.NET 7 Core application which follows the clean architecture pattern. The WebApi project hosts the React SPA and is configured with JWT authentication, the RazorApp project contains Razor pages and has uses Cookie authentication. Both projects provide RESTful http endpoints via API controllers.
This guide is a walkthrough of all the main components in the Web API solution.
The solution contains 5 projects (or only 4 in the standalone version):
- AspNano.WebApi (main application)
- AspNano.RazorApp (main application)
Separating the application into distinct layers is what’s known as Clean Architecture. Along with many other benefits, it keeps the application organized and modular. In basic Monolithic applications, the domain, controllers, and services all reside in one project, separated by folders and namespaces.
The WebApi project is the top-level project and the entry point of the application (program.cs). The AspNano.WebApi project serves the static files related to the React Application and also contains the RESTful API controllers. These controllers consume services from the Application and Infrastructure projects. This project is configured to use JWT tokens as its authentication scheme. If you don’t want to use Razor pages, you can simply remove the AspNano.RazorApp project from your solution.
The RazorApp project is another top-level project with an entry point to application (program.cs). The AspNano.RazorApp contains Razor page views and also contains RESTful API controllers. The controllers and views consume services from the Application and Infrastructure projects. The configuration is slightly different than the WebApi project, with the main difference being the Identity configuration. In the RazorApp project, Cookies are used instead of JWT tokens for authentication. If you plan to build with Razor pages, you can remove the AspNano.WebApi project from your solution, as well as the Auth folder from the Infrastructure project. Authentication is handled within the RazorApp project.
The infrastructure project contains generic functionality services such as identity, multitenancy, mailing, image upload, mapper, utility classes, and persistence.
The application project contains application specific services (business logic). The Venue Service is a sample which can serve as a guide for creating new application services.
The domain is the lowest-level project which contains the entity classes.