SaaS Development

SaaS Products Built to Handle Tenants, Billing and Growth

A SaaS product has to do more than let users sign up and pay. It needs a dependable way to keep each customer's data separate, decide who can do what, keep billing in sync with what people can access, and stay easy to change as features pile up. Those decisions are far cheaper to get right before the first hundred customers arrive.

What is SaaS development?

SaaS development is the engineering of software sold as a subscription and delivered over the web, where many customer organisations (tenants) share one running application. Beyond the product features, it covers tenant isolation, account and team management, authentication, plans and billing, and the infrastructure to serve every tenant reliably from a single codebase.

Who it's for

  • Founders turning a validated idea into a paid, multi-customer product
  • Agencies or consultancies productising an internal tool they already sell as a service
  • Teams whose early prototype handles one customer well but breaks with ten
  • Companies adding team accounts, usage-based plans or an enterprise tier to an existing app

Problems it solves

  • Customer data stored without a tenant boundary, so one bad query could leak another account's records
  • Billing and access drifting apart: users who cancelled still have access, or paying users get locked out
  • Permissions hard-coded per screen, making every new role a code change across the app
  • A database schema that worked for the MVP but slows down as tenants and rows multiply
Scope

What can be delivered

  • Tenant-aware data layer

    Schema, queries and middleware that scope every read and write to the current organisation.

  • Auth and team management

    Sign-up, login, SSO where needed, invitations, and organisation switching for users in several workspaces.

  • Plans, billing and entitlements

    Subscription integration with a payment provider, webhook handling and a single place that decides what each plan can use.

  • Role-based access control

    Roles and permissions defined as data, enforced on the API rather than only hidden in the UI.

  • Admin and support tooling

    Internal screens to look up tenants, adjust plans and investigate issues without direct database access.

  • Deployment and observability

    CI/CD, environments, logging and alerting so issues surface before customers report them.

Technical approach

Choosing a tenancy model

There are three common ways to isolate tenants, and the choice shapes everything from migrations to pricing.

Multi-tenancy models compared
ModelIsolationOperational costGood fit
Shared tables with tenant_idLogical, enforced in code or row-level securityLowestMost B2B SaaS, especially early
Schema per tenantStronger, separate tables per customerMedium: migrations run per schemaModerate tenant counts with some customisation
Database per tenantStrongest, physical separationHighestEnterprise or regulated customers who require it

For most products I start with shared tables and a tenant_id on every tenant-owned row, enforced centrally in a NestJS request context so individual queries can't forget it. PostgreSQL row-level security can add a second guard at the database level. A hybrid, where a few large customers get dedicated databases, can be added later if contracts demand it.

Billing as a source of truth, not an afterthought

Payment providers such as Stripe own the subscription state, and your app learns about changes through webhooks. The handler has to verify the signature, tolerate duplicate and out-of-order events, and record each event ID so it is processed once. From those events the app maintains entitlements: a per-tenant record of plan limits and features. Feature checks read entitlements, never the raw plan name, so changing pricing doesn't mean hunting through the codebase.

Roles, data and scale

Roles are stored as data with a permission set, checked by guards on each API route, so adding a "billing admin" role is a configuration change. On the data side (database design matters here), composite indexes that lead with tenant_id, Redis caching for hot read paths, and moving heavy work such as exports and emails into background queues cover most growth. My write-up on SaaS architecture with Next.js and NestJS goes deeper on these patterns, and if you need enterprise sign-on, that is covered under enterprise software.

Technology

Technologies for SaaS Development

Application

  • Next.js
  • React
  • NestJS
  • Node.js
  • TypeScript

Data

  • PostgreSQL
  • Prisma
  • TypeORM
  • Redis

Billing & auth

  • Stripe
  • OAuth 2.0
  • OpenID Connect
  • JWT
  • Auth0
  • RBAC

Background work

  • Bull Queues
  • GCP Pub/Sub
  • WebSockets

Delivery

  • Docker
  • GCP Cloud Run
  • GitHub Actions
  • Pulumi
Process

How the work runs

  1. 01

    Shape the tenant and plan model

    Agree what a tenant is, which roles exist and what each plan includes before writing code.

  2. 02

    Build the platform skeleton

    Auth, organisations, roles and billing webhooks first, so every feature after it is tenant-aware by default.

  3. 03

    Ship the core product loop

    Deliver the one workflow customers pay for, with weekly demos and real accounts on staging.

  4. 04

    Harden for paying customers

    Add monitoring, rate limits, backups and admin tooling before opening sign-ups widely.

  5. 05

    Iterate on usage

    Use product analytics and support tickets to decide what to build next and what to cut.

Trade-offs

Decisions worth making early

  • Tenancy is hard to change later

    Moving from shared tables to per-tenant databases after launch is a migration project. Decide early, with your likely customers in mind.

  • Pricing will change

    Entitlements decoupled from plan names let you experiment with pricing without redeploying feature code.

  • Usage-based billing adds work

    Metering usage accurately needs event recording, aggregation and reconciliation with the payment provider.

  • Don't overbuild the MVP

    SSO, audit logs and custom domains can wait until a customer actually needs them. See shipping an MVP in six weeks.

Related work

Projects involving this work

From my portfolio. Descriptions are the same as on the projects page.

  • Instantly.ai preview

    Web

    Instantly.ai

    B2B CRM for cold-email outreach with AI-powered personalization, deliverability and warm-up. Built core CRM modules, AI prompt tooling and real-time updates.

    • Next.js
    • NestJS
    • OpenAI
    • WebSockets
    • Postgres
    View product
  • TADCO Work preview

    Web

    TADCO Work

    Workforce-management platform for businesses to streamline operations, projects and productivity.

    • Next.js
    • NestJS
    • Postgres
    View product
  • All projects
Further reading

Related articles

Related services
  • Custom Software

    API Development & Integration

    Well-documented REST and GraphQL APIs and dependable third-party integrations, with proper auth, versioning, rate limits, webhooks and idempotency.

  • Custom Software

    Database Development

    Schema design, indexing, query tuning, safe migrations and backups across PostgreSQL, MongoDB, SingleStore and Redis, chosen to fit your access patterns.

  • Custom Software

    Enterprise Software

    Internal and customer-facing systems for larger organisations: SSO, fine-grained access, audit trails, legacy integration and phased modernisation.

  • Web Development

    Next.js Development

    Next.js apps and sites on the App Router with Server Components and deliberate caching, built for crawlable pages and fast loads.

FAQs

Usually not at the start. Shared tables with a tenant ID, enforced centrally, are simpler to run and migrate. Separate databases make sense when specific customers contractually require physical isolation, and a hybrid model can serve both.