a-completely-free-net-saas-template-introducing-the-libresharp-saas-starter.md

A Completely Free .NET SaaS Template: Introducing the LibreSharp SaaS Starter

Every SaaS app starts with months of work that has nothing to do with the product. Sign-up and login, email confirmation, password resets, organisations and invitations, plans and trials, Stripe webhooks, an admin back office, background jobs. None of it is what customers pay for, and all of it has to exist on day one.

In .NET, the usual way to skip that work is a starter kit. Most of the good ones are paid, and plenty of the free ones are built on libraries that have since gone commercial. So I built the LibreSharp SaaS Starter: a dotnet new template for SaaS apps with no commercial licences anywhere in the stack.

Why .NET Needs One

Other ecosystems have plenty of free, opinionated SaaS starters. .NET has far fewer, and the last couple of years made it worse.

Paid starter kits fill most of the gap. Some of them are good, and if one suits you, buy it. But a student, a solo founder testing an idea, or a non-profit shouldn’t need a licence before writing their first line of product code.

The bigger problem is that the “default” .NET architecture went commercial. For years, templates and tutorials taught MediatR for in-process messaging, MassTransit for the bus and outbox, AutoMapper for mapping and FluentAssertions in the tests. All four are now commercial. A template built on that stack isn’t really free, even if its own code is MIT. You find out when you pass a revenue limit or need a security patch.

I wanted a template that covers the real SaaS plumbing rather than just a login page and a to-do list. Every dependency had to be free and open source. And it needed security, observability, tests and a cheap deployment path built in from the start.

The Stack

It’s a single deployable ASP.NET Core host with a React frontend. The README describes it as doing “the jobs often given to MediatR (in-process messaging) and MassTransit (message bus and transactional outbox) with Wolverine, on a stack of free, open-source libraries.”

The backend is .NET 11 with WolverineFx. Wolverine handles the HTTP endpoints, organised as vertical slices, and also the messaging: durable local queues, a transactional outbox and scheduled messages. Data lives in PostgreSQL, through either Marten (the default, with event sourcing) or EF Core. You pick when you create the project.

The frontend is React, Vite and TypeScript with Tailwind CSS and shadcn/ui. It uses React Router in framework mode, so public pages like pricing are pre-rendered. TanStack Query handles data, and the API client is generated from the backend’s OpenAPI spec, so the types always match.

Around that:

  • Auth is ASP.NET Core Identity with short-lived JWTs and rotating refresh tokens, plus Google, GitHub and passkey sign-in.
  • Billing is Stripe via Stripe.net, behind an IPaymentProvider interface.
  • Email goes out through the outbox with MailKit, and Mailpit catches it locally.
  • Observability is OpenTelemetry, with an optional Aspire dashboard.
  • Testing uses xUnit, Alba and Testcontainers against real Postgres on the backend, Vitest and MSW on the client, and Playwright end to end.
  • Production is a container plus docker-compose with PostgreSQL and Caddy for automatic HTTPS.

The roadmap has a short “keep out” list, and it reads “paid tooling and commercial UI kits”.

What You Get

The SaaS-specific features are what make this more than a web app template.

Accounts cover the boring essentials: confirmation emails, password resets, lockout, account deletion and a “Download your data” export. Every account gets its own organisation, and users can create more, invite people by email and switch between them. Roles are Owner, Admin and Member, and an organisation always has at least one owner.

Billing is the part I’d most hate to build from scratch. Plans are defined in code with versioned prices per currency, so existing customers keep their price when you raise it. New sign-ups get a 14-day trial of the top plan, then drop to the free plan. Limits are enforced in the API with a warning at 80%, and Stripe webhooks are processed from a durable queue so a slow handler doesn’t lose events. Downgrades never delete data.

There’s also an /admin back office with users, an audit log, a dead-letter queue you can replay, and a customer dashboard showing MRR, trials ending and failed payments. On top of that come per-organisation API keys, outgoing signed webhooks, and an MCP endpoint so AI agents can work with your app.

The README has the full list, including the security setup. It’s all plain code in your repo, so you can change or delete any of it.

Getting Started

You’ll need the .NET 11 SDK, Node.js 22.22 or later, and Docker.

dotnet new install LibreSharp.Templates.SaasStarter

dotnet new saas-starter -n MyApp
cd MyApp
docker compose up -d          # starts Postgres and Mailpit
cd src/Client && npm install
cd ../MyApp && dotnet run

Then start the frontend in a second terminal:

cd MyApp/src/Client
npm run dev                    # http://localhost:5173, proxies /api/* to the API

In development you can sign in with [email protected] / Demo123!.

Three options control what gets generated:

Option Values Default
--Persistence marten, efcore marten
--Auth none, identity, saas saas
--IncludeTests true, false true

So for EF Core with accounts but no organisations or billing:

dotnet new saas-starter -n MyApp --Persistence efcore --Auth identity

CI generates all 12 option combinations on every push and runs the integration tests, a container build, the Playwright tests, and a production publish-and-start check against each. Each generated app gets its own docs/ folder covering only the options you picked. It also comes with CLAUDE.md and AGENTS.md files, so AI coding assistants understand the project from the first prompt.

Where It’s Up To

It’s early. Version 0.5.0 is the latest, and it’s a community template, not an official WolverineFx/JasperFx package. The README lists the known limitations up front.

Tokens are signed with an HS256 shared secret for now, and because they’re kept in memory, reloading the page signs you out. There’s no TOTP two-factor yet, although passkeys work. It also runs as a single instance, so scaling out would need a SignalR backplane and shared rate limits.

Next up for v0.6 is file uploads to S3-compatible storage, an --aspire option, and session-storage tokens. Translations and extension points will follow. There’s an open question about which cheap host the deployment guide should target first: a VPS with Docker Compose and Caddy, or something like Fly.io or Railway. Opinions welcome.

Free Isn’t the Same as Unsupported

This template stands on a lot of other people’s work. The Wolverine and Marten maintainers at JasperFx did most of the heavy lifting, along with the shadcn/ui and React Router teams and the authors of Alba, Testcontainers and MailKit. If the starter saves you a few months, pass some of that on to them. Sponsor them, contribute, or pay for commercial support where they offer it.

For the starter itself, GitHub issues are the place for suggestions. I’d especially like to hear from anyone who has shipped a real SaaS app on .NET and can tell me what’s missing. Pull requests are welcome too. docs/CONTRIBUTING.md explains how the conditional template code works and how to test a change across the option combinations. And if you think it’s useful, a star helps other .NET developers find it before they reach for a paid kit.

dotnet new install LibreSharp.Templates.SaasStarter
dotnet new saas-starter -n MyApp

Loading comments from Disqus…