Getting Started with IdentitySuite
1. Create a new empty project
Create a new Blazor Server .NET10 project
dotnet new blazor -o IdentitySuite --empty --interactivity Server --all-interactive2. Install the IdentitySuite NuGet Package
Run the following command in your project directory:
dotnet add package IdentitySuite3. Choose and Install a Database Provider Package
IdentitySuite supports multiple database backends. Install one of the following providers:
SQL Server (Recommended for Windows/Enterprise)
dotnet add package IdentitySuite.EntityFrameworkCore.SqlServerPostgreSQL (Cross-platform, Open Source)
dotnet add package IdentitySuite.EntityFrameworkCore.PostgreSqlMySQL (Compatible with MySQL/MariaDB)
dotnet add package IdentitySuite.EntityFrameworkCore.MySqlDatabase Engine Notice
In version 2, the package for using MySQL as a database engine is currently not available.
This is due to the fact that the Pomelo.EntityFrameworkCore.MySql dependency has not yet been updated to support .NET 10.
You can follow the progress of this update on the official GitHub issue: Pomelo MySQL .NET 10 support issue .
Important MySQL Requirements
- Connection String: Must include:
copy
"ConnectionStrings": { "MySqlConnection": "Server=localhost;Database=IdentitySuiteDb;Uid=root;Pwd=your_password;AllowUserVariables=true" } - Without
AllowUserVariables=true, Pomelo's caching system will fail
4. Configure the server
After installation, edit the configuration file found in the IdentitySuite directory located in the root of your project
IdentitySuiteSettings.{environment}.json
Where {environment} matches your current
environment (Development, Production, etc.).
Important:
- Set the
ConnectionStringssection according to your database provider - Ensure the configuration matches the NuGet package you installed (SQL Server, PostgreSQL, or MySQL)
- Set
"Initialize": trueto enable automatic database initialization and migrations
5. Configure Program.cs
Update your Program.cs file with the
following code:
using IdentitySuite;
var builder = WebApplication.CreateBuilder(args);
// 1. Registers all required services (authentication, authorization, etc.)
builder.AddIdentitySuiteServices();
var app = builder.Build();
// 2. Creates/updates the database based on configuration
await app.SetupIdentitySuiteDbAsync();
// 3. Enables all runtime services (authentication, routing, etc.)
app.UseIdentitySuiteServices();
await app.RunAsync();
Method Breakdown
AddIdentitySuiteServices()
Registers all necessary services including:- Blazor services
- OpenIddict service
- Authentication
- Entity Framework Core contexts
- Identity core services
SetupIdentitySuiteDbAsync()
Handles database operations based onIdentitySuiteSettings.json:- Applies pending migrations
- Creates initial tables
- Requires
"Initialize": true
UseIdentitySuiteServices()
Configures the complete middleware pipeline:- Authentication/Authorization
- Routing
- Session management
- Security headers
Complete Solution
IdentitySuite handles all standard Blazor Server setup - no additional
services or middleware needed in Program.cs.
Execution Order
- Services registration (
Add) - Database preparation (
Setup) - Middleware activation (
Use)
6. Build and Run the Application
Execute these commands in your project directory:
Build the project:
dotnet buildRun the application:
dotnet runFirst Run Notice:
- The initial startup will take longer as the system:
- Creates/updates the database (if configured)
- Generates encryption keys
- Seeds initial data
- Subsequent runs will be significantly faster
Default Admin Credentials:
| Username | Password |
|---|---|
| admin@IdentitySuite.local | P@ssw0rd1234! |
Security Note: Change these credentials immediately after first login.
Complete Example Repository
For a fully configured solution including:
- Best practice setup with logging (Serilog)
- Environment-specific configurations
- Sample authentication flows
- Advanced scenarios