←BaldanAll skillsLet's talk

Web, SaaS & Mobile · SaaS anatomy

Inside a SaaS, one click at a time.

A SaaS is one system serving many companies at once, each with its own people, permissions, plan and data. Use the product below as different people in different companies, and watch what the backend does with every click.

01 · The sandbox

Faktur: a tiny invoicing SaaS, with the lid off.

Two companies on different plans, eight people with five roles. Sign in as anyone, then create, approve, delete, export, invite, upgrade or switch language. Try things your role or plan doesn't allow, and try to read the other company's data.

Sign in as

Toko MakmurFree

Nusa LogistikPro

faktur.app/makmur/invoices

Faktur

3 / 5 faktur bulan iniFree

Warung Sari INV-1001

Rp 1.250.000 · disetujui

Kios Jaya INV-1002

Rp 480.000 · draf

Toko Baru INV-1003

Rp 2.100.000 · draf

Behind the scenes

GET /api/invoices

200 OK
  1. Session ✓

    session verified: Budi, manager

    { "sub": "u2", "tenant": "makmur", "role": "manager", "plan": "free", "lang": "id" }
  2. Tenant ✓

    tenant = makmur, taken from the session, never from the request

    const tenantId = session.tenant // "makmur"
  3. Permission ✓

    manager has invoice.view

    can("manager", "invoice.view") // true
  4. Database ✓

    3 invoices for Toko Makmur; other companies' rows never leave the database

    SELECT * FROM invoices
    WHERE tenant_id = 'makmur' AND deleted_at IS NULL
    ORDER BY created DESC
  5. Response ✓

    200 OK

response body

3 invoices

Every button works for everyone on purpose: click one your role or plan doesn't allow and watch where it stops.

Fictional companies and invoices, simulated payments; everything runs and stays in this browser tab. The same rules a production SaaS enforces on the server are applied here in the same order.

02 · Roles & permissions

Who may do what.

Roles bundle permissions; every request checks one. Pick a role to see what it can do.

Permission
See invoices invoice.view✓✓✓✓✓
Create invoices invoice.create✓✓✓✓–
Approve invoices invoice.approve✓✓✓––
Delete invoices invoice.delete✓✓–––
Export to CSV invoice.export✓✓✓––
See the team team.view✓✓✓✓✓
Invite people team.invite✓✓–––
Read the audit log audit.view✓✓✓––
Change the plan billing.manage✓––––

This exact table drives the sandbox above. In production it lives in one place on the server, and every endpoint asks it before doing anything; the screen only hides buttons as a courtesy.

03 · Plans & limits

What each plan unlocks.

Plans are limits and feature flags read from one place. The sandbox enforced these on every click.

to start

Free

  • Invoices per month5
  • Seats3
  • CSV export–
  • Audit logrecorded, not readable
  • Single sign-on–
  • Supportcommunity

most teams

Pro

  • Invoices per month200
  • Seats25
  • CSV export✓
  • Audit log✓
  • Single sign-on–
  • Supportemail, next day

large companies

Enterprise

  • Invoices per monthUnlimited
  • SeatsUnlimited
  • CSV export✓
  • Audit log✓
  • Single sign-on✓
  • Supportdedicated

Limits are numbers in one config, not code scattered across the app: the sandbox checks usage against them on every write, and feature flags read the plan on every request. Upgrading changes the config row, so new limits apply on the very next click.

04 · Tenant isolation

Three ways to keep customers apart.

The most important promise a SaaS makes: one customer never sees another's data. There are three common ways to keep it, each with its own cost.

01

Shared tables

Company ACompany BOne appOne databasetenant_id on rowsGET /invoices
1/4

Company A asks for its invoices.

02

Schema per tenant

One apppicks a schemaschema acmeschema globexschema initechsearch_path = acme
1/3

The app switches to the tenant's own schema in the same database.

03

Database per tenant

Routertenant → databasedb_acmedb_globexdb_bankown region, own keysacme
1/3

The app looks up which database belongs to the tenant.

Shared tablesSchema per tenantDatabase per tenant
Isolationgood, if no query forgets the filterbetter: separate tablesstrongest
Cost per tenantlowestmediumhighest
Adding a tenantinsert one rowcreate a schema + migrateprovision a database
Reporting across tenantseasy: one queryharder: union across schemashardest: needs a warehouse
Typical formost SaaS productsB2B with a few hundred customersenterprise, banks, regulated data

The sandbox uses shared tables: every query you saw ends in WHERE tenant_id = …, which is why “open another company's invoice” found nothing. Many products mix models, keeping most customers on shared tables and moving the largest to their own database.

05 · Unit economics

The numbers a subscription business lives by.

Recurring revenue only grows until churn catches up. Move the sliders to see where your ceiling is and whether each customer pays back what it cost to win.

Rp 0kRp 108.0mRp 216.0mceiling: churn cancels growthstartmonth 6month 12month 18month 24

MRR after 12 months

Rp 61.2m

MRR after 24 months

Rp 103.7m

ARR at month 24

Rp 1.24bn

Ceiling (MRR)

Rp 200.0m

where new customers = churned customers

Lifetime value

Rp 5.0m

a customer stays about 33.3 months

LTV : CAC

5.6 : 1

Payback

6 months

Your inputs, simple formulas: customers next month = customers × (1 − churn) + new; lifetime value = price ÷ churn; payback = CAC ÷ price. Revenue only, before costs, upgrades or discounts. A rule of thumb often quoted for healthy SaaS: LTV at least 3× CAC and payback within 12 months. Try halving churn: the ceiling doubles.