SaaS platform · CRM

Multi-tenant SaaS CRM

A CRM where every company gets its own isolated workspace, covering contacts, deals, leads, invoices, tickets, marketing, telephony and automation.

Role
Architecture and full-stack engineering
Platforms
Web app · API
Stack
TypeScript · Hono · Cloudflare Workers · React 19 · Vite · Supabase Postgres · Cloudflare R2
  • Multi-tenant architecture
  • Postgres RLS
  • RBAC
  • Payment idempotency
  • Design systems
  • Edge APIs
CRM deals pipeline and an invoice with its payment event log

Product screens with sample data. Names and figures inside the screens are illustrative.

01

The problem

One codebase serves many companies at once, each with its own members, roles, data and billing. The hard requirement: no workspace can ever read another workspace's records, whatever happens in the interface.

~100
Database tables
25+
Product modules
RLS
Isolation enforced in Postgres
02

What I built

01

A pipeline teams actually live in

Deals, contacts, leads and tickets share one consistent workspace, built from a single-source component library so every module looks and behaves the same.

Kanban board of deals by stage with forecast totals
02

Permissions as data, enforced in the database

Role-based access through workspace-role permission sets, backed by row-level security. The UI hides what you can't do; Postgres refuses it.

  • Per-module view, create, edit, delete and export
  • Record scope: own, team or workspace
  • Tenant isolation on every query
Roles and permissions matrix for a sales manager role
03

Onboarding that sets up a whole company

A multi-step workspace wizard with cascading country, state and city selects, localisation and monthly or yearly plans.

Workspace setup wizard with cascading region selects
04

Payments that survive retries

Invoices record every payment event. A redelivered webhook is recognised by its event id and ignored, so a retry never becomes a second charge.

Paid invoice with an idempotent payment event timeline
03

Key decisions

  1. Schema first, screens second

    Roughly 100 tables across 25+ modules with workspace-level isolation, soft deletes and numbered, idempotent migrations.

  2. Edge-first API

    A Hono and TypeScript API on Cloudflare Workers, with Supabase Postgres for data and R2 for files.

  3. Architecture that guards itself

    Automated reviewer roles (Component Librarian, Design System Guardian, Architecture Guardian) keep the frontend on one component library.