Try the Live Demo

Some quick notes about the demo:

  • The demo data will reset every hour
  • The demo application is running in a low service tier and may take a few seconds to spin up.
  • In a real deployment, subdomains can be used to resolve tenants. In the demo, tenants are switched at login with the tenant selection.
  • To see data isolation in action, try logging in as different tenant users.
  • Only the root tenant can access the tenant management area.
  • Only admin level users can access the user administration area.
  • Every tenant has a default admin:
  • The password for all users: Password123!

Thank you for your interest. You can also send a message to learn more about the boilerplate.

asp nano

Please allow 10-15 seconds for the app to boot from a cold start. Try the live demo with the links below:

Getting Started

.Net Web Api Setup Guide

Open the Solution

In the zip download there are two folders, api and client. Extract those to a location on your computer. Inside the api folder, open the AspNano solution file (.sln). Since the react project and the .NET solution share nothing in common, its recommended to manage them separately with their own source control. The full version of the .NET solution contains the razor pages project in addition to what you see here.

Specify the Connection String

Once you open the solution, expand the AspNano.WebApi (and AspNano.RazorApp) project and open appsettings.json. Under ConnectionStrings where it says “DefaultConnection” edit the string as needed to point to your local SQL Server instance. You can give the database a new name or leave it as AspNanoDb.

In AppSettings make sure the “DatabaseName” is the same as the name given for the database in the connection string. This setting is what enables the application to properly rename newly created tenant databases if opting for multiple databases.

  "AppSettings": {
    "DatabaseName": "AspNanoDb"
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=(localdb)\\mssqllocaldb;Database=AspNanoDb;Trusted_Connection=True;MultipleActiveResultSets=true"

Run the Initial Migrations (Optional)

If you look in the AspNano.Infrastructure class library, you will find all the persistence related classes within the Persistence folder. In the Migrations folder, there are two subfolders, BaseDB and AppDB and each contain an initial migration. These migrations will run automatically when you run the app.

Optionally, you can explicitly run migrations with the update-database command in Package Manager Console.

In Package Manager Console, where it says Default project, change it to AspNano.Infrastructure. This will tell PMC where to look for database context classes. If you are using VS code, you can do this via command line.

Next, in the command line, run the following commands:

update-database -Context BaseDbContext

update-database -Context ApplicationDbContext

Because there are multiple contexts BaseDbContext , ApplicationDbContext and TenantDbContext, we need to provide a switch to the update-database command. The -Context switch tells Entity Framework which context to use for migrations. The BaseDbContext and ApplicationDbContext are the ‘main’ contexts covering all the entities within the application. The TenantDbContext is not used for migrations, it’s a read-only context for looking up tenants with incoming requests.

The BaseDbContext is used for identity and tenants, plus any other app configuration tables you may want to add in the future. The ApplicationDbContext is used for all other application tables. The reason for the separation is for cases where you use multiple tenant databases. The tenant databases won’t contain tenant, identity, or configuration tables — just tables that deal with application data.

If you plan on only using a single database, the BaseDbContext and ApplicationDbContext can be merged into one context.

When the application is run, Entity Framework will create a database and seed it with a root tenant and root user with the following credentials:

Password: Password123!

Run the Application

Now that the database has been setup you can run the application. The application will be running at the following location:


When you navigate to the localhost:7250 address, you will notice the client is already running. The client instance you see here is actually being served from the static files found within the wwwroot folder of the AspNano.WebApi project. This is the ‘build’ version of the React client. When you set up the client project in the next guide, we will run the ‘development’ version on a different port and that is the one you will work on.

To run the Razor pages project, select AspNano.RazorApp as the default startup project. The application will be running at the following location:


To learn about the .NET Api project, start with the Solution Overview documentation