Skip to content

Getting Started

Everything you need to get Blazor Blueprint running on your own machine.

Prerequisites

  • .NET 10 SDK (download). The Aspire AppHost uses the Aspire 13 SDK, which NuGet restores — there is no separate workload to install.
  • A trusted HTTPS development certificate: run dotnet dev-certs https --trust once.
  • Docker Desktop (or another Docker engine). The Aspire AppHost runs your database in a container, and Redis too for the Full shape. You need no local MongoDB, PostgreSQL or SQL Server.
  • PowerShell for the user-secrets script: Windows PowerShell 5.1, or PowerShell 7 (pwsh) on macOS and Linux.
  • An IDE with .NET 10 support (Visual Studio, Rider, or VS Code with the C# Dev Kit) and Git.

Database:DatabaseType chooses the backend: mongodb (default), postgresql or sqlserver. Redis is needed only for the Full topology; the single-process Lite topology runs without it. See Architecture and Deployment.

Installation

  1. Get the source. The repository link is on the Download page. Clone it into a directory of your own:

    Terminal window
    git clone <repository-url> your-saas-app
    cd your-saas-app
  2. Build: dotnet build BlazorBlueprint.sln

  3. Create your local secrets. From the repository root, in PowerShell:

    Terminal window
    Copy-Item init-user-secrets.template.ps1 init-user-secrets.ps1
    # edit init-user-secrets.ps1, then:
    ./init-user-secrets.ps1

    On macOS or Linux use pwsh ./init-user-secrets.ps1. If Windows refuses to run it, first run Set-ExecutionPolicy -Scope Process RemoteSigned.

    init-user-secrets.ps1 is git-ignored. The Web app, API service, background worker and DbMigrator share one user-secrets store, so the script writes each value once (through the Web project); check it with dotnet user-secrets list --project Web/BlazorBlueprint.Web.

    What to fill in (openssl rand -hex 32 or any password generator makes a good random value):

    • Required for Full: the shared client secret (written to both Services:InternalApi:ClientSecret and Security:WebApp:ClientSecret) and Security:Jwt:SecretKey (at least 32 characters). Without them the API service or the web app fails at startup naming the missing key. Lite needs neither.
    • Messaging:MessageSigningKey and DomainVerification:TokenHmacSecret. The shipped development placeholders work locally but are refused outside Development, so set real random values anyway.
    • DefaultOrganisationSettings:SiteEmail — your platform organisation’s contact address, seeded at initial setup and shown on the app’s error pages. The secrets template sets it to support@yourdomain.example: replace it with an address you own, or delete the line.
    • Optional: email (the secrets template sets up SendGrid; the shipped default provider is MailerSend), OpenAI, and the Facebook and Google logins. Delete the lines you are not configuring rather than leaving YOUR-* placeholders. Email stays off (DefaultOrganisationSettings:Email:Enabled is false) until you supply a real API key and set Enabled to true.

Keep it easy to take updates

This is a template, not a dependency: you own your copy, and taking a later release is a git merge. How hard that merge is depends mostly on choices in your first week.

Keep upstream as a second remote. Clone rather than download a ZIP (which has no shared history), then point origin at your own repository:

Terminal window
git remote rename origin upstream
git remote add origin <your-own-repo-url>
git push -u origin main

git fetch upstream then brings a release in as real history. Never push to upstream.

Build where the template is designed to be extended — every merge conflict is a line both you and upstream changed:

  • Plugins. A feature built as a plugin lives in its own project and adds nav, routes, admin pages, public routes and background sweeps without editing a host file. See Plugin Development.
  • Provider interfaces. Payments, SMS, email, file storage and AI are interfaces; add your own implementation beside the shipped ones.
  • Settings over code. Feature switches, provider credentials and plugin settings are saved in the app; a plugin’s defaults ship in its *.plugin.json and are overridden in configuration.
  • New files over edited ones. When you must edit a shipped file, keep the edit small and don’t reformat around it.

Keep VERSION in step with upstream — it is the host version plugins are checked against (see Plugin Development → Dependency versions). Track your own releases in commit messages or a CHANGELOG.

Running locally

Set Dev/BlazorBlueprint.AppHost as the startup project and press F5, or run:

Terminal window
dotnet run --project Dev/BlazorBlueprint.AppHost

Open the web resource’s endpoint from the Aspire dashboard. The first start is slower while container images download.

The AppHost starts a container (with a data volume) for the selected database and injects its connection string into every project, so the app’s own Database:ConnectionString is not used. Choose the topology with a launch profile:

Launch profile Topology Database Grafana
AppHost (MongoDB) (default) Full: Web, API service, background worker and Redis MongoDB Yes
AppHost (Postgres) Full PostgreSQL Yes
AppHost (SqlServer) Full SQL Server Yes
AppHost (Lite) Lite: Web only MongoDB No

From the command line: dotnet run --project Dev/BlazorBlueprint.AppHost --launch-profile "AppHost (Lite)". The Postgres and SQL Server profiles print the dashboard URL instead of opening it.

Grafana. Every profile except Lite also starts Grafana (grafana/otel-lgtm) with the dashboards and alert rules from deploy/grafana; telemetry goes there and is forwarded to the Aspire dashboard under the deployed service names (such as blazorblueprint-web). Open it from the grafana resource: dashboards need no sign-in, and the admin password is the generated grafana-admin-password parameter. Grafana__Enabled (true/false) adds it to Lite or removes it from another profile. For Grafana on a server, see Deployment.

To use another backend with Lite, set Database:DatabaseType in Dev/BlazorBlueprint.AppHost/appsettings.json (or Database__DatabaseType).

Encryption keys are stored in the local database, wrapped by a key-encrypting key (KEK) in a per-user, per-checkout folder that survives clean builds: %LOCALAPPDATA%\BlazorBlueprint\kek\{hash} (Windows), ~/.local/share/BlazorBlueprint/kek/{hash} (Linux), ~/Library/Application Support/BlazorBlueprint/kek/{hash} (macOS). Profiles on the same backend share its database volume, and all share the KEK folder, so you can switch between Full and Lite freely. To start fresh, remove the database volume (Docker Desktop, or docker volume rm); deleting only the KEK folder makes startup refuse, because the stored keys can no longer be unwrapped.

The AppHost Lite profile runs in the Development environment, so it is not a faithful copy of a deployed Lite stack. Verify Lite itself as described in Deployment.

The AppHost is not used in production; see Deployment.

Without Aspire

The simplest manual setup is the web app alone, in the single-process shape.

  1. Start a database: docker run -d --name mongodb -p 27017:27017 mongo:7. The shipped Database:ConnectionString already points at mongodb://localhost:27017; for PostgreSQL or SQL Server, set Database:DatabaseType and Database:ConnectionString.

  2. Switch to the single-process shape in Web/BlazorBlueprint.Web/appsettings.Development.json (edit the existing Caching and Services sections rather than adding duplicates), or with environment variables:

    "Caching": { "UseRedisDistributedCache": false, "UseRedisSignalRBackplane": false },
    "Messaging": { "Transport": "InProcess" },
    "BackgroundServices": { "RunInProcess": true },
    "Services": { "InternalApi": { "Enabled": false } }

    In Development the KEK is generated in a per-checkout folder under your local application-data folder (set DataProtection:KekPath to move it). Delete it only together with the database.

  3. Run the web app: dotnet run --project Web/BlazorBlueprint.Web serves http://localhost:5034; add --launch-profile https for https://localhost:7250 as well.

To run the Full topology by hand:

  1. Keep the shipped Full values (skip or undo step 2): Redis cache and backplane true, Messaging:Transport Redis, BackgroundServices:RunInProcess false, Services:InternalApi:Enabled true. The web host refuses to start with Transport=Redis and RunInProcess=true.
  2. Start Redis on localhost:6379, e.g. docker run -d --name redis -p 6379:6379 redis:7-alpine.
  3. Also run dotnet run --project Services/BlazorBlueprint.InternalApi --launch-profile https (the web app expects it at https://localhost:7118) and dotnet run --project Services/BlazorBlueprint.BackgroundWorker. Queued work (email, AI requests, outgoing webhooks) is processed only while the worker runs.

First run

  1. Complete initial setup. While no organisation exists, every request redirects to /initial-setup, where you:

    • name the platform organisation (letters and numbers only) and give it a site header;
    • create the first account, which becomes a platform admin and the platform organisation’s Owner, with its email counted as confirmed (Register is for everyone after that);
    • accept the LICENSE terms (checked on the server);
    • enter the platform address — the hostname the application answers on, such as app.example.com, where sign-in lives and organisation subdomains hang off.

    It is pre-filled from the address you opened setup on, and every link the application builds — including the background worker’s push notifications and billing emails — uses it. On a server it is the public hostname and links are https://. On your own machine it includes the port (http://localhost:5034 for dotnet run or Aspire, http://localhost:8080 for a Docker stack); only a localhost address keeps its scheme and port. You can change it at Platform → Platform Settings, which accepts only an address you are browsing the deployment at (or a parent of it; localhost is exempt on the server) and asks before replacing a saved one, since a mistyped address takes the application offline.

    Where the key-encrypting key was generated on a key volume (a Docker stack, say), setup also shows the encryption recovery key once and asks for its last six characters to confirm you saved it. Keep it safe: it is how you recover if that volume is lost. A local dotnet run or Aspire run uses a development key and shows none.

    Who may open setup. A request from loopback with a localhost host name in the Development environment (dotnet run, Aspire), or one carrying a valid setup token. Anything else — including a Docker stack opened at http://localhost:8080, which runs outside Development and is reached from the Docker network — goes to /setup-not-allowed, and the app logs the token at Warning the first time, as a whole address to open (http://localhost:8080/initial-setup?setupToken=<token>). The token is generated per process and changes on restart unless pinned with Security:Setup:Token (at least 32 characters; a shorter value is ignored with an error in the log). See Deployment → First run and Security → Initial setup.

    The app remembers that setup is complete for the life of the process; if you wipe the database during development, restart the app to see setup again.

  2. Sign in. The application is members-only, so setup ends at sign-in. You may first be asked to accept the default legal policies at /Account/AcceptConsent.

  3. Land on the app launcher. Members land on /apps: a tile grid of the organisation’s installed plugins, plus Admin and Platform Admin tiles for those roles and My profile for everyone. The App launcher switch (Platform → Platform Settings → Features, on by default) controls it for the deployment; an organisation can also turn it off for itself.

  4. Explore the example plugin in Plugins/ExamplePlugin/. It has one small working example of each thing a plugin can do — data, files, payments, jobs, messaging, webhooks, public pages, layout slots — and a diagnostics page at /admin/plugin/exampleplugin/diagnostics that self-tests every host feature it relies on (worth running after an upgrade). It is installed into every new organisation. Read it, then delete it (see Plugins) or build your own beside it. A plugin’s pages live under /plugin/{name}/… and its settings under /admin/plugin/{name}/….

  5. Check the infrastructure page. As a platform admin, open /Platform/Infrastructure. It says which shape is running — Full, Lite, or Custom (naming any setting that differs from the nearer of the two) — then shows the status of the database and, under Full, Redis, the API service, the background worker and the messaging consumers. Below that is the read-only configuration, including whether each required secret is set or still a shipped placeholder.

Outbound email is off until you configure a provider, so password resets and invitations are not sent — and are discarded, not held: configuring email later does not send them, so request or re-send them afterwards. Every email uses the platform’s settings — organisations have no sender of their own. Meanwhile, use Copy invite link on /Admin/Members. Invitation and account links are always built on the saved platform address, never on the address a request came in on, so if you change how the deployment is reached, update the platform address too. See Configuration.

Also on Platform → Platform Settings (/Platform/Settings):

  • Feature switches, saved at their defaults by setup (see Architecture). Organisation subdomains are saved off unless the platform address is a domain a sign-in can be shared across (not localhost, an IP address or a single-label name). Email confirmation required is off and can only be switched on once outbound email works.
  • Google Analytics. A new deployment sends no analytics until you enter a measurement id.

Running the tests

Terminal window
dotnet test BlazorBlueprint.sln

Run the whole solution: the tests live in Tests/BlazorBlueprint.Tests, Tests/BlazorBlueprint.Tests.Integration and Plugins/ExamplePlugin/BlazorBlueprint.Plugins.ExamplePlugin.Tests, and the guard that catches a change to a shared file is often in a different project from the code you changed.

Most tests use in-memory fakes. The integration project needs:

  • Docker, for the MongoDB and web-app suites, which start their own containers.

  • PostgreSQL and SQL Server listening on localhost with fixed credentials:

    Terminal window
    docker run -d --name bb-pg -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=blazorblueprint -p 5432:5432 postgres:16
    docker run -d --name bb-mssql -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD='Bb_Str0ng_Pass!' -p 1433:1433 mcr.microsoft.com/mssql/server:2022-latest

These suites skip themselves when their database is unavailable, and a run full of skips still reports success. Check the skip count, not just the exit code, and run them against real databases after any data-layer change. A missing EF migration is the classic case: it passes locally and fails in CI, which provides both servers and fails the build if those suites skip.