E-commerce / 2026

DE-RANGER

A deployed e-commerce system for a pay-on-delivery business: a guest storefront with order tracking, and an authenticated dashboard that manages the order lifecycle, storefront content and revenue reporting.

The business problem

Pay on delivery is the dominant model for this business, and it breaks the assumptions a normal storefront is built on. There is no payment to confirm, so an order is not revenue: it is an intention.

Most orders need a phone call before dispatch, some are refused and some cannot be reached. On the operations side, the owner is one person working largely from a phone, handling orders as they arrive and needing to know what needs a decision and what money is actually collected.

System objective

Build both sides of the operation from the same rules: make ordering genuinely simple for a customer who has no account and no card, and give the owner an honest operational view where confirmed money is never confused with pending money.

  • Guest checkout with no account, no card details and no advance payment.
  • Customer self-service: an order ID and phone number are enough to check status.
  • A phone-first admin for the person doing the work.
  • Only delivered orders count as revenue, everywhere revenue is displayed.
  • Storefront content can be managed without a developer.

Who uses it

Two audiences with very different needs, served by the same deployment.

  • Customers browse packages, place an order with name, phone, state, city and address, receive an order ID, check status afterwards, request cancellation while the order is open, and reach the business on WhatsApp or by phone.
  • The owner checks which orders need a decision first, works the order list, moves orders through the lifecycle from a phone, edits storefront content, and reviews revenue that reflects collected money only.

How the system works

The store is a Next.js application with server-rendered pages, a small set of JSON endpoints for orders and tracking, and Supabase providing PostgreSQL with row-level security, authentication and file storage. Five SQL migrations build the schema, abuse controls and the admin metrics functions.

The customer side is deliberately thin: an offers section, an order form, a track-order page and informational pages, with WhatsApp and phone as the human confirmation channel. The admin side is a protected dashboard covering orders, content, FAQs, reviews, images and account settings.

  • Order capture. A single validated endpoint is the only public write path on the site. It rejects oversized bodies before parsing, normalises Nigerian phone numbers, validates against a schema and rate-limits by hashed IP.
  • Money stored as integers. Every amount is an integer count of kobo, never a float, which is why the dashboard has no rounding drift. Prices entered in naira are converted on the server.
  • Eleven-state order lifecycle. Pending, confirmed, processing, dispatched, out for delivery, delivered, cancellation requested, cancelled, customer refused, unable to reach and delivery failed, each with a customer-facing label and hint.
  • Enforced state machine. Transitions are validated server-side before the write, so a crafted request cannot mark an order delivered from pending. Every transition appends to an order status history with actor and note.
  • Tracking requires both ID and phone. Order ID alone reveals nothing, and the response is identical for a wrong ID and a wrong phone, so the endpoint cannot be used to discover whether an order exists.
  • Revenue discipline. Only the delivered status is realised money. The dashboard separates delivered revenue, confirmed-but-uncollected, lost, outstanding, pending and stalled.
  • Content management. Packages and prices, FAQs, testimonials, product images and grouped site settings are editable from the dashboard, and each write revalidates the public site.
  • Attribution plumbing. Orders persist UTM parameters, referrer and Meta click identifiers from a first-party cookie, so marketing performance can be traced to real orders rather than to clicks.

Key features

  • Guest checkout and order captureA single form takes name, phone, alternative phone, state, city and address with an optional note and terms acceptance. No account, no card, no advance payment.
  • Self-service order trackingThe customer checks status with their order ID and phone number and sees a progress timeline plus what happens next. Cancellation can be requested while the order is still open.
  • Eleven-state order lifecycleHappy path, cancellation, refusal, unreachable and failed delivery are distinct states with their own labels and customer-facing wording. Illegal transitions are refused server-side and every change is audited.
  • Revenue reporting that respects pay on deliveryDelivered revenue is separated from confirmed, outstanding, pending and lost money, with stuck-order detection. Amounts are stored as integer kobo, so the figures reconcile exactly.
  • Content management without a developerPackages and pricing, FAQs, customer reviews, product images and grouped site settings are editable from the dashboard, and each save revalidates the public pages.
  • Abuse control and privacy by constructionRate limiting on public order and tracking endpoints, hashed IP and user-agent for abuse control rather than stored raw, and no-store, noindex responses on order and tracking payloads.
  • Phone-first operational interfaceThe order list renders as stacked cards on a phone and as a table on a wide screen, with attention badges on the navigation.

From checkout to delivered

  1. 01 / Customer ordersGuest checkout, no account
  2. 02 / Server validatesSchema, phone, rate limit
  3. 03 / Order committedPublic order ID issued
  4. 04 / Owner confirms by phoneName, number, address
  5. 05 / Dispatch and deliverState machine advances
  6. 06 / Customer tracksOrder ID plus phone number
  7. 07 / Revenue recordedOn delivery, not on submit

How it was built

The build started from the awkward parts of the business model rather than from a template, because pay-on-delivery is where generic commerce patterns break.

  • The state machine is the source of truth. The admin interface renders the transitions the server will accept, rather than offering buttons that can fail.
  • Authorisation lives in the action, not the interface. Every admin mutation re-checks the session first, because the service-role database client bypasses row-level security.
  • Money is integer kobo end to end. Naira is converted on the server and formatting happens only at the edge of display.
  • Degrade instead of lying. When the metrics functions fail, the dashboard says the figures could not be loaded and points the owner at the order list, which still works, instead of showing zero.
  • Responses leak nothing. Order and tracking payloads are no-store and noindex, errors are generic, and authentication responses are identical for every outcome.

Notable decisions

The interesting constraints came from doing commerce correctly under conditions where the usual shortcuts are unsafe.

  • A submitted order is never revenue; only delivery is. This is enforced in the status types, the metrics functions and the dashboard layout, so the two cannot be confused at a glance.
  • Tracking needs two factors, not one. Requiring the phone number alongside the order ID makes enumeration useless, and the failure response is deliberately indistinguishable between a wrong ID and a wrong phone.
  • Cancellations and refusals are not sent to the ad platform, because feeding a refusal signal back to an optimiser invites it to chase the same low-quality traffic.
  • Abuse columns are excluded from the application types, so no application code reads the raw IP hash, user-agent hash or idempotency key.
  • Analytics never blocks the owner. Purchase and Meta events run through waitUntil so a slow third-party call cannot fail a status update.

Current status

The store and the admin dashboard are deployed. All five database migrations are applied to the live project, and the admin dashboard is reachable at /admin behind authentication.

No sales, customer or revenue figures are claimed here. The project is presented on what it actually does: order capture, a validated lifecycle, customer tracking, content management and honest revenue reporting.

The screenshots in this case study show the public storefront, the order form and the tracking page. No admin screen is shown, and no customer data appears anywhere in this portfolio.

Delivery status

  • CompleteStorefront, offers and informational pages
  • CompleteGuest checkout and validated order endpoint
  • CompletePublic order tracking with status timeline
  • CompleteCustomer cancellation request
  • CompleteAdmin authentication and protected route group
  • CompleteDashboard attention queue and money breakdown
  • CompleteOrder list with filters, pagination and CSV export
  • CompleteOrder detail with status actions and internal notes
  • CompleteEnforced eleven-state lifecycle with audit history
  • CompleteContent management for packages, FAQs, reviews, images and settings
  • CompleteAbuse controls and rate limiting
  • CompleteAttribution capture and server-side purchase events

Operations surface

Operations dashboard

A phone-first back office for the owner, covering order decisions, money, storefront content and account settings.

Modules
Attention queue / Money breakdown / Orders / Order detail / Packages and pricing / Store settings / FAQs / Reviews / Images / Account
  • Authenticated route group with server-side checks
  • Server-validated order status transitions
  • Delivered-only revenue reporting
  • Content updates revalidate the storefront

Reconstructed from verified admin routes. No customer or order data is shown.