Engineering4 min read

The feature your customers pay for is maybe half of a SaaS product. The other half is the plumbing every SaaS needs: accounts, teams, billing, tenant separation and an admin panel.

The short answer

Building a SaaS means building your core feature plus the platform around it: sign-up and accounts, organisations and team roles, subscription billing with trials and failed payments, strict separation of each customer's data (multi-tenancy), an admin panel for your own team, email notifications, and monitoring. Plan the platform early; retrofitting tenancy or billing later is far harder than building them in.

The iceberg: what customers see vs what you build

Founders describe their SaaS by its core feature: "it schedules posts", "it tracks inventory", "it answers support questions". That feature is what customers pay for, and it is usually the smaller part of the build.

Under it sits the platform every SaaS needs before it can charge its first customer. Skipping it is how products end up with one shared database where a bug shows one customer another customer's data.

The parts every SaaS needs

  1. 01Accounts and authentication. Sign-up, sign-in, password reset, email verification, and often Google or Microsoft sign-in for business customers.
  2. 02Organisations and roles. Customers are companies, not people. One organisation, many members, with owner, admin and member roles at minimum.
  3. 03Multi-tenancy. Every row of data belongs to an organisation, and every query is scoped to it. This is the single most important design decision in a SaaS.
  4. 04Subscription billing. Plans, trials, upgrades, downgrades, invoices, tax, and what happens when a card fails. Stripe or a similar provider does the payments; your app still has to react to each event.
  5. 05Admin panel. Your own team needs to look up a customer, extend a trial, issue a refund and see what went wrong.
  6. 06Notifications. Transactional emails for invites, receipts, password resets and alerts.
  7. 07Security and audit. Permissions checked on the server, secrets out of the code, rate limits, and a log of who did what.
  8. 08Monitoring. Error tracking, uptime checks and backups you have actually tested restoring.

Multi-tenancy: decide it on day one

There are three common patterns: a shared database with an organisation ID on every row, a separate schema per customer, or a separate database per customer. For most new SaaS products, a shared database with every table scoped by organisation, enforced in one place (row-level security in PostgreSQL is a good tool for this), is the simplest safe choice.

Whichever you pick, enforce it centrally. Tenancy that depends on every developer remembering a WHERE clause will eventually leak.

-- PostgreSQL: every query on projects is limited to the caller's organisation
alter table projects enable row level security;

create policy projects_by_org on projects
  using (org_id = current_setting('app.org_id')::uuid);

Billing is a state machine, not a checkout page

The checkout page is the easy part. The real work is reacting correctly to everything that happens after: a trial ending, a renewal succeeding, a card failing three times, a customer downgrading mid-month, a refund. Each of these arrives as an event from the payment provider, sometimes twice and sometimes out of order.

Worth knowing

Store your own copy of each customer's subscription status, update it only from verified payment provider events, and make every event handler safe to run twice.

What to build first

  1. 01Accounts, organisations and tenancy from the very first commit
  2. 02The core feature, narrow and excellent
  3. 03Billing with one plan and a trial
  4. 04A bare admin panel: find customer, see subscription, extend trial
  5. 05Error tracking and backups before the first paying customer

Where we come in

We build SaaS platforms with accounts, billing and room to scale, such as eMenu, which lets restaurants publish a menu once and update it anytime, and AskVerb, our own AI agent platform for SaaS products. If you are planning a SaaS, book a 15-minute call and we will help you separate the platform you need on day one from the features that can wait. Related reading: how to build an MVP.

AL
“The most expensive SaaS fix we see is adding tenancy to a product that launched without it. If you remember one thing from this post, scope every table to an organisation from the first day.”
The Auralion Labs team

Questions people ask us.

It means one application serves many customer organisations while keeping each one's data strictly separate. Most new products use a shared database where every row belongs to an organisation and every query is scoped to it.

Accounts and sign-in, organisations with roles, data separation between customers, subscription billing with a trial, a basic admin panel, transactional emails, error tracking and tested backups, plus your core feature.

Stripe or a similar provider should handle the payments themselves. Your application still needs to react to each billing event, such as renewals, failed cards and plan changes, and keep its own record of each customer's subscription.

It depends on the core feature and the platform it needs. A narrow core feature on a standard platform (accounts, tenancy, one plan) is far quicker than a product with many roles and integrations. Write the scope first, then estimate.

Keep reading.