← All work
Case 03Tenancy and authorization

Northgate

Multi-tenant isolation and a real authorization model for a platform that had been checking permissions with if-statements and hope.

ClientB2B compliance SaaS
Year2024
RoleArchitect + backend lead
Engagement5 months

01 — The problem

Enterprise deals kept stalling at security review. Tenant data shared a schema with no enforced boundary, permissions were scattered across two hundred inline checks, and every new role meant a release. One shared-scope bug away from a very bad week.


02 — What I did

Introduced per-tenant isolation at the data layer with row-level security and a request-scoped tenant context that is impossible to forget to set.

Replaced inline checks with a centralised relationship-based policy engine, so roles became configuration and audits became a query.

Built the migration behind a dual-check shadow mode: the new engine ran alongside the old logic for six weeks, and every disagreement was a ticket.

Produced the architecture documentation their prospects’ security teams actually ask for.

Fig. 1 — the system as designed
Fig. 2 — the system in production

Our security questionnaire went from a quarterly project to a paragraph and a link.
Chief technology officer, B2B compliance SaaS

03 — Outcome

3 wks

Average security review, from three months

200+

Inline permission checks retired

2

Enterprise deals unblocked in the first quarter


04 — What I left behind

Roles as configuration, so a new customer tier ships without a release.

An audit query that answers "who could see this?" in one line.

The architecture document enterprise security reviews actually ask for.

Stack
TypeScriptPostgres RLSOPANodeTerraformAuth0

TidelineAll work
Next case — 04 / 2023

Cadence

Constraint-based dispatch for 900 field technicians, re-solved on every event.

Read the case →

Got a system that needsdesigning properly this time?

Contracts from six weeks. I read every enquiry myself and reply within two working days, usually with an awkward question about your data model.

Start an enquiryjoey@startupapps.shopGitHubMedium