The short answer
To turn an internal tool into a SaaS, add a tenant to every record and enforce isolation in the database, move per-customer settings out of the code, add sign-up and invitations, billing and plans, an admin area for your own team, and per-tenant backup, export and deletion. Do the tenant model and isolation first, because every later feature depends on it.
On this page
A company builds a tool for itself, or for its first customer, and it works. Then someone says: “Other businesses would pay for this.” Turning it into a product is a real project. The code mostly works; what changes is everything around it: who sees what, how a new customer starts, how you run it for twenty customers instead of one.
Should you do it?
Before technical work, check the reasons:
- Do at least a few other businesses have the same problem, in roughly the same way? If every customer needs different workflows, you are building custom software, not a product.
- Can you sell and support it? A SaaS needs someone to onboard, answer questions and fix problems.
- Is the first customer happy to share? If it owns the code, agree on that first. Get legal advice on intellectual property.
If the answers are yes, continue.
What is the main change?
Multi-tenancy. A tenant is one customer account: their users, data and settings. In a single-customer tool, there is one set of data and the code assumes it. In a SaaS, many customers share the same app and database, and each must see only its own.
There are three common models:
| Model | How it works | Trade-off |
|---|---|---|
| One database per tenant | Each customer gets its own database | Strong separation, expensive to run and migrate at scale |
| Shared database, separate schemas | One database, a schema per tenant | Middle ground, migrations multiply |
| Shared tables with a tenant id | Every row has a tenant id, isolation enforced by rules | Cheapest to run, needs discipline |
For most new SaaS products we use shared tables with a tenant id and PostgreSQL row-level security, so the database refuses to return another tenant’s rows even if the application code has a bug. How to prove it works: proving tenant isolation in CI.
What is the safe order of work?
- Add the tenant to the data model. A tenant id on every table that holds customer data. Backfill the existing customer as tenant one.
- Enforce isolation in the database and test it, with a test that discovers every table so a new one without protection fails the build.
- Make the code tenant-aware: every query, every background job, every file path, every cache key, every email.
- Move customer-specific logic out. Hard-coded names, rules, prices, templates and integrations become per-tenant settings, or are removed.
- Users and roles per tenant. A user belongs to a tenant, with roles. Decide whether one person can belong to several.
- Sign-up, invitations and onboarding. A new customer can start without your developers. A first-run checklist reduces support.
- Plans and billing. Subscription states, trial, failed payments, cancellation and invoices. These are status columns with rules, so give them one transition table: status columns as state machines.
- An admin area for your team, to see tenants, support them and suspend them, with every action logged.
- Export and deletion per tenant, because customers will ask, and the law may require it.
- Operations for many customers: monitoring, backups and restores that you have tested, and deploys that do not take customers offline.
What breaks when you add the second customer?
These are the usual surprises:
- Files. Uploads stored in a shared folder with predictable names. Move them to object storage with a tenant prefix and signed links.
- Background jobs that process “all records” and now mix tenants, or that send every customer’s emails at the same time.
- Caches keyed without a tenant.
- Unique constraints that should be unique per tenant, not globally (an invoice number, a username).
- Reports and search that scan across tenants.
- Single-tenant URLs and emails, such as links built from one company’s domain.
- Settings in environment variables that really belong to a customer.
What does running it for many look like?
- Deploys have to be safe while customers are using the product: zero-downtime deploys with Docker Compose.
- Backups have to be restorable, and you have to know it: nightly backup restore drills.
- Noisy neighbors: one customer’s heavy report must not slow the others. Add limits.
- Support access: a controlled way for your staff to look at a tenant, logged.
- Upgrades: one version for everyone is the cheapest to run. Use feature flags for differences, not forks.
How do you migrate without stopping the first customer?
Use expand and contract: add the new columns first, backfill, switch the code, and remove old things only in a later release. Old and new versions of the app must both work against the same database during a deploy. We describe the rules in designing a SaaS that can move servers.
What about legal basics?
You are now a processor of your customers’ data. You will need terms of service, a privacy policy, a data processing agreement and a list of sub-processors. Have a lawyer review them. If you serve EU customers, see GDPR-compliant software.
How long does it take?
It depends on the tool and on how tangled the single-customer assumptions are. A good first step is a short review of the code that lists every place the tenant assumption lives, and an ordered plan. That list is the real estimate.
Working with us
We design and build multi-tenant SaaS platforms, and we can take an existing internal tool or single-client app and plan the move to many customers, starting with the tenant model and isolation. Describe what you have through the contact page, or see our SaaS platform work.