← built

Compass

A multi-tenant CRM for real-estate sales teams, from tenant provisioning to lead assignment.

kind
personal project
year
2026

§01 context

A lot of real-estate sales teams track leads in spreadsheets and their own heads. Compass is a CRM for them. A lead comes in, gets a score, gets assigned to someone, and gets followed up.

Each vendor gets its own isolated workspace. There's a separate platform app where tenants get provisioned and KYC and billing happen, and plans are enforced with per-tenant feature flags.

Compass admin dashboard

§02 shape

How it works

web (intake)   admin (vendor app)   super-admin (platform)
       └──────────────┬──────────────────┘
                      ▼
               nginx (TLS, routing)
                      ▼
          NestJS API ── tenant guards on every request
           │        │            │
           ▼        ▼            ▼
      Postgres   BullMQ      Ory Kratos / Hydra
      (Prisma)   workers     (identity, OAuth2)

§03 hard parts

The hard parts

  1. 01

    Tenant isolation in guards

    Tenant scoping happens in NestJS guards, not in each query. When I add a new endpoint it's already scoped, so there's nothing to remember. Plan limits get checked in the same place.

  2. 02

    Using Ory instead of writing auth

    Ory Kratos handles identities, magic-link activation and mobile OTP, and Hydra handles OAuth2. It's more containers in docker compose, but a lot less security code written by me.

  3. 03

    Scoring and assignment

    Lead scores come from PostHog events. Assignment goes through a small rules engine that follows each team's policies. Anything slow or scheduled runs on BullMQ.

stack

  • NestJS
  • Next.js
  • PostgreSQL
  • Prisma
  • BullMQ
  • Ory Kratos
  • Ory Hydra
  • PostHog
  • Docker

next →

formiq

A backend for forms. You add the SDK, it stores the submissions and sends out the emails and webhooks.