Web & SaaS Engineering 11 min read

How to Build a SaaS Product: Multi-Tenancy, Billing, Auth and Architecture Explained Simply

The building blocks every SaaS product needs — tenants, roles, subscription billing, onboarding, audit logs and observability — explained for founders, with the decisions you must make early and the ones you can delay.

Umer Hasan

Umer Hasan

Co-Founder & CTO at Zapprex

How to Build a SaaS Product: Multi-Tenancy, Billing, Auth and Architecture Explained Simply
Table of contents

What makes software “SaaS”?

Software-as-a-Service means many customers (called tenants) use one hosted application, each seeing only their own data, and pay a recurring subscription. That single sentence creates most of the engineering work: you need tenant isolation, self-service sign-up, subscriptions, and a way to update the product for everyone without downtime.

At a glance: Authentication, roles and permissions — Organisations and invitations, Role-based access control (RBAC), Single sign-on later, Security basics
At a glance: Authentication, roles and permissions

Multi-tenancy: three ways to separate customer data

ModelHow it worksBest for
Shared database, tenant_id columnAll tenants share tables; every row has a tenant_id and every query filters by itMost new SaaS products — cheapest and simplest to run
Schema per tenantOne database, a separate schema for each tenantTens to hundreds of mid-sized B2B customers
Database per tenantEach tenant gets its own databaseEnterprise or regulated customers who demand isolation

Tip: Start with a shared database and enforce tenant filtering centrally (for example PostgreSQL row-level security or a repository layer that always adds tenant_id). Forgetting one filter is the classic SaaS data leak.

Authentication, roles and permissions

B2B SaaS needs more than login. A user belongs to an organisation, may belong to several organisations, and has a role within each. Plan these from day one:

  • Organisations and invitations: an owner invites teammates by email and assigns roles.
  • Role-based access control (RBAC): roles such as Owner, Admin, Member and Viewer mapped to permissions like “invoices.create”.
  • Single sign-on later: larger customers will ask for Google Workspace, Microsoft Entra ID or SAML SSO. Using an auth provider or library that supports it saves a rebuild.
  • Security basics: hashed passwords, 2FA for admins, rate-limited login, and session expiry.

Subscription billing: plans, trials and dunning

Billing is where SaaS products quietly lose money. Model it as data, not as if-statements in code:

Subscription billing: plans, trials and dunning: 5 steps
  1. 1

    Define plans and limits: for example Starter (3 users, 1,000 records), Growth and Enterprise. Store limits in a table so you can change them without a deploy.

  2. 2

    Choose a billing provider: Stripe Billing for international customers, Razorpay Subscriptions or Cashfree for Indian cards, UPI AutoPay and e-mandates.

  3. 3

    Handle webhooks: payment succeeded, payment failed, subscription cancelled. Your app should update access based on these events, not on the checkout redirect.

  4. 4

    Dunning: retry failed payments, email the customer, give a grace period, then downgrade — do not delete data immediately.

  5. 5

    Invoices and tax: GST invoices for Indian customers, and VAT handling if you sell to the UAE or Europe.

The features customers expect but founders forget

  • Onboarding: an empty dashboard loses users. Add sample data, a checklist and in-app guidance.
  • Audit log: “who changed what and when” is a top request from B2B buyers.
  • Data export: CSV export and an API build trust and shorten sales cycles.
  • Notifications: email plus in-app, with user preferences.
  • Admin “super panel”: for your own team to view tenants, impersonate (with consent) for support, and manage plans.

Architecture that scales without over-engineering

A well-structured monolith (one codebase, one deployable app, clear modules) is the right start for almost every SaaS. Add a background job queue for emails, reports and integrations, a cache for heavy reads, and object storage for files. Split services out only when a module has genuinely different scaling or team needs.

From the first release, invest in automated backups, error tracking, uptime monitoring and a staging environment. These are cheap early and very expensive to add after an outage.

“Microservices solve organisational problems you do not have yet. A clean monolith gets you to product-market fit faster.”

— Umer Hasan, CTO

Topics

SaaS DevelopmentMulti-TenancySubscription BillingSaaS Architecture
Umer Hasan
Written by

Umer Hasan

Co-Founder & CTO at Zapprex

Leads engineering, cloud infrastructure and AI automation at Zapprex Technologies, with 7+ years of full-stack and mobile experience.

FAQ

Questions readers ask

A focused SaaS MVP with auth, one core workflow, billing and an admin panel typically costs ₹6–15 lakh in India. Broader platforms with integrations, mobile apps and enterprise features cost more.

Have a project in mind?

Let's build something that moves your business forward.

Share your idea, process or problem — we will come back with a clear plan, timeline and cost range. No technical spec needed.

  • Founder reply within 1 business day
  • NDA on request · 100% code ownership
  • Talk directly to the engineers