How we combined Go, Elixir, ScyllaDB, and Kotlin to replace manual dispatching with autonomous reconciliation loops and instant smart-contract settlements.

If you have ever peered behind the curtain of modern logistics and freight forwarding, you know a dark secret: global supply chains run on spreadsheets, phone calls, static whiteboards, and net-60 invoicing.
When a shipper needs to move 500 kilograms of temperature-sensitive pharmaceuticals across a city or country, they typically negotiate with a middleman broker. A specific driver and vehicle are manually assigned to a static route. But the physical world is chaotic. Traffic jams happen. Refrigeration units fail. Trucks break down. When an anomaly occurs today, human dispatchers scramble to make frantic phone calls while cargo spoils and drivers wait months for payment.
We built ReRute to solve this foundational friction. Instead of treating logistics as a series of rigid, manual bookings, ReRute introduces a Declarative Physical Asset Orchestration Protocol. We treat physical freight like packets routing dynamically across a digital network.
The Paradigm Shift: Declarative Orchestration
In software engineering, Kubernetes revolutionized infrastructure by popularizing declarative orchestration. You don't tell the server how to start processes step-by-step; you declare a Desired State ("I want 3 replicas of this container running"), and an autonomous controller continuously monitors the Actual State, reconciling the two until they match.
ReRute applies this exact philosophy to physical atoms:
Cargo Pods (Desired State): Shippers use the Client Portal to declare a Cargo Pod Manifest. They don't book a specific driver. They declare requirements: Origin, Destination, Weight ($kg$), Volume ($m^3$), Quote Amount, and Environmental Constraints (e.g., refrigerated: true).


Transport Nodes (Actual State): Drivers operate vehicles equipped with our headless Android Node Agent. The node registers its physical capabilities (max load capacity, refrigeration status) and continuously streams real-time physical telemetry (GPS coordinates, vector speed, heading).
Continuous Reconciliation: A centralized control plane continuously compares pending Cargo Pods against active Transport Nodes, autonomously assigning, routing, and rerouting cargo based on proximity, capacity, and environmental compliance.
The Architecture: Bottom-Up Design

1. Storage Layer: Sub-Millisecond Telemetry with ScyllaDB
Tracking thousands of moving transport nodes generating GPS pings every 10 seconds creates a massive, high-frequency write load. Relational databases choke on this time-series ingestion.
We built our storage foundation on ScyllaDB, a hyper-fast C++ NoSQL database compatible with Apache Cassandra. Using partitioned time-window compaction strategies (TimeWindowCompactionStrategy), ScyllaDB absorbs millions of spatial-temporal coordinate pings (latitude, longitude, speed_kmh, heading_degrees) with sub-millisecond latency while maintaining absolute cluster state.
2. The Orchestration Brain: Go Control Plane

At the heart of ReRute sits the Control Plane, written in Go for maximum concurrency and minimal memory footprint.
Every five seconds, the Go API runs a background reconciliation loop. It queries ScyllaDB for all unassigned Cargo Pods (Pending_Pickup) and scans the spatial registry for available Transport Nodes (Available) that satisfy all physical constraints. When a match is found, state is atomic-locked and pushed to the driver's device.
More importantly, the Control Plane is self-healing. If an active driver experiences a mechanical failure and taps "Report Breakdown" on their device, the Go reconciliation engine immediately cordons that node (Cordoned), releases the Cargo Pod back into the routing pool, and autonomously re-dispatches the nearest available transport node to perform a mid-route pickup.
3. Financial Rails: Elixir & The Daraja Smart Escrow Engine

In logistics, trust is tied directly to cash flow. Drivers often wait 30 to 90 days to get paid by brokers. ReRute eliminates net-terms entirely using automated digital escrow.
Our Escrow Engine is built in Elixir, leveraging the Erlang BEAM VM for unparalleled fault tolerance and concurrency. When a client initiates a shipment, upfront payment is locked in a stateful liability machine: PENDING_PICKUP ➔ IN_TRANSIT ➔ NODE_LOCKED ➔ SETTLED.


To handle mobile money payments across East Africa, our Elixir engine integrates directly with Safaricom’s Daraja API. Because cellular network latency can cause payment webhooks to duplicate or lag, the engine enforces strict idempotency using Redis and Elixir GenServer supervisors.
The exact second a driver confirms package handover on their mobile device, the physical state matches the desired state. The Elixir state machine instantly transitions to SETTLED, calculates platform margins, and fires an automated B2C payout directly to the driver's M-Pesa mobile wallet. Settlement drops from 60 days to 600 milliseconds.
4. The Physical Edge: Kotlin Node Agent
To ensure reliable telemetry without draining battery life, the mobile edge is built natively in Kotlin. Running as a headless background daemon on Android devices, the Node Agent wakes up on a precise ticker, reads physical sensors (ACCESS_FINE_LOCATION), computes vector trajectories, and transmits lightweight JSON payloads over secure Cloudflare tunnels.



The Future of Autonomous Supply Chains
ReRute demonstrates what is possible when we stop viewing physical logistics as a human-coordination problem and start treating it as a distributed software protocol. By combining ultra-fast time-series databases, concurrent Go reconciliation engines, and fault-tolerant Elixir financial state machines, we create a supply chain that is transparent, autonomous, and self-healing.
Whether moving pharmaceuticals across Nairobi or managing heavy freight across continents, declarative physical orchestration ensures that cargo always finds its optimal route home.
WATCH DEMO VIDEO
WATCH DEMO VIDEO 2
THIS IS STILL A WORK IN PROGRESS BUT IF YOU ARE WILLING TO WORK WITH
ME THEN WE CAN TURN IT INTO A WORKING PRODUCT