Nano ASP.NET SaaS Boilerplate
Admin credentials (all tenants): admin@email.com / Password123!
Sample data resets every hour
Nano ASP.NET SaaS Boilerplate
General
.NET Solution
Vue UI
React UI
Razor Pages
.NET Solution

Using the .NET CLI Tool

The .NET CLI (Command-Line Interface) provides a way to create, build, and manage .NET applications directly from a terminal. With project templates and code scaffolding, developers can automate repetitive setup tasks and generate consistent application structures without manually creating every file.

Nano ASP.NET Boilerplate extends this workflow with custom .NET templates for generating complete application solutions, CRUD services, and API controllers. You can configure a new project with your preferred multi-tenancy and frontend options, then use the CLI to scaffold additional functionality as your application grows.

After installing the Nano.Boilerplate NuGet package, you can use these templates from the command line or select the Nano Boilerplate template in Visual Studio.

Here is a quick reference tool for the cli commands:

Terminal
Name your project
Multi-Tenant Options
UI Options

Use the following command to generate a new project from the Nano Boilerplate template:

dotnet new nano

To specify a name for your project, use the -n parameter:

dotnet new nano -n MyApp

Replace MyApp with your desired application name.

To view the available parameters and options, run:

dotnet new nano -h

The -m parameter specifies the multi-tenancy configuration for the generated application.

OptionDescription
multidbMulti-tenancy with a separate database for each tenant
singledbMulti-tenancy with multiple tenants sharing a database
singletenantSingle-tenant application without multi-tenancy

If you don’t specify the -m parameter, Nano uses multidb by default.

For more information about the differences between these configurations, see the documentation on multi-tenancy.

The -ui parameter specifies the frontend configuration for the generated project.

OptionDescription
spaSingle-page application setup for a frontend such as React or Vue
razorServer-rendered Razor Pages setup

The default is spa. Choose this option when building a single-page application with React, Vue, or another SPA framework.

The razor option configures the project for a server-rendered interface using Razor Pages.

Note: The -ui parameter is available in the full version of the Nano Boilerplate.

You can also create a project through Visual Studio by selecting Nano Boilerplate from the installed project templates.

Nano includes a template for generating application services with common create, read, update, and delete (CRUD) operations. This reduces repetitive coding when adding new entities to your application.

Use the following command to generate a service:

dotnet new nano-service

Run the command from the directory where you want the service to be created. Typically, this is the Application/Services directory within your solution.

The service template accepts the following parameters:

  • -s — The singular name of the entity.
  • -p — The plural name used for collections and related operations.
  • -ap — The name of your application.

For example, to generate a service for managing suppliers in an application named MyApp, run:

dotnet new nano-service -s Supplier -p Suppliers -ap MyApp

The template generates a folder containing the service class, interface, DTOs, filters, and specifications required by the service implementation.

These generated components provide a consistent starting point for implementing CRUD functionality. You can then customize the service to accommodate your application’s validation rules, business logic, and data requirements.

If your application uses Razor Pages, include the -ui razor parameter when generating the service:

dotnet new nano-service -s Supplier -p Suppliers -ap MyApp -ui razor

This configures the generated service for the Razor Pages setup, including the appropriate pagination endpoint.

Nano also provides a controller template for creating API controllers within an existing application.

To generate a controller, run:

dotnet new nano-controller

Navigate to the directory where you want the controller to be created. For a Web API project, this is typically WebApi/Controllers. For a Razor-based application, it may be RazorApp/Controllers.

As with the service template, specify the singular entity name, plural entity name, and application name using the -s, -p, and -ap parameters.

For example:

dotnet new nano-controller -s Supplier -p Suppliers -ap MyApp

This generates an API controller in the current directory, providing a starting point for exposing your application’s service functionality through HTTP endpoints.

When generating a controller for an application using Razor Pages, you can include the -ui razor parameter to configure the appropriate pagination endpoint:

dotnet new nano-controller -s Supplier -p Suppliers -ap MyApp -ui razor

Review the generated code and adapt it to your application’s requirements before using it in production.

A typical workflow when starting a new Nano application is:

  1. Install the Nano.Boilerplate NuGet package.
  2. Generate a new application using dotnet new nano.
  3. Select the appropriate multi-tenancy and frontend configuration.
  4. Configure the database connection and run the application.
  5. Use dotnet new nano-service to scaffold CRUD services for new entities.
  6. Use dotnet new nano-controller to generate API controllers for those services.
  7. Customize the generated code to implement your application’s business requirements.

Using the Nano CLI templates helps maintain a consistent application structure while reducing the amount of repetitive code you need to write manually.

Learn about the .NET back-end in the Solution Overview guide