Most SaaS builds break at the second tenant, when it turns out one customer can reach another's data, or billing was bolted on at the end. We build the isolation model, the permission system and the subscription billing first, then the product on top, because those three are the expensive things to retrofit. This is the work whether you are starting from a blank repository or from an MVP that proved the idea and now cannot take a serious customer.
Tenant isolation and billing, right the first time.
B2B SaaS with tenant isolation, role-based access and Stripe billing built first. Those are the parts that decide whether customer number two is safe to onboard.
One customer's data is one missing query filter away from another customer's screen
Billing was an afterthought, so every plan change is a manual database edit
The MVP proved the idea and now cannot take a second serious customer
Enforced in the data layer with row-level security, not by remembering to add a WHERE clause.
Stripe plans, upgrades, proration, failed payments and dunning, wired in rather than stubbed.
JWT, OAuth, Clerk or Supabase Auth, with roles and permissions that hold up under audit.
Self-serve tenant signup plus the internal console your team needs to support them.
A tight, low-risk path from first call to something running in production.
How tenants are isolated and billed, settled before any code is written.
Auth, tenancy and billing first. These cannot be bolted on later.
Features built on a foundation that already holds under a real load.
Automated tests on auth and billing, monitoring, and a live deployment.
Auth, billing, and anything touching money. Those fail in CI, not on a customer's invoice.
Architecture notes, setup instructions and a deployment runbook. Written, not promised.
Because ops teams always need the data out, and always need it sooner than you planned.
In your repository, from the first commit. No license, no lock-in, no hostage situation.
These get made once, usually in the first fortnight, and every one of them is expensive to revisit after you have customers. This is what we work through before anybody writes a feature.
A shared schema with a tenant column and PostgreSQL row-level security covers most B2B products and keeps operations simple. A schema per tenant buys harder separation and costs you a migration that has to run everywhere, every time. A database per tenant is what a regulated buyer occasionally writes into a contract, and it rewrites your backup, deploy and cost story at once.
Roles belong to a tenant rather than to a person, and the same person can hold different roles in two tenants. Products that miss this end up with an admin in one workspace who is quietly an admin everywhere. The check also has to run on the server on every request, because a hidden button is a preference rather than a rule.
Most billing bugs are not in the happy path. They are in proration on a mid-cycle upgrade, in the dunning window after a failed charge, and in the webhook that arrives twice or arrives an hour late. Your database and Stripe will disagree at some point, so the question is which one wins and how the other catches up.
Signup looks trivial until you count what has to happen atomically: the tenant record, the first admin, the default roles, the plan or trial, the seed data, and any external accounts you provision. Half-created tenants are the most common support ticket in an early SaaS, and they are cheap to prevent and tedious to clean up.
Somebody on your team will need to see what a customer sees in order to help them. Impersonation that is logged, scoped and reversible is a feature you design in; impersonation bolted on later arrives as a shared admin login and a note in a spreadsheet. The audit trail is the part that matters when someone asks who looked.
Per-tenant background jobs, noisy-neighbor queries, exports large enough to time out, and a migration that now takes an hour. None of this bites at three customers. All of it bites around the point the business starts working, which is the worst possible moment to learn the architecture cannot carry it.
Many customer organizations share one deployment while their data stays strictly separate. Done well, you add a customer without adding infrastructure. Done badly, one missing filter shows Acme's records to Globex, which is the kind of incident that ends a B2B product before it starts.
Usually a shared schema with a tenant column and PostgreSQL row-level security, so the database enforces isolation rather than every developer remembering a filter. Where a contract or a regulator demands harder separation, we use a schema per tenant, and we will say what that costs you to run.
One price for a first production version with tenancy, auth, billing and the core product, agreed at discovery and written down before you sign. That version typically takes four to eight weeks. Adding Stripe billing to something you already have is a much smaller piece.
Frequently, and it is one of the most common ways clients arrive. Builds from Lovable, Replit or Bubble that proved the idea and then stalled. Half-finished contractor projects. We read the code, tell you honestly whether to extend or rebuild, then do the work either way.
Both. Stripe subscriptions, plan changes, proration, failed payments, and the webhooks that keep your database in step with Stripe. Billing paths get automated tests, because anything touching money should fail in CI rather than on a customer's invoice at the end of the month.
Usually the simplest thing that meets the requirement, which is often a managed database and one container. We can run AWS with Terraform and Kubernetes when the load justifies it, and we will tell you plainly when it does not, even though the cluster is the bigger invoice.
Sooner than most teams expect, because we build the parts that block paying customers first. Tenancy, authentication and billing come before features, so the moment the core product is usable it is also chargeable. What delays a first customer is discovering billing has to be rebuilt.
Describe what you’re building, what it has to do and when it needs to be live. You’ll get back the architecture we’d use, the trade-offs, and a realistic timeline, before anything is signed.