Why rebuild
SendHub is a business texting and calling platform. Its iOS and Android apps were separate native codebases, so every mobile change was built twice. And the Android app had been off the Play Store for several years.
I researched the options, presented a proposal to leadership and got the go-ahead for one React Native / Expo / TypeScript app. The plan was to get Android back on Google Play first, then replace the iOS app, and later bring the web app into the same codebase.
Key decisions
One codebase, Android first
The same code builds for iOS and Android. I did Android first, to get it back on Google Play.
Instead ofKeep maintaining two native apps. Every change cost double, and one codebase was meant to end that duplicated work.
Read from SQLite, write to the server
Contacts, groups, threads and messages page in from the server and are upserted into SQLite. Every search, sort, filter and page reads from SQLite, so browsing is instant and works offline on whatever is cached. Generation-stamp reconciliation makes deletes on the server disappear from the phone too.
Writes go straight to the server. Some write responses don’t match what the server actually saved, so when a write succeeds the app reads that record back and stores the result in SQLite. That keeps the server as the single source of truth, with data flowing one way. I wrote the invariants and the reasoning down in the repo (LOCAL_FIRST_DATA.md) so the next person wouldn’t have to reverse-engineer them.
Instead ofAn offline write queue, for the first release. Getting Android back on Google Play came first, and Expo’s over-the-air updates meant a queue could follow. A queue needs more than app code, though. Customers would have to accept a text going out late after a dropped connection, ideally with a time limit they set. And the server would need changes, such as idempotency keys so a retried send can’t go out twice, while the backend team was in the middle of a large migration.
Every phone line over one WebSocket
- 5 secondswatchdog checks every line
- 20 secondsstuck, and the line is re-driven
- 30 secondscap on transport retries
A SendHub user can have several phone lines. The app registers all of them with Kazoo (2600Hz), the telecom platform SendHub’s calling runs on, over one shared WebSocket, with digest authentication per line. A socket per line would cost battery and memory on a phone for no benefit.
Each line has to settle on "registered" or "error" by itself. A watchdog checks every 5 seconds and re-drives any line stuck for 20 seconds. The transport retries on its own, capped at 30 seconds, and after repeated failures the engine moves to the next SIP proxy. Incoming calls on any line ring through the native call screen (CallKit on iOS, ConnectionService on Android), and a VoIP push wakes the app when it is closed.
Instead ofOne WebSocket per line. It’s the obvious approach, but on a phone it multiplies battery and memory use.
A client generated from the API spec
I had written the OpenAPI specification for SendHub’s API. The app’s client is generated from it, so the app is type-checked against the spec and nobody hand-writes request code that can drift. New endpoints go into the spec first, then the client is regenerated.
Tests and releases
- 122Jest test files
- MSWAPI integration tests against mocked endpoints
- Maestroend-to-end flows
The calling engine also has regression tests checking that no timer outlives a teardown. I set up EAS for builds, store submissions and over-the-air updates with release channels, and tested the over-the-air updates myself.
Rules for the AI agents I built it with
I wrote the code with AI coding agents, inside rules I designed: a short list of guardrails (match the documented architecture, approved libraries only, never hand-write an endpoint the spec covers, stop and ask before any new architectural decision), and a merge gate every change had to pass. A coordinator session handed tasks to agents working in separate git worktrees.
Most of the rules came from real mistakes. When an agent got something wrong, I added a rule so the next one wouldn’t.
Merge gate
- Checks pass
- A test that fails without the change
- Docs updated
- Human review: an agent never approves its own work
The calls that died five seconds in
- Symptom: Calls started setting up, then failed about five seconds into the media, with a 500 during 183 Session Progress. The browser client on the same network was fine.
- Cause: The phone offered IPv6 network candidates; Kazoo’s media relay only handled IPv4.
- Fix: Remove the IPv6 candidates from the finished session description, just before it is sent.
The cause was the network path. The phone’s WebRTC stack gathered IPv6 ICE candidates, and Kazoo’s media relay only handled IPv4. The SIP library’s hooks for editing the session description (SDP) ran before candidate gathering, so they never saw those candidates. I wrapped the factory that builds the session description and removed the IPv6 candidates from the finished SDP, just before it went out in the SIP message. I also added developer toggles to test each candidate type on its own. I found it with SIP logs and network request logging.
What was left
- Done: Android: live on Google Play, October 2026
- Partly done: iOS: built from the same code, App Store release next
- Partly done: Web app from the same code: started, then paused for Android
- Not built: Biometric login and single sign-on
Before the rebuild was approved, I built an Expo VoIP proof of concept on my own time and tested calling on both iPhone and Android. It helped get the rebuild approved, and the rebuilt app’s iOS calling path (CallKit, VoIP push) comes from the same code. I put Android first because it was missing from Google Play. The App Store release was next, and I’d started getting the web app to run from the same code, when my position was eliminated in October 2026.
On release: I built the app, its release builds and the EAS setup that uploads them. The team did the administrative side of the Play Console submission, and I kept after it until the app went live on my last day.
SendHub's code and screens are proprietary, so the images here are redrawn. Numbers are real unless marked as illustrative.