// CASE STUDY

Multi-Tenant Scheduling SaaS

A horizontally scalable booking platform serving multiple clinic tenants with WhatsApp reminders and M-Pesa payments.

  • .NET 8
  • ASP.NET Core
  • C#
  • PostgreSQL
  • Redis
  • Entity Framework Core
  • Hangfire
  • Background Workers

// THE PROBLEM

The problem

A healthcare operator needed to unify appointment scheduling across independent clinic tenants, each with their own rules, staff, and patients — while sharing infrastructure costs and enforcing strict data isolation.

// APPROACH & KEY DECISIONS

Approach & key decisions

  1. Designed a schema-per-tenant PostgreSQL model with row-level security for data isolation without operational overhead.

  2. Built async worker pipeline (background jobs) for appointment reminders delivered via WhatsApp Business API.

  3. Integrated M-Pesa STK Push for session fee collection at booking time with idempotent payment reconciliation.

  4. Implemented Redis-backed distributed locking to prevent double-booking across concurrent requests.

  5. Exposed a multi-tenant REST API with JWT + tenant-scope claims; each tenant scoped to its own subdomain.

// ARCHITECTURE

System architecture

Web / MobileASP.NET Core APIPostgreSQL (ten…RedisHangfire WorkersWhatsApp APIM-Pesa Daraja
Web / MobileASP.NET Core APIPostgreSQL (tenant-schema)RedisHangfire WorkersWhatsApp APIM-Pesa Daraja

// STACK

Technology stack

Core

  • .NET 8
  • ASP.NET Core
  • C#

Data

  • PostgreSQL
  • Redis
  • Entity Framework Core

Async

  • Hangfire
  • Background Workers

Integrations

  • WhatsApp Business API
  • M-Pesa Daraja API

Infra

  • Docker
  • Linux VPS

// METRICS

Key metrics

  • Tenants supportedsample
  • Appointments processedsample
  • Reminder delivery ratesample
  • Payment success ratesample

// GET IN TOUCH

Have a similar problem?

If your system needs the same kind of thinking — architecture, integrations, scale — I'd like to hear about it.

Open a ticket →
Enter the world