Next.jsPDFKitMapLibreCase Study

Mudarikwa Beekeepers: Quotations, Hives, and Receipts

How I built the Mudarikwa Beekeepers platform: quotations with PDFKit, apiary mapping with MapLibre, an Expo admin app, and a public audit of gaps.

Tinotenda Linton
2 min read
Mudarikwa Beekeepers: Quotations, Hives, and Receipts

Mudarikwa Beekeepers sells honey — and behind every jar is a paper trail: quotations, receipts, hive records, apiary logs. This platform digitizes that paper trail end to end, and it's the most architecturally ambitious system in my portfolio. Here's how it's built.

Mudarikwa Beekeepers storefront homepage

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, and the application degrades gracefully 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 auth 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. Building auth yourself is the best way to learn why people use libraries — and occasionally, why they shouldn't.

Commerce and the paper trail

  • Client-side cart (Context + localStorage) with checkout via 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 gauges, and inquiry pipelines with Recharts.

Auditing your own system

The repo contains a dated audit report written plainly: an atomic variant stock decrement with duplicate-checkout protection, server-enforced order status and payment state machines, an Expo push-notification pipeline with delivery records — and the bugs it found (a manual-sale stock issue, dashboard KPI drift) documented as tracked findings. A CMS with a Page Section Registry rounds out the admin, alongside a TipTap blog on its own database.

Mudarikwa admin dashboard (light theme)

The platform's best feature is that the business trusts it — and that trust is earned by fixing what the audit says out loud.