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.

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.

Multi-tenancy: three ways to separate customer data
| Model | How it works | Best for |
|---|---|---|
| Shared database, tenant_id column | All tenants share tables; every row has a tenant_id and every query filters by it | Most new SaaS products — cheapest and simplest to run |
| Schema per tenant | One database, a separate schema for each tenant | Tens to hundreds of mid-sized B2B customers |
| Database per tenant | Each tenant gets its own database | Enterprise 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:

- 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
Choose a billing provider: Stripe Billing for international customers, Razorpay Subscriptions or Cashfree for Indian cards, UPI AutoPay and e-mandates.
- 3
Handle webhooks: payment succeeded, payment failed, subscription cancelled. Your app should update access based on these events, not on the checkout redirect.
- 4
Dunning: retry failed payments, email the customer, give a grace period, then downgrade — do not delete data immediately.
- 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.”
Topics
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.
Keep reading
All articlesShopify App (Plugin) Development Tutorial: Build, Test and Publish Your First Shopify App
A beginner-friendly tutorial for building Shopify apps: public vs custom apps, setting up with Shopify CLI, the Admin GraphQL API, theme app extensions, webhooks, billing and App Store review requirements.
Custom ERP vs Odoo vs Zoho: Which Is Right for Your Growing Business?
Off-the-shelf ERPs are fast to start but can become expensive and rigid as you grow. A practical comparison of Odoo, Zoho and custom ERP — and a simple framework to decide.
How to Build a SaaS MVP in 8–12 Weeks: Scope, Tech Stack and Budget
Most SaaS MVPs fail from building too much, not too little. A practical week-by-week plan for scoping, building and launching a SaaS product that real customers will pay for.
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.
There is no single best stack. React or Next.js on the frontend with Node.js, Python or Laravel and PostgreSQL on the backend is a proven, hireable combination for most SaaS products.
Usually not at the start. A shared database with strict tenant filtering is cheaper and easier to operate. Offer dedicated databases later as an enterprise add-on if customers require it.
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
