Web Development

SaaS Web App Must-Haves: Multi-Tenancy, Billing, Roles and Security

The invisible platform features that decide whether a SaaS product can scale and sell to larger customers, and the order in which to build them.

  • DivTech editorial team
  • 7 min read
Tenant-facing appIdentity and accessBilling and entitlementsCore domain services
Web Development · part 5 of 5

A SaaS product is more than a web app with a sign-up page. Many customers share one system, and each expects their data to stay private, their invoices to be correct and their admins to control who sees what. These platform features are invisible in a demo, yet they decide whether you can sell to larger customers, and retrofitting them later is expensive. This guide covers the must-haves and the order to build them in. They are standard parts of the SaaS products our web application development team builds.

The SaaS platform at a glance

stackLayers of a SaaS web application
L1
Tenant-facing app

Onboarding, the product itself, settings, user management and billing pages.

L2
Identity and access

Sign-up, login, MFA, SSO, roles and permissions, all scoped to a tenant.

L3
Billing and entitlements

Plans, subscriptions, usage tracking, invoices and the features each plan unlocks.

L4
Core domain services

Your product's business logic, always executed in the context of a tenant.

L5
Tenant-aware data

Isolation by row, schema or database, plus backups and per-tenant export.

L6
Operations

Audit logs, monitoring, alerting, feature flags and an internal admin console.

DivTech System

1. Multi-tenancy: choose your isolation model

Multi-tenancy means one deployment serves many customers, called tenants. The key decision is how strongly tenant data is separated. There are three common models, and you can mix them, for example pooling smaller customers while giving enterprise customers a dedicated database.

ModelHow it worksProsCons
Shared schema (pool)Every table has a tenant_id columnCheapest to run; simplest to deploy and migrateA missing filter can leak data; noisy neighbours
Schema per tenant (bridge)One database, a separate schema for each tenantStronger separation; per-tenant restoreMigrations run per schema; harder with thousands of tenants
Database per tenant (silo)Each tenant has its own databaseStrongest isolation; per-tenant data residencyHighest cost and operational effort

For most new products the pooled model is the right start, with protection in depth: resolve the tenant once per request (from subdomain, token or header), scope every query automatically in the ORM or repository layer, and add database-level enforcement such as PostgreSQL row-level security as a safety net. Write automated tests that deliberately try to read another tenant's data. If you are still choosing a database, see SQL vs NoSQL.

2. Subscription billing and entitlements

Billing is more than taking a card payment. Use a dedicated billing platform such as Stripe Billing, Paddle or Chargebee rather than building your own, and keep a clear line between billing (what the customer pays) and entitlements (what the customer can use).

  • Plans and pricing models: flat tiers, per seat, usage-based or a hybrid. Design the data model so you can add a plan without a code release.
  • Lifecycle events: trials, upgrades and downgrades with proration, cancellations, failed payments and retries (dunning), and reactivation. Process them from billing webhooks, idempotently.
  • Entitlements: check features and limits such as seats, projects or API calls against the plan in one place, never with plan names scattered through the code.
  • Tax and invoices: sales tax, VAT and GST rules differ by country. A merchant-of-record provider can take on tax collection and filing if you sell internationally.

3. Roles, permissions and enterprise access

Start with role-based access control (RBAC): a few roles per tenant, such as owner, admin, member and read-only, each mapped to permissions such as invoice.view or user.invite. Check permissions on the server for every request, never only by hiding buttons in the UI, and let tenant admins invite, deactivate and change the roles of their own users.

Larger customers will ask for more: single sign-on through SAML or OpenID Connect, automatic user provisioning through SCIM, enforced MFA, IP allow-lists and custom roles. You do not need all of this on day one, but design the identity model so it can be added without a rewrite. Managed identity services can save a lot of work here.

4. Security, audit logs and compliance

  • Audit logs: record who did what, to which record, when and from where, for security-relevant actions such as logins, permission changes, exports and deletions. Make them append-only and visible to tenant admins.
  • Data protection: encryption in transit and at rest, secrets in a vault, least-privilege access for your own staff, and per-tenant export and deletion to support GDPR requests.
  • Secure engineering: dependency scanning, code review and regular penetration tests, as covered in our cloud security best practices guide.
  • Compliance readiness: enterprise buyers send security questionnaires and may ask for SOC 2 or ISO 27001. Good logging and access control make these far easier to answer.

5. Onboarding, admin and observability

Four operational features are often forgotten until customers arrive:

  • Self-serve onboarding: sign-up, email verification, workspace creation, sample data and a short checklist that gets users to their first useful result.
  • Internal admin console: lets your support team find tenants, see plan and usage, extend trials and safely impersonate a user, with every action audited.
  • Feature flags: roll new features out to selected tenants first, and switch them off without a deployment if something goes wrong.
  • Tenant-aware observability: tag logs, metrics and traces with the tenant ID so you can see which customers an error or slowdown affects. Our guide to monitoring and observability explains the setup.

6. APIs, integrations and offboarding

Business customers want your product to fit into their other systems, and they want to know they can leave with their data. Plan for:

  • A documented public API with per-tenant API keys or OAuth clients, scoped permissions and rate limits that can differ by plan.
  • Outgoing webhooks so customers can react to events such as a new order or a changed status, with signed payloads and automatic retries.
  • Bulk import and export in common formats such as CSV, so onboarding a new customer does not need your engineers.
  • Clean offboarding: a full data export on request, and a documented process and timeline for deleting a tenant's data after cancellation.

Treat the API as a product with versioning and a changelog. Breaking a customer's integration silently is one of the fastest ways to lose their trust.

In what order to build it

timelineAn indicative build sequence for SaaS foundations
  1. Before the first customerCore foundations

    Tenant model and isolation, authentication, basic roles, audit log, backups.

  2. Before the first paid planBilling

    Plans, subscriptions, webhooks, entitlement checks and invoices.

  3. As usage growsOperations

    Admin console, tenant-aware monitoring, feature flags, self-serve onboarding.

  4. First enterprise dealsEnterprise access

    SSO, SCIM, custom roles, audit log export and security documentation.

  5. At scaleIsolation options

    Dedicated databases or regions for customers with residency or performance needs.

The order varies by market; B2B products sold to large companies may need SSO much earlier.

DivTech System

Choose your architecture with these needs in mind: a modular monolith with distinct tenancy, billing and identity modules is usually the easiest start. On the backend, frameworks such as NestJS and Django (Python) have mature tooling for queues, multi-tenancy and billing integrations, and the frontend framework choice comes after these decisions.

Building your SaaS

DivTech can design these foundations with you, build them alongside your core product and set up the cloud infrastructure and testing around them. Products in regulated sectors such as fintech need extra care with audit trails and data residency. Request a quote with a short description of your product and target customers, and we will suggest the right starting point.

Frequently asked questions

What is the best multi-tenancy model for a new SaaS?

For most new products, a shared database with a tenant ID on every row, automatic query scoping and database-level row security. It is the cheapest to run and the easiest to migrate. Dedicated databases can be offered later to customers who need them.

Should we build our own billing system?

Usually not. Billing platforms handle subscriptions, proration, failed-payment retries, invoices and often tax. Build only the entitlement layer that maps plans to features and limits in your product.

When do we need single sign-on?

When you start selling to mid-size and large companies, whose IT teams often require SAML or OpenID Connect SSO. Design the identity model for it from the start, even if you build it later.

What should a SaaS audit log contain?

For each security-relevant event: the actor, the action, the affected record, the tenant, the timestamp and the source, such as IP address. It should be append-only and exportable by tenant admins.

  • SaaS development
  • Multi-tenancy
  • Subscription billing

free consultation

Need help with web development?

Talk to our Web Application Development team. We'll review your situation and suggest a practical next step, free.