Sajjan Dera Platform
We built a livestock inventory and sales system in Next.js deployed on Cloudflare Workers edge nodes.
pages load in under 120ms from Cloudflare's edge network.
inventory counts synchronize in real time to prevent double booking.
System Bottlenecks
Agricultural businesses often use manual checklists and legacy spreadsheets that fail to sync livestock counts, veterinary logs, and customer orders, causing double bookings and delivery delays.
Architectural Move
We built a multi-app system containing a customer storefront, an admin panel, and an automated schema runner. The code is written in Next.js, compiled for Cloudflare Workers using OpenNext, and queries a replicated D1 SQLite database to sync animal records across farm locations.
Execution Path
System Architecture: We built the storefront and the administration portal using Next.js App Router.
Edge Compilation: We configured OpenNext to bundle Next.js assets and API endpoints to run inside Cloudflare Workers.
Migration Runner: We wrote a script in Bun to apply database schema changes across replicated D1 databases using Wrangler.
"The system tracks animal health records and bookings online. We manage reservations directly from the pastures."
— Musa Ibrahim, Managing Director, Sajjan Dera Livestock
Core Stack
- Next.js (App Router)
- OpenNext (Cloudflare adapter)
- Cloudflare D1 (Serverless SQLite)
- Bun (Package manager & scripting)
- Wrangler & TailwindCSS
Under-the-hood Challenge
Running a Next.js application on Cloudflare's edge runtime, which lacks native support for some Node.js libraries. We solved this by setting up OpenNext to bundle polyfilled modules, replacing standard Node libraries with edge-safe equivalents, and writing database queries to Cloudflare D1.
Sajjan Dera moves farm operations to an edge network. Running Next.js on Cloudflare Workers allows the system to scale for seasonal buying spikes without requiring server capacity planning.
How We Shipped This
We write, test, and execute database migrations under strict controls to prevent data loss and downtime.
Create product specs that define what to build, what to skip, and when a spec is done.
