← Home · DWG. 004 · Case studies

Selected work

Five systems I designed, built, and operated end to end — led by an AI-native, multi-tenant CRM platform whose AI assistant and MCP server work within each person's own database permissions, then a production RAG assistant for a national tourism bureau, an AI-powered telehealth platform where a deterministic safety screen runs before any model, a luxury commerce platform whose six surfaces share one design and one database, and a members club platform where privacy is the architecture. Each is a study in context engineering and production-grade craft.

Project 01 · Flagship · AI-native SaaS platform

Partner-driven sales organisations · Multi-tenant

AI-native CRM & growth platform

Every customer conversation in one CRM, an AI assistant for every team member that works with their own permissions, and an MCP server that lets external AI agents do the same. One upstream codebase powers independently hosted client deployments.

My role DevOps & Platform Engineer, AI Infrastructure: architecture, infrastructure, CI/CD, security, multi-tenant delivery and AI integration.

  • AI agents
  • MCP
  • Multi-tenant
  • Self-hosted
  • Row-level security
  • CI/CD
  • 1,300+automated tests on every change
  • 19AI tools over MCP
  • 44live production checks after every deploy and every night
  • 24languages
  • 60versioned database migrations
  • 4stablecoin payment rails

What it does

A multi-tenant CRM and growth platform for partner-driven sales organisations. Outlook and Gmail mail, shared inboxes, Telegram, Matrix/Element chat and website forms all land in cases. Every team member gets an AI assistant inside the CRM, external AI agents connect over MCP, a reply bot answers customers on Telegram with a human handover, and multilingual websites and Telegram Mini Apps feed leads straight in. It runs as a web app, an installable PWA and a native mobile app shell, in 24 languages.

AAI & automation

  • An AI assistant one keystroke away, answering from live CRM data
  • Claude Code, Claude Desktop and claude.ai work in the CRM over MCP
  • A Telegram reply bot answers customers in their own language within seconds
  • News translated into 22 more languages in the background
  • Workflow rules and follow-up reminders run on their own

BOmnichannel inbox

  • Outlook and Gmail: each person reads and sends as themselves, inside the CRM
  • IMAP shared inboxes for team addresses
  • Telegram bots and personal accounts; Matrix/Element chats per case
  • Incoming mail files itself into the right case, and only once
  • Website visitors start a live chat with their team leader

CCRM core

  • Companies, contacts and cases with team-defined statuses and a full timeline
  • Custom fields, files from uploads, mail and chat, internal notes
  • Admin, leader and member roles with team-based visibility
  • Prospect invites by personal or public link; a lead is created only when a person opens it, never a crawler

DGrowth sites & Telegram

  • Marketing sites in up to 24 languages, right-to-left for Arabic and Hebrew
  • Partner pages with short links and QR codes; one-click sign-up
  • Lead forms that open CRM cases directly
  • Telegram Mini Apps and narrated videos in every language

EAnalytics

  • Leads, open and closed cases, median time to first reply
  • Cases by leader, source, country and product
  • Sign-up funnel, live-call attendance, ad spend and cost per sign-up
  • Every figure computed under the viewer's own data permissions

FBilling

  • Prepaid, invoice-driven plans paid in USDT and USDC
  • Non-custodial: no private key or seed on any server
  • Payments matched to invoices and reconciled against the chain daily
  • Service back on within one minute of payment, with no manual step

GMobile

  • Installable PWA plus a native iOS and Android app shell
  • The app stores no password or token
  • Connects to the company's own deployment
  • Every web feature is in the app the day it ships

HSecurity & privacy

  • Row-level security on every table, tested on every change
  • Two-factor sign-in; Google and Telegram sign-in
  • Layered sign-up protection against bots and account pre-hijacking
  • Personal mailboxes and chats invisible to colleagues, enforced by the database

The AI layer

01 ★

An assistant in every seat

A side panel, one keystroke away, that answers from live CRM data and proposes changes: "summarise this case", "draft a reply to the last message", "add a note with the key decisions". It runs with the signed-in person's own database permissions, so it sees and changes only what they can. It drafts emails and messages but never sends them, and the conversation stays in the browser, never on the server.

02 ★

The CRM as an MCP server

A stateless Streamable-HTTP MCP endpoint, so Claude Code, Claude Desktop and claude.ai work in the CRM directly: 19 tools to search, read and update companies, contacts and cases, set follow-ups, add notes and file emails and chats, plus resource URIs. Personal tokens are shown once, stored as peppered hashes, scoped read or write, with optional expiry. 120 requests per minute per token, and every action is logged as made "via MCP".

03 ★

A reply bot that knows when to stop

Answers customers on Telegram in their own language within seconds, from the company's own knowledge and onboarding steps. It hands over to a human when asked, when the customer is upset, wants to sign or pay, or when it cannot help; it notifies the right person, stays quiet during the handover and resumes on command. Every answer is filed in the CRM like a human reply.

04

One agent core

Tools are defined once, with typed and validated schemas, and serve both the in-app assistant and MCP: a new tool reaches both at once. The same privacy rules apply as in the app, re-checked inside the tools.

05

A production-grade LLM client

Anthropic Claude or Google Gemini by configuration, behind one client: tool schemas adapted per provider with automatic fallback, reasoning budgets handled, retries with backoff. A one-click setup check tells admins exactly what to fix: key, model, quota or region.

06

Translation in the background

News posted to a Telegram channel appears on the websites within seconds and is translated by Claude into 22 more languages, keeping formatting, links, names, numbers and emoji, with a "show original" switch for readers.

How it stays safe

  • The database enforces permissions. The assistant acts as the person using it, so row-level security decides what it can see and change. MCP tools re-check the same rules.
  • Every write needs approval. Each proposed write is an approval card listing every field it changes. Sensitive changes (a case's owner or contact, a contact's email, a company's mail domain) always ask.
  • Outside text is data, not instructions. Emails, subjects, names, notes, chat text and file names reach the model wrapped as data; look-alike tags are defused.
  • Model output is sanitised. Answers render as safe UI elements, never model HTML. Translations are rebuilt tag by tag: allowed formatting only, links only to URLs in the original.
  • No half-finished answers. An empty, refused or cut-off answer is retried or handed to a human, never sent.
  • Bounded and provider-agnostic. Rate limits per person and per token; Claude or Gemini by configuration. The bot's prompt forbids promising income, asking for credentials or money, or sending payment details not in the company's information.

Architecture

Platform architecture Web app, Telegram and external AI agents connect to the Next.js app (UI, API and MCP endpoint). The app calls a shared AI agent core with one tool registry and one LLM client, which talks to Claude or Gemini and reads and writes PostgreSQL under row-level security on self-hosted Supabase. A background worker shares the database, uses the agent core for the reply bot, and connects to external services: Microsoft 365, Gmail, IMAP, Telegram, Matrix/Element, blockchains and email delivery. Web app PWA · mobile Telegram Mini Apps, bots AI agents Claude via MCP Next.js app UI · API · MCP endpoint Shared AI agent core one tool registry one LLM client LLM Claude or Gemini PostgreSQL · row-level security self-hosted Supabase auth · REST · storage Background worker mail & chat sync · reply bot workflow rules · scheduled posts chain watcher · reminders External services Microsoft 365 · Gmail · IMAP Telegram · Matrix / Element blockchains · email delivery
Fig. 01-A Platform architecture

How a request flows

  1. A person asks the in-app assistant, or an external agent calls the MCP endpoint.
  2. The app hands the request to the shared agent core: one tool registry, one LLM client.
  3. Every tool reads and writes PostgreSQL as that person. Row-level security decides what exists for them.
  4. Proposed writes come back as approval cards; drafts are never sent by the assistant.
  5. The worker syncs mail and chat, runs the reply bot through the same agent core, applies workflow rules, publishes scheduled posts, watches the chains for payments and sends reminders.
  • Platform
  • AI path
  • External
Multi-tenant delivery One upstream codebase feeds a sync tool and GitHub Actions workflow, which opens a CI-gated sync pull request in every client repository. Each client deployment has its own repository, database, auth, domain, secrets and branding. A deploy-time instance-ID check stops any tenant app from running against another tenant's database. Upstream codebase one CRM, every feature Sync tool + GitHub Actions per-client manifest · stops on conflict opens a CI-gated sync PR per client Deployment A Deployment B Deployment n own repodatabase · authdomain · secretsbranding own repodatabase · authdomain · secretsbranding own repodatabase · authdomain · secretsbranding deploy-time instance-ID check: no app can reach another tenant's database
Fig. 01-B One codebase, isolated deployments

Why it holds

  1. Each client deployment is fully isolated: its own repository, database, auth, domain, secrets and branding profile.
  2. A per-client manifest records client-owned files, client-only features and migration renames and skips.
  3. The sync stops on a version collision or an ownership conflict instead of overwriting client work.
  4. Every upstream change becomes a sync pull request in every client, gated by the same CI.

How I built and run it

Multi-tenant delivery from one codebase

Problem
Every client needs an isolated deployment, yet every improvement has to reach all of them without hand-merging or overwriting client customisations.
What I did
Built a sync tool driven by a per-client manifest, with version-collision and ownership-conflict detection, and a GitHub Actions workflow that opens a sync pull request in every client after each upstream change. Branding is a swappable profile.
Result
Every upstream change reaches every client as a CI-gated pull request, and a deploy-time instance-ID check makes it impossible for one tenant's app to run against another tenant's database.

Self-hosted data platform

Problem
Production tenants ran on a managed cloud database; each needed its own dedicated stack that runs on small servers.
What I did
Moved each tenant to its own self-hosted Supabase stack (PostgreSQL 17, auth, REST, storage, API gateway, admin dashboard) on Docker Compose behind nginx, Cloudflare and Let's Encrypt, trimmed for small servers.
Result
Data parity verified after the move, nightly backups, and a database reachable only over SSH tunnels.

CI/CD with hard gates

Problem
One bad merge or one edited migration could break every tenant and its security rules at once.
What I did
GitHub Actions runs lint, strict type-checks, 931 unit tests and 398 database security tests on every change. A migration gate refuses edits to applied migrations and requires new ones to sort after everything in production. The production branch accepts only pull requests from main; deploys run over SSH, with migrations through an SSH tunnel.
Result
Nothing reaches production without passing 1,300+ tests and the migration gate, and every secret lives in GitHub Environments, none in code.

Production verification

Problem
A green pipeline does not prove the live system works: sign-up, permissions and integrations depend on production configuration.
What I did
Playwright live suites after every deploy and every night: 44 CRM checks plus website checks covering sign-up flows, permissions, lead intake, invites, the Telegram Mini App's signed launch data, captcha and security probes against the live API.
Result
Every deploy is proven against the real system, and again every night, with throwaway accounts that clean up after themselves.

Observability

Problem
Small self-hosted servers need monitoring, and the monitoring tools must not become an exposure of their own.
What I did
Uptime monitoring with Telegram alerts, host and container metrics, centralised container logs and container management, and error tracking with secrets and personal data scrubbed.
Result
After an exposure audit, every operations tool moved behind TLS on loopback-only ports.

AI infrastructure

Problem
An assistant, an MCP server and a reply bot could easily mean three tool sets, three LLM integrations and three sets of safety rules.
What I did
One shared agent core: one tool registry and one provider-agnostic LLM client, with token and reasoning budgets, retry and human fallback, injection hygiene, output sanitising, per-person and per-token rate limits, and a translation pipeline.
Result
A new tool reaches the assistant and MCP at once, and every AI surface inherits the same safeguards.

AI-assisted engineering and docs-as-code

Problem
A platform this broad, across several repositories, has to stay legible to every engineer and every AI session working on it.
What I did
I run parallel coding agents with independent adversarial reviewers for reviews, fixes and pre-release verification against replicas of production databases, and keep a living handbook per repository with automated staleness checks.
Result
Every engineer and every AI session starts from the true current state, and risky changes are proven on production replicas before release.

Engineering highlights

01 ★

Privilege drift, fixed without downtime

Challenge
After the database move, an audit showed that the restore had silently widened database privileges for the public API roles.
Action
I rebuilt the intended privileges from the migration history, generated an exact fix, proved it on replicas of production, had it reviewed adversarially and applied it in one transaction per database.
Outcome
Gateway logs confirmed nothing had been misused, and a permanent live probe means it cannot come back unnoticed.

02 ★

Shipping to every tenant safely

Challenge
An upstream release has to land in every client without colliding with client-specific schema.
Action
Automatic, CI-gated sync pull requests for every client, with each release's migrations first tested against the client's real production schema.
Outcome
That rehearsal caught a silent object-name collision before it reached production. Along the way I fixed a false failure in the migration gate itself (SIGPIPE under pipefail).

03

Managed cloud to self-hosted, per tenant

Challenge
Move every production tenant off a managed cloud database onto infrastructure of its own.
Action
Stood up a dedicated self-hosted database stack per tenant and moved each one across.
Outcome
Data parity verified for every tenant, with each stack trimmed to run comfortably on small servers.

04

AI made safe for real customers

Challenge
Put an LLM in front of real customers and inside a CRM full of private data.
Action
Permissions enforced by the database, approval cards for writes, injection-safe context, sanitised output and guardrails in the bot's prompt.
Outcome
The assistant only ever sees what its user can see, and no half-written answer ever reaches a customer.

Stack

Frontend
  • Next.js 16
  • React 19
  • TypeScript (strict)
  • Tailwind CSS 4
  • PWA
  • Capacitor
Backend & data
  • PostgreSQL 17 + RLS
  • Supabase (self-hosted)
  • pg-boss
  • Node.js worker
  • Python (Starlette)
  • Zod
  • pnpm + Turborepo
AI
  • Anthropic Claude
  • Google Gemini
  • MCP (Streamable HTTP)
  • Shared agent core
  • Neural TTS
Integrations
  • Microsoft Graph (Entra)
  • Gmail API
  • IMAP
  • Telegram Bot API
  • MTProto
  • Telegram Mini Apps
  • Matrix / Element
  • Resend
  • Turnstile
  • Web Push
  • Tron & EVM watchers
Infrastructure
  • Docker Compose
  • nginx
  • Cloudflare
  • Let's Encrypt
  • GitHub Actions
  • SSH-tunnelled migrations
  • Uptime Kuma
  • Beszel
  • Dozzle
  • Portainer
  • Sentry
Quality
  • Vitest · 931 unit tests
  • 398 DB security tests
  • Playwright e2e + live checks
  • ESLint

Confidentiality. Product, client and company names are withheld. The platform runs as independently hosted client deployments of one upstream codebase; the figures on this page describe that codebase and its pipelines.

Project 02 · Production RAG

Ethiopian Bureau of Tourism

ChatADDIS

An AI travel companion for visitors to Addis Ababa and Ethiopia's key destinations. I built the production retrieval system behind the assistant — the part that has to be right, fast, and honest about its sources.

  • <3s end-to-end response latency, with streaming
  • 4k+ points of interest kept current automatically
  • 900+ lines of brittle follow-up rules retired
  • Go
  • PostgreSQL
  • pgvector
  • Ollama
  • Gemini
  • RAG
  • Hybrid search

How it's built

  • Hybrid retrieval — a Go pipeline over PostgreSQL + pgvector combining vector, keyword, and spatial search so answers stay relevant and grounded.
  • Embeddings & generation — Ollama for 768-dimensional embeddings; Gemini for streaming, source-attributed responses.
  • Session-aware follow-ups — conversational memory that resolves "what about near there?" and replaced 900+ lines of hand-written rules.
  • Always-fresh data — automated ingestion from OpenStreetMap, Google Places, Wikipedia, and live weather & currency APIs.
  • Fails gracefully — sub-3s latency, source attribution, and sensible fallbacks when data is missing.

Project 03 · AI-powered telehealth

Telehealth & e-pharmacy · Ethiopia

Custo

A full-stack telehealth and e-pharmacy platform for Ethiopia — diaspora, urban patients, and rural users reached through telco partners — in five languages. An AI assistant interviews patients, a deterministic safety layer screens every message for medical red flags before any LLM is called, retrieval grounds the model in the Merck Manual, and the output routes into a real clinical workflow: doctor workspace, cryptographically signed prescriptions, payments, and an end-to-end-encrypted health vault. Eight deployable applications — one person's architecture.

  • 5 languages end to end — UI, AI intake & emergency responses
  • ~15 deterministic red-flag rule groups, screened before any LLM
  • $0 per-query embeddings — local ONNX, no GPU, nothing leaves the box
  • Python
  • FastAPI
  • RAG
  • pgvector
  • AI safety
  • Whisper
  • NestJS
  • Next.js 14
  • React Native
  • E2E encryption
  • WebRTC
  • CI/CD

Why it's hard

Healthcare AI for a low-connectivity, multilingual market forces decisions you never hit in a chat-UI-over-an-API-key project:

  • Emergencies can't depend on a model — red-flag detection must not hinge on LLM behaviour, latency, or availability, so a deterministic screen runs in front of every model call. Asymmetric by design: false positives acceptable, false negatives not.
  • Five languages as architecture — English, Amharic, Oromo, Tigrinya, Somali (three of them low-resource) threaded through the UI, AI prompts, voice transcription, and the emergency short-circuit messages — not translation files bolted on.
  • Low-connectivity economics — local ONNX embeddings instead of hosted APIs, self-hosted Whisper and WebRTC (coturn), offline-first PWA, and a Telegram bot for users without smartphones.
  • Privacy with real stakes — sensitive records live in their own Postgres schema, and the patient vault is encrypted client-side so the operator literally cannot read it.
  • AI judged by its downstream effects — intake feeds a doctor workspace, drafts become signed prescriptions, summaries are generated post-consultation. Not chat transcripts.

The AI core

01 ★

Safety before AI

~15 deterministic red-flag rule groups (cardiac, stroke, anaphylaxis, sepsis, suicidality, pediatric emergencies) screen every intake message before the LLM. On a match, the pipeline short-circuits to multilingual emergency guidance — the model is never called. Deliberately not an LLM: emergencies must not depend on model behaviour, latency, or availability. Covered by dedicated pytest suites.

02 ★

Zero-cost production RAG

The Merck Manual corpus embedded into Postgres + pgvector; query-time embeddings via fastembed (local ONNX, bge-small, 384-dim) — no API cost, no GPU, nothing leaves the box. Top-k cosine context is injected into the intake prompt, and the layer fails open to empty context if the DB or embedder is down — the product never breaks because retrieval did.

03 ★

E2E-encrypted health vault

Client-side AES-256-GCM with per-blob keys (PBKDF2, 250k iterations); sharing wraps a record's key to the doctor's ECDH P-256 public key via time-bounded grants that auto-revoke when the case closes — the server never sees plaintext or keys. 12-word recovery mnemonic, biometric unlock on mobile, and encrypted backup to the patient's own Google Drive.

04

Provider-agnostic LLM layer

One interface over Claude, Gemini, and self-hosted Ollama with an auto mode that picks the first provider with credentials — plus a mock provider so the whole platform is end-to-end testable with zero keys. Per-call token counts flow to Prometheus for cost observability.

05

Multimodal pipeline

Self-hosted faster-whisper (CTranslate2) speech-to-text with voice activity detection — patient audio never leaves the cluster. Vision-based OCR turns photos of paper lab reports into structured analytes; text-to-speech and translation across all five languages.

06

Prompts as versioned artifacts

Intake, clinical decision support, prescription drafting, and post-consultation summary prompts are versioned markdown templates with template rendering and their own tests — treated like code, not strings buried in handlers.

Embedded in a real clinical system

  • Doctor workspace — live queue over SSE with a polling fallback and race-safe case pickup, a three-column consultation view with an AI clinical-decision-support panel, and TOTP login.
  • Verifiable prescriptions — Ed25519 signatures over canonical JSON, PDF with QR + 10-character code, a public verification endpoint, and allergy & controlled-substance checks at signing time.
  • Payments done properly — idempotent payment service, double-entry ledger, FX, webhook reconciliation crons, and two-person approval on settlements.
  • Self-hosted WebRTC video consultations with a custom signaling service and coturn — no Twilio dependency; matters for cost and data locality.
  • Realtime — SSE backed by Redis pub/sub, with a token-for-ticket exchange so EventSource connections never carry long-lived JWTs.
  • Cross-cutting rigor — RFC 7807 problem+json everywhere, Zod on every boundary, an INSERT-only audit interceptor on every mutating request (7-year retention), idempotency keys, tiered rate limits, and a redacting structured logger.
  • Testable with zero credentials — every integration (payments, SMS, storage, LLMs) sits behind a mock flag; a new developer runs the entire 8-app platform end to end with Docker and no keys.
  • CI/CD — GitHub Actions with live Postgres + Redis services, ruff/mypy/pytest for Python, 6 images published to GHCR with semver/sha tags, and a gated production deploy with Prisma migrations.

By the numbers

Monorepo
8 apps + 6 packages
Data layer
61 Prisma models · 2 schemas
API surface
~35 NestJS modules
AI endpoints
9 text · speech · vision

Stack

AAI service (Python)

  • FastAPI · Pydantic v2 · httpx · asyncpg
  • pgvector + fastembed (bge-small ONNX, 384-dim)
  • faster-whisper (CTranslate2) with VAD · vision OCR · TTS
  • Service-JWT auth — never exposed raw
  • structlog · Prometheus token metrics · Sentry

BBackend (TypeScript)

  • NestJS 10 on Fastify · Prisma — 61 models
  • PostgreSQL — dual schema (public + medical_records)
  • Redis · BullMQ workers · SSE realtime
  • Zod validation on every boundary

CFrontends

  • Next.js 14 App Router — offline-first PWA
  • Expo / React Native — biometrics, push, WebRTC calls
  • grammY Telegram bot — all 5 languages
  • TanStack Query · Tailwind

DPlatform & ops

  • pnpm workspaces + Turborepo — 8 apps, 6 packages
  • GitHub Actions CI — live Postgres + Redis services
  • 6 Docker images → GHCR · gated prod deploys
  • Hardened Compose stack · Terraform/k8s skeletons

Architecture

              ┌───────────────┐   ┌───────────────┐   ┌──────────────┐
  Patients →  │  patient-pwa  │   │ patient-mobile│   │ telegram-bot │
              │  (Next PWA)   │   │  (Expo / RN)  │   │ (5 languages)│
              └───────┬───────┘   └───────┬───────┘   └──────┬───────┘
  Doctors  →  ┌───────┴───────┐                              │
              │  doctor-web   │        all HTTPS + Zod        │
  Admins   →  │   admin-web   │              │                │
              └───────┬───────┘              ▼                │
                      └──────────────▶ ┌───────────┐ ◀────────┘
                                       │    api    │  NestJS · Fastify
                                       │ (backbone)│  Prisma — 61 models
                                       └─────┬─────┘
                     ┌───────────────────────┼───────────────────────┐
                     ▼                       ▼                       ▼
          ┌─────────────────────┐      ┌───────────┐          ┌───────────┐
          │      ai-service     │      │  worker   │          │ Postgres  │
          │ safety → RAG → LLM  │      │ (BullMQ)  │          │ +pgvector │
          │ whisper · OCR · TTS │      │ jobs·crons│          │ public +  │
          └──────────┬──────────┘      └─────┬─────┘          │ medical   │
                     │                       │                └───────────┘
                     │                       ▼
                     │                 ┌───────────┐
                     └────────────────▶│   Redis   │  cache · queues · pub/sub
                                       └───────────┘

Honest framing. Custo is a pre-launch MVP: the system is complete end to end, and external integrations (payment providers, SMS gateways, telco billing) are architected and wired but run against mocks behind a flag until commercial agreements land — built for production, not yet processing live traffic. Repositories are private; code walkthroughs available on request, and a live demo runs at custo.health. Built end to end by one engineer using an AI-augmented workflow — including a code knowledge graph so AI tooling can navigate the monorepo.

Project 04 · Luxury commerce

Korean-skincare boutique · Addis Ababa

Aurana

A full-stack luxury commerce platform built for the Ethiopian market: a customer storefront on the web, a native mobile app, an admin studio, a staff operations app, a Telegram bot, and an AI concierge that speaks the shop's own voice. Every surface reads from one database, obeys one set of rules, and wears one design.

  • 6 applications on one database of record and one design system
  • 100% of tables under Row-Level Security, verified against the live schema
  • 22 acceptance tests that assert against the live catalogue
  • Next.js 14
  • Expo / RN
  • Supabase
  • Postgres 17
  • Deno edge fns
  • FastAPI
  • Google ADK
  • Gemini
  • Chapa
  • Telegram
  • Playwright
  • Docker

Built for Ethiopia, not translated to it

  • Local payment rails: prices in Ethiopian Birr, payment through Chapa (Telebirr, CBE Birr, cards) plus cash on delivery within Addis Ababa.
  • Phone-first identity: sign-in by phone OTP delivered through an Ethiopian SMS gateway, with Standard Webhooks signature verification on the delivery hook.
  • Delivery priced by the kilometre: the customer drops a pin or searches a landmark; the server measures the drive through Google's APIs and names the price itself. Regional cities get a flat fee. The client is never trusted with arithmetic.
  • Accent preserved: Korean and Amharic threads run the whole system (감사합니다 · እናመሰግናለን), and all three typefaces are self-hosted so nothing waits on a Google round trip over a 3G connection.

Commerce machinery that takes itself seriously

01 ★

Money is computed once, on the server

Quotes, checkout, and the payment webhook all price from the database; a forged client price is provably ignored, and there is a test that proves it. Loyalty balances come from one server function rather than client arithmetic.

02 ★

Orders cannot double

Order, items, and promotion redemption are created in a single transaction with a retrying ID mint; a client-side dedupe key folds a double-tapped Pay, or an abandoned-and-retried checkout, back into the same order and the same hosted payment page.

03 ★

The shelf admits coming up short

When two customers race for the last unit, settlement writes exactly what could not be taken onto the order and pings the staff Telegram channel before the packer finds out.

04

Payment integrity end to end

Timing-safe webhook signatures, transaction re-verification against the provider, amount checks, idempotent settlement, and the stock decrement lands in the same breath as the paid flag.

05

An AI concierge on an allowance

FastAPI + Google ADK + Gemini 2.5, streaming, with memory, multilingual replies, voice input, and product cards in chat. Per-customer and boutique-wide daily spending allowances are counted before every model call, so the assistant can never outspend the shop.

06

Loyalty, pre-orders, consultations

Points per Birr with a Gold tier and an invitation-only Circle; sold-out products take a deposit-backed queue, and restocking can notify everyone waiting over push, Telegram, and the in-app tray at once; virtual consultations by phone, WhatsApp, or Telegram, with day-before reminders swept daily by pg_cron.

Operations discipline

  • Row-Level Security on every table, verified by probing the live schema, with service-role keys confined to edge functions.
  • Three-layer rate limiting shaped by where code runs: in-memory counters in the long-lived web container, Postgres-counted windows for distributed edge functions, and nginx zones at the host, with the AI's own daily allowances beneath.
  • A migration ledger with a checker script, born from a real incident: one migration silently missed production for weeks, so now repo, ledger, and schema are compared on demand, and applying and recording are one act.
  • Error tracking on every surface (Sentry: web, admin, native with source maps), branded failure pages, and honest empty states everywhere: a failed read is not an empty shelf.
  • A 22-test Playwright acceptance suite that asserts behaviour against the live catalogue rather than seed data, so content edits can never break the tests.
  • Locked doors, kept ledgers: admin two-step sign-in (TOTP) enforced at the server gate; self-service account deletion that satisfies app-store policy while keeping the sales ledger; independent nightly database dumps that live outside the hosting provider's walls.

The craft layer

  • The design system was extracted from a single-file HTML prototype and preserved to the pixel: arch-shaped cards, wide-tracked labels, Cormorant Garamond against Inter against Noto Serif KR.
  • Every user-facing sentence is written in the boutique's voice, down to the rate limiter ("A little fast. Please give it a moment and try again."), and a site-wide text registry lets the operator rewrite any sentence from the Studio.
  • One house rule kept across tens of thousands of words of copy, this case study included: no em dashes, anywhere, ever.

Stack

AWeb surfaces

  • Storefront: Next.js 14 App Router, ISR + tag revalidation
  • Phone-width PWA face mirroring the native app
  • Studio: server-gated admin, realtime order board
  • Site-wide text registry · live repricing settings

BMobile & channels

  • Expo SDK 52 / React Native · EAS builds
  • OTA updates on fingerprint-disciplined channels
  • Staff app: receiving, shelf counts, settlement
  • Telegram bot: signed one-time account linking

CBackend

  • Supabase: Postgres 17 · Auth · Storage · Realtime
  • 42 SQL migrations, ledger-tracked · 8 Deno edge functions
  • pg_cron for scheduled work · RLS everywhere
  • Assistant: FastAPI + Google ADK + Gemini 2.5

DPlatform & ops

  • Docker Compose on a self-managed VPS
  • nginx + Let's Encrypt · three-layer rate limiting
  • Sentry on every surface · nightly off-site dumps
  • Chapa hosted checkout · webhook-settled

Architecture

              ┌────────────┐  ┌────────────┐  ┌──────────────┐
 Customers →  │ storefront │  │   mobile   │  │ telegram bot │
              │ (Next PWA) │  │ (Expo/RN)  │  │ (linked acct)│
              └─────┬──────┘  └─────┬──────┘  └──────┬───────┘
 Operator  →  ┌─────┴──────┐        │                │
              │   studio   │        │         ┌──────┴───────┐
 Stockroom →  │ staff app  │        │         │ ai concierge │
              └─────┬──────┘        │         │ FastAPI· ADK │
                    │               │         │ · Gemini 2.5 │
                    │               │         └──────┬───────┘
                    ▼               ▼                ▼
              ┌─────────────────────────────────────────────┐
              │                  Supabase                   │
              │  Postgres 17 · Auth · Storage · Realtime    │
              │ pg_cron · 8 edge functions · RLS everywhere │
              └────────┬───────────────────────┬────────────┘
                       ▼                       ▼
                 ┌────────────┐         ┌─────────────┐
                 │   Chapa    │         │ SMS gateway │
                 │ (webhook-  │         │ (phone OTP) │
                 │  settled)  │         └─────────────┘
                 └────────────┘

Honest framing. Aurana is pre-launch. The full payment loop runs against a faithful simulation while the Chapa merchant account is completed; flipping to live money is an environment-variable change. The remaining launch list is short and known: real payment keys, a proper domain, and a CDN in front. Payment, dedupe, oversell, deletion, and rate-limit paths were each proven against the production stack before shipping.

Project 05 · Privacy-first members platform

MINAB Wellness Club

MINAB

A digital companion for a private wellness club whose membership includes high-profile individuals — class booking, events, spa and café menus, a member-driven gym playlist, a discreet member directory, realtime messaging, a digital wallet, and concierge chat, delivered as an installable web app, a native iOS/Android app, an admin console, and a front-desk cashier terminal. Privacy is not a feature here; it is the architecture. Members are invisible by default, and the club is the only party that ever knows who anyone really is.

  • 0 real names shown to other members — ever, by construction
  • 19 versioned SQL migrations with Row-Level Security as the enforcement layer
  • 4 app surfaces — member PWA, native mobile, admin, cashier — on one backend
  • Next.js 14
  • Expo / RN
  • Supabase
  • Postgres RLS
  • Realtime
  • Edge Functions
  • Web Push
  • PWA
  • TypeScript
  • zod

Identity decoupling as architecture

The club verifies and holds each member's real name; other members only ever see a chosen display name — a nickname, a single initial, anything. That split is enforced in the database, not the UI:

  • Defaults are the most private possible — new members are undiscoverable and uncontactable with every per-field visibility flag off. Visibility is opt-in, never opt-out.
  • Server-side field stripping — the directory RPCs null out every field whose visibility flag is off before the row leaves Postgres. The client never receives what it shouldn't show, so no UI bug can leak it.
  • Real names are admin-only and audited — full_name is never returned by the member-facing RPCs, and every admin access of the sensitive fields is written to an audit log by a database trigger.
  • Push notifications carry nothing — the send-push Edge Function rewrites message pushes to a bare "New message": never the sender, never the text.
  • A member can vanish at will — one switch hides them from the directory entirely; useful before a public engagement, during travel, or simply on a whim.

What members actually get

01 ★

Contact without exposure

All member-to-member contact happens inside the app — phone numbers and emails never travel. Whether a message can even be sent is decided by the recipient's contactability setting and connection state, enforced in the messages table's RLS insert policy — not in client code. Block and report sit wherever a member appears.

02 ★

A wallet the front desk shares

Token-based QR scan-to-pay against dedicated cashier terminals with lock screens; wallet PIN with biometric unlock on mobile; top-ups, receipts, transaction history, and gift campaigns with admin payout tooling — one ledger serving members and the front desk alike.

03 ★

Booking that runs itself

Capacity-aware class booking with waitlists that notify when a spot opens, one-tap add-to-calendar, and automatic notifications to every booked member when a session is cancelled or rescheduled — the front desk never works a phone list again.

04

The gym playlist, democratized

Members request songs and upvote each other's picks; staff moderate a queue sorted by votes and export the approved batch straight into the club's Spotify playlist. A running complaint — "the music keeps repeating" — became a member-driven supply of new tracks.

05

Concierge & spa, one tap away

Department-scoped concierge threads (spa, gym, café) give members a direct line to staff; spa treatments, food, and juice menus stay current from the admin console; virtual consultations and a spa queue round out the service layer.

06

Notifications with restraint

An in-app inbox plus strictly opt-in push, guided by a written house rule: push what's earned (a cancelled class, an opened waitlist spot), inbox the rest. The membership is high-end and easily annoyed by noise — the system is designed to respect that.

Operations & delivery

  • Row-Level Security is the backbone — 19 versioned migrations build the schema, policies, RPCs, audit triggers, and realtime publications; invite-only onboarding runs on one-time claim codes issued and revoked from the admin console.
  • Realtime by replication — messaging and song-request tables are published straight from Postgres into live UI; the admin order of the day updates without a refresh.
  • Push done twice, behind one seam — Web Push (VAPID) for the PWA and Expo push tokens for the native app, both fed by the same Edge Function; the notification layer is a single module so swapping transports never touches callers.
  • Reviewable without credentials — the app renders fully with demo data when Supabase isn't configured, so design review needs zero secrets.
  • Shipped like a product — multi-stage Docker build on Next.js standalone output with a non-root runtime, a Docker Compose production stack, and EAS build profiles for the iOS/Android app with minab:// deep links and universal links on the production domain.

Stack

AMember surfaces

  • Next.js 14 App Router · TypeScript strict
  • next-pwa: offline shell, installable manifest
  • Expo / React Native · EAS builds · OTA
  • TanStack Query · react-hook-form + zod

BBackend

  • Supabase: Postgres · Auth · Storage · Realtime
  • RLS on the privacy-critical path · SQL RPCs
  • Admin audit triggers · pg_cron sweeps
  • Edge Functions: content-redacted push

CStaff surfaces

  • Admin console: classes · events · menus · invites
  • Safety reports · playlist moderation · staff roles
  • Cashier terminal with lock screen
  • Receipts · gift payouts · spa queue

DDelivery

  • Multi-stage Docker · non-root runtime
  • Docker Compose production stack
  • Web Push (VAPID) + Expo push tokens
  • minab:// deep links · universal links

Architecture

              ┌────────────┐   ┌────────────┐
 Members   →  │ member PWA │   │   mobile   │  minab:// deep links
              │ (Next 14)  │   │ (Expo/RN)  │
              └─────┬──────┘   └─────┬──────┘
 Staff     →  ┌─────┴──────┐        │
              │   admin    │        │
 Front desk → │  cashier   │        │
              └─────┬──────┘        │
                    ▼               ▼
              ┌──────────────────────────────────┐
              │             Supabase             │
              │ Postgres · RLS · Auth · Storage  │
              │ Realtime · SQL RPCs · audit trig │
              │   19 versioned migrations        │
              └──────┬────────────────────┬──────┘
                     ▼                    ▼
             ┌──────────────┐     ┌──────────────┐
             │  send-push   │     │  invites &   │
             │  edge fn —   │     │  one-time    │
             │  "New msg",  │     │ claim codes  │
             │  never text  │     └──────────────┘
             └──────────────┘

Honest framing. MINAB is a client delivery in its launch run-up: the platform runs end to end across all four surfaces against the production backend, and the club's public site is live at minab.club — the members app opens with the club's launch. Designed and built end to end by one engineer, brief to delivery.

Back to home Start a conversation