Generate an app
The template creates a complete app from one command. Its options decide what goes in it: whether it has accounts and organisations, how it stores data, and whether it comes with tests and an Aspire AppHost. What you get is your own code, with only the parts you chose: there's no package to update later, and nothing to switch off.
The command
Install the template once, then generate an app with the options you want:
dotnet new install LibreSharp.Templates.SaasStarter
dotnet new saas-starter -n MyApp --Auth identity --Persistence efcore
cd MyApp
git init && git add -A && git commit -m "Generated from LibreSharp.Templates.SaasStarter"Leave an option out to take its default. dotnet new saas-starter --help lists them, and Get started has what you need installed first.
The options
| Option | Values | Default | What it decides |
|---|---|---|---|
--Auth (-A) | none, identity, saas | saas | Accounts, and whether they belong to organisations |
--Persistence (-P) | marten, efcore | marten | How data is stored in PostgreSQL |
--IncludeTests (-I) | true, false | true | The API and end-to-end tests |
--Aspire (-As) | true, false | false | An Aspire AppHost that starts everything for development |
-n gives the app's name, used for its solution, project, namespaces and container image (a C# name, such as MyApp or Acme.Crm; the current folder's name if you leave it out). -o says where to put it (a folder named after the app by default).
Every combination is built and tested in the template's CI on every change, so any of them is a working app.
Accounts and organisations: --Auth
How much of a SaaS app you get. Each choice adds to the one before.
No accounts
dotnet new saas-starter -n MyApp --Auth noneFor an internal tool, or to start small and add sign-in yourself. Everyone shares the same data.
- The Todo example: endpoints, validation, a background handler, scheduled reminders and live updates over SignalR, to copy for your own features.
- Messaging: a transactional outbox and durable queues.
- File storage: local disk, any S3-compatible store or Azure Blob Storage.
- Production: a container image, Docker Compose with Caddy, health checks, OpenTelemetry and strict security headers.
Accounts
dotnet new saas-starter -n MyApp --Auth identityFor an app where each person has their own data. Everything under No accounts, and:
- Sign-in: email and password, passkeys, Google and GitHub, two-factor authentication.
- Account security: email confirmation, sessions, lockout, and emails about new devices and changes.
- Settings: profile picture, email, password, sign-in methods, notifications, download your data, delete the account.
- Back office: users, roles, invitations, an audit log, and failed messages to replay.
Accounts and organisations default
dotnet new saas-starter -n MyAppFor a SaaS sold to teams: data belongs to an organisation, not a person. Everything under Accounts, and:
- Organisations: each account gets one; members with Owner, Admin and Member roles, invitations by email, a switcher, and data kept apart per organisation.
- Billing: plans, a reverse trial, features and limits per plan, and Stripe Checkout, the customer portal and webhooks.
- Integrations: API keys, an MCP endpoint for AI assistants, signed webhooks, and encrypted secrets.
- Back office: organisations, revenue and feature flags too.
Not sure? Take the smallest that covers what you'll need in the first months. Adding organisations to an app later means moving its data under them, so if you'll sell to teams, start with saas.
Data: --Persistence
Both store everything in PostgreSQL, and both run the same features, tests and docs. They differ in how you write data access.
marten (default) | efcore | |
|---|---|---|
| What it is | Marten: documents stored as JSON, and event sourcing | Entity Framework Core: classes mapped to tables |
| Schema changes | None to write: Marten updates its tables when the app starts | A migration for each change, applied when the app starts (how) |
| The Todo example | Each Todo is an event stream, with a snapshot to query | Each Todo is a row |
| Choose it when | You want to move fast, or keep a history of changes | Your team knows EF Core, or you want a relational schema to report on |
Tests: --IncludeTests
With true (the default), the app has tests/ApiHost.Tests, which runs the real app against a throwaway PostgreSQL in Docker (xUnit, Alba and Testcontainers), and tests/e2e, which drives it in Chrome (Playwright), including accessibility checks. The client's unit tests (Vitest) are always there, next to the code. See Testing.
Set it to false only if you'll write your own: the tests are also the best examples of how to test a new feature.
Aspire: --Aspire
With true, the app also has src/ApiHost.AppHost, an Aspire AppHost: dotnet run --project src/ApiHost.AppHost starts PostgreSQL, Mailpit, the API and the dev server, and opens a dashboard with their logs, traces and metrics. It's for development only; production is unchanged. Without it, docker compose up -d and two terminals do the same (run it, with Aspire).
After generating
- Commit the app as generated, before changing it. Upgrading to a later version of the template applies the template's changes as a patch, which works best when that first commit is in your history (Upgrading).
- Keep
.saas-starter.json. It records the template version, the app's name and the options you chose, so an upgrade needs only the version you want. - Run it: A generated app shows how, and what's in it.