Mudarikwa Beekeepers needed more than a website — honey sales, quotations, apiary records, and hive tracking all lived on paper. This platform is the digital version of the whole operation.
What it covers
- Storefront + admin — a Next.js application with 31 Prisma models covering products, sales, apiaries, hives, quotations, and operational records
- Quotations & receipts — PDF documents generated server-side (PDFKit), so quotes sent to customers look professional without manual word processing
- Apiary mapping — hive locations rendered with MapLibre, with ImageKit handling product media
- Companion app — an Expo admin client for day-to-day operations away from the desk
Engineering honesty
A dated audit report (2026-08-25) tracks known gaps — push-notification coverage, a manual-sale stock bug, KPI accuracy — because a system for a real business should be honest about its edges. The codebase has 50 commits of iteration, and an older diverged branch even spawned a FastAPI microservice experiment for PDF quotations.
Three databases, graceful degradation
The platform runs on three isolated PostgreSQL databases — Main (auth, commerce, apiary), Blog, and CMS — each with its own Prisma schema and client. The split keeps content and commerce failures independent: when a database is unavailable the shop shows no products rather than throwing an error, and the mail transport falls back to JSON logging in development.
Authentication, built not borrowed
No NextAuth here. A custom system handles DB-backed session tokens, HMAC-signed JWT cookies with a 5-minute in-memory session cache, roles (CUSTOMER, WHOLESALE_CUSTOMER, ADMIN, SUPERADMIN), custom Google OAuth 2.0, Cloudflare Turnstile CAPTCHA, database-backed rate limiting, and email verification tokens.
Commerce and the paper trail
- Client-side cart (Context + localStorage) with checkout through a single endpoint that resolves live prices
- Order references like
MDB-YYYYMMDD-XXXXXXXX - Branded PDF invoices generated with PDFKit and emailed via Nodemailer
- Money stored as integer cents — floating point never touches a balance
The apiary module
Hive locations render with MapLibre GL; hives carry statuses (ACTIVE, QUEENLESS, SWARMING, …); harvests record kilograms, honey type, and batch references; inspections log queen sightings, brood patterns, and varroa treatments. The admin dashboard charts harvest yields, hive health, and inquiry pipelines with Recharts.
Audited out loud
The repository contains a dated audit report (2026-08-25) written plainly: an atomic variant stock decrement with duplicate-checkout protection, server-enforced order status and payment state machines, an Expo push-notification pipeline — and the bugs it found (a manual-sale stock issue, dashboard KPI drift) documented as tracked findings. The business trusts this system because the audit says out loud what still needs fixing.
