smaple.tr
Backend & APIs

SaaS Application Development: What to Decide First and What Can Wait

Mehmet Kurtipek
November 12, 2025
16 min read
Backend & APIs
SaaS
Multi-tenancy
Subscription billing

SaaS application development means building software that you host and sell by subscription, so besides the features customers pay for, you also build the machinery that carries them: a separate space for each customer organization (a tenant), sign-in and roles, billing, an internal admin panel, integrations with your customers' systems, and a way to ship updates to everyone at once. That machinery takes a large share of a first release. Three parts of it are expensive to change later: how tenant data is kept apart, how users and organizations are modelled, and where the data is stored. Decide those first, and keep everything else simple until paying customers ask for more.

We have been the engineering team for Oplist, a client whose SaaS builds shift rosters for hospital departments, since November 2023. From June 2020 we built Planard, a budgeting and financial-planning SaaS, starting from its founders' requirements document. Most of the examples below come from those two products.

What a SaaS app needs besides its features

A web app built for one company can get by without most of this list. A SaaS product can't:

  • a separate space per customer organization, so one company's users, data, settings and files never appear in another company's account
  • sign-up, invitations, roles inside each organization and password resets, and later single sign-on for larger customers
  • plans, trials, upgrades and downgrades, failed card payments, invoices, and sales tax or VAT
  • an internal back office where your team can find a tenant, see its plan and usage and fix data, with every action logged
  • imports from and exports to the systems your customers already run
  • automated tests and deploys, database migrations that don't break the running version, monitoring you can filter by tenant, and backups you have actually restored

In a B2B product the tenant is usually the customer company, but not always. Microsoft's guide to tenancy models points out that one customer may need several tenants, for example one per division or country, or separate development and production environments. Keep the tenant table separate from your customer and billing records, so that one paying customer can own more than one tenant.

Keeping tenants apart

This is the hardest of the three to reverse, because changing it means moving every customer's data. There are three common designs:

Design

What keeps tenants apart

Cost of one more tenant

Operating it

Shared database, tenant_id on every row

Application code plus database policies

Close to zero

One schema, one migration path

A schema or database per tenant

Database boundaries

Low to moderate

Every migration runs once per tenant

A separate deployment per tenant

Separate infrastructure

High

Many copies to update and monitor

The same Microsoft guide states the trade-off plainly. Dedicated infrastructure lowers the risk of leaks and of one tenant slowing down the others, but if one tenant needs a certain infrastructure cost, a hundred tenants probably need a hundred times that. A fully shared design is the cheapest to run, and a mistake in it reaches everyone.

For a new B2B product, start with the shared database and a tenant_id column, and put PostgreSQL row-level security (RLS) behind the application's own filters as a second line of defence. Offer a dedicated database or deployment later, as a priced option for customers whose compliance team insists on it. If that might happen, add a small lookup from tenant to database (or deployment) on day one, even while every tenant still uses the same one. Retrofitting that routing into a codebase that assumes a single database is the expensive part.

A minimal RLS setup looks like this:

-- The application connects as this role. It owns no tables, so RLS applies to it.
CREATE ROLE app_user LOGIN;
GRANT SELECT, INSERT, UPDATE, DELETE ON invoices TO app_user;

ALTER TABLE invoices ENABLE ROW LEVEL SECURITY;
ALTER TABLE invoices FORCE ROW LEVEL SECURITY;  -- the owner is filtered too

CREATE POLICY tenant_isolation ON invoices
  USING (tenant_id = current_setting('app.tenant_id')::uuid);

-- In every request, as app_user, inside its own transaction:
BEGIN;
SELECT set_config('app.tenant_id', '3f2b6c1e-8d4a-4f7e-9b1a-2c5d7e9f0a13', true);
SELECT * FROM invoices;  -- only this tenant's rows come back
COMMIT;

A few details decide whether this protects anything. The PostgreSQL documentation says table owners skip RLS unless the table has FORCE ROW LEVEL SECURITY, and superusers and roles with BYPASSRLS always skip it. So the application connects as a role like app_user that owns nothing, and FORCE is the backstop for anything that connects as the owner by mistake. That also means data backfills and cross-tenant reports need their own role with BYPASSRLS, which never serves user requests.

Set the tenant ID with set_config(..., true), which lasts only until the transaction ends. With a connection pool, a session-level setting can carry one tenant's ID into the next request that reuses the connection. If the ID is missing, current_setting or the cast to uuid raises an error, so the query fails instead of returning rows, which is the failure you want. Because the policy has no separate WITH CHECK, the same condition also applies to inserted and updated rows, so a request can't write a row into another tenant either.

The database is only one place where tenants can leak into each other. File storage paths, cache keys, search indexes, background jobs, exports and log lines all need the tenant ID too. For every endpoint, write an automated test that signs in as a user of tenant A and requests a record that belongs to tenant B by its ID. It should get a 404 every time.

Heavy work belongs in a queue or a separate service. Oplist's rosters come from optimization models solved by a MILP solver, and the solver runs as its own Python service next to the Node.js API, so a long solver run doesn't compete for the process that serves every hospital's managers. Per-tenant rate limits belong in the first version for the same reason: without them, one customer's runaway import script slows down everyone else.

Users, organizations and roles

Model membership as its own table: a user can belong to several organizations and hold a different role in each. Consultants, group companies and your own support staff break the "one user, one company" assumption quickly. Planard has a multi-company setup with roles and approval flows. In Oplist we added organizations, roles and approval workflows in which managers review and approve the generated rosters.

In a product like that, permissions are tied to a unit: who may approve the roster for which department. So the code should ask about permissions instead of role names, can('roster.approve', department) instead of role == 'manager'. Roles then become lists of permissions that a tenant can adjust later without a code change.

Unless identity is your product, don't write password storage, resets and two-factor authentication yourself. Use a managed identity provider or your framework's mature auth library. Enterprise single sign-on (SAML or OpenID Connect) and automatic user provisioning (SCIM) can wait until the first larger customer asks. What you need on day one is a schema where a tenant can later be switched to "SSO required".

Keep an audit log from the start: who changed what, in which tenant, and when. Support needs it and security questionnaires ask about it. In a rostering product whose data feeds payroll, it is also how you answer "who changed this shift?".

Where the data lives

Choose the hosting region before the first customer signs. Moving later is a data migration for every tenant at once.

For the personal data your customers put into the product, you are usually the processor and they are the controller. Under the GDPR, each business customer will want a data processing agreement and a list of your sub-processors: the cloud provider, the email service, error tracking, any LLM API. Keep that list current from the first day; rebuilding it during a customer's security review is slow. If you sell into Türkiye, its data protection law, KVKK, has separate rules for transferring personal data abroad, and hosting outside the country counts as a transfer.

Larger customers will send a security questionnaire, and some will ask for a SOC 2 report. A Type 1 report looks at how your controls are designed at one point in time; a Type 2 report covers how they actually operated over a period, so its clock starts only once the controls exist. The first controls are unglamorous: pull requests reviewed before they merge, access removed the day someone leaves, and backups that have been restored in a test.

Billing: buy the engine, keep your own logic thin

There are two ways to take subscription payments:

  • A billing platform, with you as the seller. Stripe Billing costs 0.7% of billing volume on its pay-as-you-go plan, on top of card processing (2.9% + 30¢ per successful domestic card charge in the US). Sales tax and VAT registrations are your job.
  • A merchant of record, which resells your product to the customer and handles tax for you. Paddle charges 5% + 50¢ per transaction.

The higher fee buys you out of tax work, and for a product sold to consumers or small businesses in many countries that work is real: VAT on digital services sold to EU consumers is due in each customer's own country. For a handful of large B2B contracts invoiced yearly, a billing platform plus a good accountant usually costs less.

Whichever you pick, the rules on your side are the same:

  1. Treat payment events as unreliable messages. Stripe's webhook documentation says the same event can arrive more than once, events are not delivered in order, and failed deliveries are retried for up to three days. Store the IDs of events you have processed, fetch the current object from the API before acting on it, and process events from a queue.
  2. Check entitlements instead of plan names. limits.departments and features.sso survive a pricing change; if plan == 'pro' does not, and enterprise deals nearly always end up needing per-tenant overrides.
  3. Decide what a failed payment does: a grace period, then read-only access. Never delete data because of a billing event.
  4. Mirror subscription status in your database for fast checks, and keep the billing provider as the source of truth for money.

How to choose between per-seat, tiered and usage-based plans is covered in our post on SaaS pricing models.

Integrations are part of the product

Business customers rarely start with an empty account. Their staff lists, catalogs and history live in systems they already run, and they want results sent back there. Oplist has live API integrations with the HR and payroll systems of private hospitals in Türkiye, with more on the way. Through them it receives leave reasons and types: sick leave and other reasons, hourly leave, and block leave such as training. The scheduling rules depend on the type, so a plain "unavailable" would not be enough.

The incoming data needed work. The hospitals' systems can contain duplicate staff records, and some leave types take precedence over others when they overlap. We handle both inside Oplist, deduplicating staff and applying a precedence order to leave, instead of trusting each record as it arrives.

Whatever your product, plan for the same pieces: a connector per tenant with its own credentials, field mapping and schedule; imports that can be re-run without creating duplicates; validation that rejects a bad record and says why; and a screen where the customer's admin can see what was rejected. Each integration is a small project that has to be tested against the customer's real data, so estimate it that way. Sometimes the integration a customer needs is a spreadsheet: one of the things we added to Oplist was a Google Sheets add-on.

Choosing a stack

Use what your team already runs well. Our two examples use different stacks, and both work. Oplist is a React front end and a Node.js/Express API on PostgreSQL, plus the Python solver service, on AWS (ECS Fargate, Lambda and CloudWatch). Planard is an Angular front end on a .NET Core Web API with an identity service, PostgreSQL, and Azure hosting. Both are built around one main API on PostgreSQL, and in Oplist the solver, which does a different kind of work, runs on its own.

Start with a modular monolith, a single deployable application with clear internal modules such as tenants, billing and the core domain. Split a module out when its scaling or release needs really differ, the way a solver's do. With microservices on day one, a team of a few people has to pass tenant context between services and keep several deploys in step before the product has a single paying customer.

If the product calls an LLM API, treat the provider as a dependency that will fail. An n8n workflow we built with an agency partner for an oilfield-services company has processed about 100 documents a day since September 2025. Most of its breakages were LLM API rate limits (HTTP 429), and falling back to alternative models fixed them. In a SaaS, also cap LLM usage per tenant, so one heavy customer can't use up the quota for everyone else.

What the first version should include

The first paid version needs fewer features than founders expect, and more plumbing. Put these in:

  • the one workflow customers pay for, done properly
  • tenant isolation, with the cross-tenant tests
  • sign-up or invitations, and two or three fixed roles
  • payments, or manual invoices for the first few customers
  • an audit log, error monitoring and tested backups
  • a basic back office for your own team

These can wait until a paying customer asks: SSO and SCIM, a custom role editor, usage-based pricing, a public API, dedicated deployments, white-labelling and multiple regions. Our MVP development guide goes further into scoping, timelines and the monthly rate we quote for mobile work.

Shipping updates to every customer at once

Everyone runs the same version, so a bad release reaches all tenants together. A few habits keep that manageable:

  • Expand-and-contract migrations: add the new column or table, deploy code that writes to both, backfill, switch reads over, and drop the old structure in a later release. Never ship a migration that the previous version of the code can't run against.
  • Feature flags per tenant, so a change reaches a few friendly customers before it reaches everyone.
  • A per-tenant export. In a shared database, getting one tenant's data back from an ordinary backup means restoring the whole database somewhere else and copying that tenant's rows out. Procurement teams will ask how a customer gets its data out anyway.
  • Logs, metrics and traces tagged with the tenant ID, so a complaint that "it's slow for us" can be checked.

What drives cost and timeline

A quote for SaaS work is months of effort times a team's monthly rate, plus running costs such as hosting, billing fees, email, monitoring and LLM usage. These are what add months:

  • each integration with a customer's system
  • regulated data, such as health or financial records
  • approval workflows and permissions scoped to units
  • usage-based billing
  • enterprise requirements: SSO, audit exports, dedicated deployments

AI coding tools have made writing the code faster. The iOS app we built for a Finnish property-search platform took about a month; My3PL's web and mobile apps, built before we used these tools, took about six months. The scopes were different, so don't read that as a fixed ratio. The tools also don't make the decisions in this post for you or clean up a customer's data, so don't expect a SaaS estimate to shrink by the same factor.

Budget for the years after launch, too. We are still shipping web-app and solver releases with Oplist in 2026, and Planard kept gaining features, among them actuals, cost narratives and asset amortization, until late 2024. Plan for development to stay a monthly cost for as long as you sell the product. Once revenue starts, MRR, churn and net revenue retention tell you whether it's working; our SaaS metrics guide shows how to calculate them.

Building it in-house or with a team

If you have a technical co-founder who has run a production system before, build in-house and get outside help for specific pieces such as billing or a security review. If you don't, work with a team that has run a SaaS in production, and ask them three things: how they would isolate tenants, how they ship database migrations, and whose name the source code and cloud accounts will be in.

If you'd like a second opinion on these decisions for your own product, you can reach us here.

Frequently asked questions

Can I turn a single-tenant app into a multi-tenant SaaS later?

Yes, but it touches every table and every query. You add a tenant_id to each table that holds customer data and backfill it, then change unique constraints and indexes to include it: an email address or invoice number is usually unique within a tenant, not across the whole database. Caches, file paths and background jobs need the tenant too. Turning on RLS early in that work helps, because a query that forgets the tenant filter still only sees the current tenant's rows, and a code path that never sets the tenant fails loudly.

Should each tenant get its own subdomain?

It is useful for branding, and later for sending a tenant to a dedicated deployment, but don't let the subdomain alone decide which tenant a request belongs to. If users can belong to several organizations, one sign-in page with an organization switcher is simpler, and the server takes the tenant from the user's membership. Subdomains also bring wildcard TLS certificates and cookie-scope decisions, and custom domains for each customer add certificate issuance on top.

Should I start from a SaaS boilerplate?

It can save weeks on sign-in, billing pages and an admin shell. Before you adopt one, check how it models tenants, memberships and roles, because that is the part that is expensive to change later. If it ties each user to exactly one account, or keeps tenant filtering only in scattered queries, you will be rewriting its core within months.

Related Articles

August 1, 2026

Kong vs Traefik vs AWS API Gateway: How to Choose

Kong, Traefik and AWS API Gateway compared as of October 2026: features, licensing, Kubernetes support and what AWS charges for 100 million requests a month.

Read More: Kong vs Traefik vs AWS API Gateway: How to Choose
July 4, 2026

gRPC vs REST for Microservices: When gRPC Is Worth It

When gRPC beats REST between services, what it adds to your operations (load balancing, deadlines, browser access), and what our own protobuf vs JSON test showed.

Read More: gRPC vs REST for Microservices: When gRPC Is Worth It
March 14, 2026

RPA Implementation: From Process Choice to Bots That Keep Running

Most of an RPA implementation is choosing the process and designing for exceptions. The order we work in, current license prices, and what broke in the n8n and LLM automation we built with an agency.

Read More: RPA Implementation: From Process Choice to Bots That Keep Running