Copied
Executive Case Study · Layer 1 · 2 min read

Build Market — Compliance-First Construction Infrastructure

How I architected an event-driven construction marketplace, statutory verification engine, and non-custodial M-Pesa escrow platform for Kenya.

Role: Sole Architect & Engineer (Product, Backend, Edge, Compliance) · Status: Live Production Pilot at buildmarket.app
Also on Notion ↗

The Problem

Construction in Kenya runs on fragile offline trust:

  1. Unverified practitioners: Credentials across regulatory bodies (NCA, EBK, BORAQS) are claimed on paper rather than verified programmatically.
  2. Unprotected capital: Homeowners and diaspora investors pay large upfront deposits with zero milestone protection if work stalls.
  3. Unreliable statutory infrastructure: The government portals that confirm practicing licenses experience frequent downtime, timeouts, and unannounced schema drift.

The Approach

Build Market operates strictly as a technology marketplace intermediary—never a general contractor. It connects property owners, registered professionals across 30+ trades, material suppliers, and independent dispute inspectors under an audit-logged, event-driven architecture.

The Three Hardest Engineering Problems

ChallengeArchitectural SolutionOutcome
1. Reliability against flaky regulator portals4-stage degradation pipeline: 48h verification cache → sliding-window circuit breaker → 24h NATS JetStream retry stream → two-approver human operator queue (apps/verification-ops).User onboarding never blocks even when external NCA/EBK portals go offline.
2. Money-movement correctnessNon-custodial bank trust escrow paired with idempotent M-Pesa Daraja 2.0 flows ([merchantRequestId, checkoutRequestId]), deterministic NATS message IDs, and acknowledge-only-after-commit consumers.Process crashes or network retries can never trigger a double disbursement.
3. Architectural governance on a solo team26 ratified ADRs enforced mechanically in CI via AST import-boundary tests, environment contract validators (75 keys), and an automated security drift scanner.0 security drift findings across 309 production files; strict Adapter → Service → Repo isolation.

System Scale at a Glance

  • Workspace Topology: Turborepo monorepo with 4 isolated applications (client, admin, verification-ops, workers) and 8 shared packages (db, verification-domain, nats, resilience, redis, types, ui, enums).
  • Data Architecture: 114 Prisma models, 120 strict enums, 24 vertical domain slices, and Class A–D field-level data classification for Kenya DPA (2019) & GDPR compliance.
  • Event Spine: 6 persistent NATS JetStream streams (VERIFICATION, USERS, ORDERS, PROJECTS, NOTIFICATIONS, LICENSES) + isolated Node.js 24 BullMQ worker daemons.
  • Localized Rails: All 47 Kenyan counties, 9 statutory licensing authorities, M-Pesa STK Push / PayBill / B2C, and KRA eTIMS fiscal invoice reconciliation.