Skip to content
All work
Case study

Parcel Flow

A delivery management system for parcels once they reach the office. It covers rider assignment, delivery status, COD and fee collection, merchant settlements and rider payouts.

Role
Solo, from domain research and spec to design, build and release
Timeline
May – Nov 2026
Status
Live
Stack
Next.js, TypeScript, PostgreSQL, Expo
Parcel Flow landing page with a live parcels table showing township, rider and delivery status

Overview

Parcel Flow runs the back office of a small courier in Yangon. Parcels are logged when they reach the office, assigned to riders and tracked until they are delivered or returned. Every kyat of cash on delivery (COD) and delivery fee is traced through to a merchant settlement or a rider payout.

There are four roles: super admin, office admin, merchant and rider. Admins work in a Next.js web app. Riders also have an Android app built with Expo. A public demo lets anyone sign in as an admin, a merchant or a rider with one click, and its data resets every night.

The problem

I designed it for a delivery business my sister was planning to start. Small Yangon couriers tend to work the same way:

That money loop usually lives in spreadsheets and chat threads. Riders come back with cash, and someone has to work out which merchant is owed what, after fees, and which riders have handed over their cash. A single mistyped number makes the totals impossible to trust.

So the goal wasn’t only parcel tracking. It was to make the money follow the parcels automatically, and to make every correction explain itself.

Approach

Specs before code

Before writing code I wrote a project specification covering the domain, roles, status flows and UI rules, plus a separate note on technical services. Each feature after that went through an OpenSpec proposal, design and task list. Twenty-five of those changes are archived in the repo, from the auth foundation to the Android release build. They tell the project’s story better than the commit log does.

Architecture

A native app can’t call Next.js server actions. So the route handlers and the server actions both call one shared operations layer, and validation, ownership checks, status rules and money side effects live in a single place.

Key decisions

Money is derived, never entered. A delivered or returned parcel creates financial items: COD owed to the merchant, fees owed to the courier, and a payout line for the rider. A settlement or payout only groups items that already exist, so nobody types an amount twice and every total traces back to parcels.

Corrections carry a reason and their side effects. Admins sometimes need to change a status or reassign a rider after the fact. Each correction records why it was made and adjusts the affected financial items, so the audit trail stays intact.

Permissions are checked on the server, every time. Every server action re-checks the actor’s role and ownership. The Next.js proxy only handles routing and is never relied on for security.

Realtime goes through the server. The browser never holds Supabase keys. A route handler subscribes to Supabase Realtime with the service key and streams only the rows the signed-in user is allowed to see, over server-sent events. The rider app uses the same stream.

Challenges

A public demo for a money app. A useful demo has to let strangers change data without being able to break it. Demo mode does the following:

Fast nightly resets. The demo database lives in another region, so seeding through thousands of queries was slow. Instead, the seed runs once locally through the app’s own data layer and is saved as a JSON snapshot. The nightly reset loads that snapshot in one transaction with a few dozen queries and shifts every date so the newest records land on today. It also refuses to run if it finds accounts the demo didn’t create.

Measured performance. Data-layer and navigation tuning was driven by benchmark baselines committed in benchmarks/, not guesswork.

Outcome

What I’d do next