Multi-tenant SaaS · Architect & lead engineer
Billing and field operations for waste-collection companies in Lagos, built offline-first.
A multi-tenant platform for licensed waste-collection operators: property and customer records, tariffs and invoicing, payments, an offline field app, a customer app and regulator reporting. Built for a first operator and designed to be resold to others.
- Role
- Architect & lead engineer
- When
- 2026 — present
- Status
- In production
5
apps on one codebase
10
architecture decisions, recorded
Offline
field collection that syncs later
The problem
Waste-collection operators in Lagos bill thousands of households and businesses, collect cash and transfers in the field, and report to a state regulator. Records lived in spreadsheets and handwritten receipts, crews work where connectivity is poor, and a missed or doubled payment means a customer dispute. The first operator needed one system, and the plan was for it to serve other operators later without a rewrite.
What I owned
- Discovery and a locked pre-development spec: scope, architecture, security, UX and QA
- Architecture, data model and the tenant-isolation design
- Admin web app, super-admin back-office, offline field app and customer app
- Payments, invoicing and regulator reporting
- Release, production operations and ongoing fixes
The system
Payment arrives
online or manual
Recorded as an attempt
always a new row
Arbitrate under a lock
one settlement at a time
Invoice status derived
from the ledger
- or
Receipt issued
Two payments, one invoice
flagged as a discrepancy for review
Every payment, online or recorded by hand, takes the same path. Invoice status is derived from the ledger and is never set directly.
Key decisions
- 01
Isolate tenants in the database, not just the app
Every tenant table carries a row-level security policy from the migration that creates it, and the API's runtime role can never bypass it. A bug in application code cannot leak one operator's data to another. The offline sync rules are reviewed as a second, separate access boundary.
- 02
Derive payment status, never set it
Online and manual payments both become attempts, settled through one locked transition. Two payments against the same invoice produce a discrepancy for a person to resolve, never a silent drop or a double credit.
- 03
Make the field app append-only
Collection events and the audit log are never updated or deleted, and IDs are generated on the device. A crew can work with no signal and sync later without merge conflicts, because a correction is a new record that supersedes the old one.
- 04
Customers are not users
Customers activate with a property code and a phone OTP matched against a record staff already created. There is no open self-registration, and customer reads run under their own database role.
- 05
Write the decisions down first
Seven pre-development phases and ten architecture decision records were locked before the build. Anything that contradicts one has to be raised, not quietly changed.
What I shipped
- Field app
- Offline-first collection for crews, with outbox sync, scheduling and payment recording in the field.
- Customer app
- Bills, payment history and online payment. A branding layer enforces readable contrast whatever colour an operator picks.
- Admin and back-office
- Operator admin for customers, properties, tariffs, invoices and reports, plus a separate super-admin app for running the platform across tenants.
- Onboarding existing data
- A dry-run, commit and rollback importer turns an operator's existing estate spreadsheets into streets, properties, customers and opening balances.
Outcome
Live
first operator running in production
5
apps: admin, back-office, field, customer, API
Multi-tenant
built so a second operator needs no rewrite
Reports
export for the state regulator
TypeScriptNext.jsReact NativePostgres + RLSDrizzlePowerSyncPaystack
Built for Diadem, a licensed waste-collection operator in Lagos. Figures, customer data and infrastructure details are deliberately left out.