The Inspiration
Living in Kenya, you cannot escape the economic reality of agriculture. Yet, every harvest season, a heartbreaking cycle repeats: smallholder cereal farmers work for months, only to lose 30–40% of their potential income. They lack airtight storage at home, forcing them to rush their grain to market during the peak harvest glut when supply spikes and prices crash. Predatory informal brokers wait at the farm gate, offering rock-bottom cash because they know the farmer is desperate for money to pay school fees or buy next season's seeds.
We asked ourselves a simple question: What if a farmer could safely lock their grain in a certified cooperative warehouse, walk away with immediate cash advance via M-Pesa from a real bank using that grain as collateral, and have an intelligent system automatically sell the crop only when off-season prices peak?
That is why we built MazaoPlus—to turn physical grain into a secure, liquid financial asset, breaking the broker trap entirely.
How We Built It
We engineered MazaoPlus to be fast, lightweight, and completely self-contained. Our entire multi-actor ecosystem compiles down into a single, standalone 21MB Go binary.
- The Backend Engine (Go): We chose Go for its elite native concurrency. We built a thread-safe, memory-mapped data ledger guarded by
sync.RWMutexlocks to ensure sub-millisecond transaction handling. - The Autonomous Agent: We created a background Goroutine driven by a native
time.Tickerthat simulates changing market indices reminiscent of aggregators like Selina Wamucii. The exact millisecond a farmer's custom target price is breached, the agent fires an atomic liquidation loop, calculates storage deductions, and updates states cleanly. - The Sockets Layer: We bypassed clunky polling by implementing Server-Sent Events (SSE) to stream live execution logs straight from the backend thread to the frontend UI.
- The Dual-Channel UI: The frontend is a high-fidelity React application (Vite, TypeScript, Recharts) embedded directly into the Go executable via
//go:embed. Crucially, we built a bespoke, offline USSD Feature-Phone Simulator (*483*1#) running concurrently inside the system shell to give rural farmers total functional parity without needing smartphones or 4G data.
Challenges We Faced
Building a complex fintech state machine across a web UI, background workers, and an offline mobile channel in under 24 hours pushed us to our limits:
- The Concurrency Maze: Managing states cleanly when an automated background agent, a web dashboard, and an offline USSD user are all reading and writing to the same data layer simultaneously was highly complex. One slip-up would cause race conditions or double-disbursed loans. We solved this by strictly locking structures with Go Mutexes and enforcing rigid atomic state transitions (
AVAILABLE→LOCKED→SETTLED). - The TypeScript Embedded Build Trap: During our final compilation phase, the Go compiler threw errors because the frontend
dist/folder didn't exist yet, while TypeScript flagged unused imports and configuration type friction. We had to pause, step away from the code, strictly debug our build order, and clean up our type definitions to ensure theembed.FScompiled smoothly into the single binary. - Simulating Real-Time Visibility: We struggled with how to show the judges that our backend agent was actually working autonomously. We solved this by building a dedicated macOS-style terminal widget in the dashboard that plugs directly into our SSE stream, visualizing the raw Go thread processes in real-time.
What We Learned
This hackathon was a masterclass in realistic engineering priorities and production design patterns.
- The Power of KISS & YAGNI: We initially tempted ourselves with complex external database setups and heavy cloud message brokers. We quickly realized that keeping our data model flat, relational, and in-memory using Go's native capabilities allowed us to ship a highly performant, bug-free prototype faster than fighting configuration files.
- Localization is Everything: Building a beautiful web UI is great for judges, but real-world impact in Africa happens over USSD and feature phones. Creating total backend state parity between a high-fidelity browser app and a
*483*1#text simulator taught us how to design software for absolute accessibility. - Monoliths Matter for Speed: Packaging our entire stack—APIs, streaming sockets, frontend views, and background daemons—into a single executable file proved how powerful single-binary Go applications are for zero-friction deployments.
Log in or sign up for Devpost to join the conversation.