Skip to main content

Stealth Startup

Feb 2026 – present, 4 min read

Role Co-founder. Backend and core mobile features.

    An unannounced mobile app for iOS and Android. I own the backend and built the sync layer that keeps it working with no signal.

    Terrain
    React Native · Expo · TypeScript · .NET · AWS Lambda · Aurora PostgreSQL · SQLite
    phases to take an online-only backend offline-first
    5
    platforms from one codebase, iOS and Android
    2

    The problem

    The product is still under wraps, so this page covers the engineering rather than the app itself. The short version: it is a React Native app whose users are often somewhere the network is unreliable or gone, and the records they create have to stay readable and editable when it drops.

    My role is covered in Expeditions. This page is about how the system works.

    The hardest stretch

    Offline-first sync on top of a backend that was online-only. I built it in five phases, each one a prerequisite for the next.

    1. A local SQLite cache, read before the network, so a record opens instantly and stays readable with no connection.
    2. Client-generated UUIDv7 ids, with every create idempotent on its id, so a retried request never duplicates a row.
    3. A durable write outbox. An action applies locally at once, appends a mutation to an ordered queue, and never waits on the network. Creating then deleting the same item cancels both, so nothing is sent.
    4. An incremental pull against a per-collection change cursor, with tombstones for deletes. The cursor only advances after the changes are applied, so a failed pull retries the same range.
    5. A conflict policy for long-form text.

    Validating a recorded hike

    There was no way to tell whether a recorded hike actually covered the trail it was linked to. I built a scoring engine that runs on the phone.

    • Coverage, not a path match. Each GPS fix within 50 m of the trail is placed onto the trail's line, and coverage is the combined length of trail the hiker actually covered. Direction, order, and repeat passes don't matter. Every hike gets one result: Completed (at least 90% covered, with no single large gap), Partial (with a percentage), or Not on trail.
    • Bad GPS. Signal drops out on trails, so naive scoring would under- or over-credit. Each pair of consecutive fixes is classed four ways: measured (at most 15 s apart, at a believable speed), bridged (a longer gap crossed at a walkable pace, adjusted for the trail's grade and the hiker's own pace), steps (a gap backed by the phone's pedometer), or rejected. Credit across gaps is capped, and spoofed locations are never credited, which resists both signal loss and cheating.
    • Fast enough to run at Finish. Scoring a 20,000-fix hike takes about 200 ms in Node, through a grid index over the trail. I haven't measured it on a phone yet. Scores are stored with the hike and synced to the backend, and the database grants update permission on only 3 of the new columns.
    • Linking after the fact. A hike recorded without a trail earned no credit. Once the phone is back online, the app finds candidate trails from the route and offers to link one without pausing the recording. Saved hikes are rescored, and the backend allows linking once and never unlinking.

    Getting there meant making recording itself survive a real hike:

    • Background recording. A hike had to stay on screen to keep recording. I moved recording into a background location task (a foreground service on Android, background location on iOS), with the session persisted so it reopens paused if the app is killed. On a Samsung phone it survived a locked screen and saved.
    • A crash on long hikes. Long recordings crashed the iPhone app. Updates queued before the map loaded grew to about 1 GB at 10,000 fixes and 4 GB at 20,000. The fix replaces queued values instead of stacking them, sends the map only the newest 500 points, and saves the route in append-only 500-point chunks. Each write now stays under 40 KB, and an overnight recording on an iPhone 16 Pro ran with zero crashes.
    • A hike outlives its screen. Closing the tracking screen mid-hike used to delete the hike. Now a "hike in progress" pill reopens it, only one hike runs at a time, and a hike interrupted by the app being killed restores with a prompt.

    Decisions

    Chose
    Match each fix to the stretch of trail the hiker could have reached
    Rejected
    Snap each fix to the nearest point on the trail

    Where a trail runs close to itself, two legs of a switchback can sit 20 m apart inside one corridor, and the nearest point credits the wrong one. Matching from the last known position, at a capped speed for the time elapsed, keeps a hiker on the leg they were actually on.

    Chose
    Client-generated ids
    Rejected
    Server-assigned ids with local-to-server remapping

    A row gets its real, final id when it is created, so it never needs remapping after it syncs, and a retry can be replayed safely.

    Chose
    One changes feed for first load and refresh
    Rejected
    A separate cold-load code path

    A collection with no stored cursor pulls since null, which the backend treats as everything. There is one path to keep correct instead of two.

    Chose
    Last-write-wins per field, except long-form text, which gets a conflict copy
    Rejected
    A merge UI or a text CRDT

    Long-form writing is the one place where silently overwriting it is clearly the wrong outcome. A conflict copy never loses writing and needs no new data structure. Resolving it is just editing or deleting the copy.

    See my role in the Expeditions section