Skip to content
Nizar Abubaker
Build

A multi-tenant SaaS platform, from first commit

Designing and building a multi-tenant SaaS product on Node.js and PostgreSQL — tenancy, billing hooks, permissions and a deployment pipeline small teams can live with.

Client
Product / company name
Role
Architect & lead engineer
Year
2021 — Present
Industry
Technology
Status
Live
Time to first release
N weeks
Tenants
N

01The challenge

A promising idea, a short runway, and a requirement that the first version be able to serve many organisations without rewriting later.

02The approach

A modular monolith with tenancy enforced at the data layer, a typed API shared with the web app, and infrastructure as boring as possible: containers, Postgres, one pipeline.

03Architecture

NestJS API with row-level tenant isolation in PostgreSQL, Next.js frontend, background jobs for anything slow, and feature flags for staged releases.

04My contribution

Architecture, most of the early code, and the engineering practices the team grew into.

The most important architectural decision was what not to build: no microservices, no custom auth, no Kubernetes on day one. Each of those can be added when a real constraint appears — and each would have cost weeks we did not have.

tenant-isolation.sqlsql
-- Tenancy enforced by the database, not by remembering a WHERE clause
ALTER TABLE invoices ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON invoices
  USING (tenant_id = current_setting('app.tenant_id')::uuid);

Row-level security as a safety net under the application layer.

Built with

  • Node.js
  • NestJS
  • Next.js
  • PostgreSQL
  • Redis
  • Docker

Outcome

Outcome — tenants, revenue, uptime, time from idea to launch

01Build2022

A consumer mobile app and the backend behind it

A mobile product and its Node.js backend — APIs designed for flaky networks, push notifications and an admin console for the operations team.

Client
Client or product name
Role
Technical lead

Read the case study