
05 · Agricultural marketplace
Apex Grain Market
Buy crops directly from verified farmers.
- Category
- Agricultural marketplace
- Role
- Full-stack engineering, with a co-developer
- Built by
- Empire Pro Dev
- Links
- Live product


Screens
Apex Grain Market interface
Overview
An agricultural e-commerce marketplace for Tanzania that connects buyers with verified farmers and vendors of grains, cereals and other crops. It covers listings, cart and checkout, shipping quotes, promoted ads, chat and announcements, and bulk SMS, in English and Kiswahili.
Product areas
- Buyers
- Verified vendors
- Crop listings
- Cart & checkout
- Shipping quotes
- Ads
- Chat & announcements
- Bulk SMS
- Administration
- English & Kiswahili
Technologies
- Next.js
- TypeScript
- Prisma
- PostgreSQL
- NextAuth
- next-intl
Case study
From problem to product
The complete engineering lifecycle behind Apex Grain Market.
- 01
Problem
Buyers of grains and cereals need a trustworthy way to find quality produce and deal directly with the farmers who grow it.
- Buyers struggle to find reliable sources of quality produce
- Farmers depend on middlemen to reach buyers
- Many farmers are easier to reach by text message than through an app
- 02
Idea
Apex Grain Market: one marketplace where verified farmers list their crops and buyers order directly, with the chat, announcements and SMS reach that agricultural trade relies on.
- Verified vendors and a moderated listing catalogue
- Chat, support and announcements built into the marketplace
- Bulk SMS, so announcements reach farmers without mobile data
- 03
Approach
Apex Grain Market was built with a co-developer, feature by feature: first the core buy-and-sell loop, then the communication, advertising and administration around it.
- Kiswahili and English from the first screen, not added as a later translation
- A fallback for every feature that depends on an outside service
- Admin and staff tools built alongside the buyer experience
- 04
Architecture
Buyers, vendors, staff and administrators each work in their own area of one Next.js application, backed by PostgreSQL through Prisma. Announcements posted in chat can also go out as bulk SMS, with delivery reports tracked for each recipient.
- Role-based areas for buyers, vendors, staff and administrators
- Realtime chat over WebSockets, switching to polling automatically when a socket is unavailable
- Email sent over SMTP, with an HTTPS email API as the fallback
System architecture
3 layers · 9 modules
L01Experiences
3 modules- Buyer marketplace
- Vendor workspace
- Admin console
L02Services
4 modules- Listings & categories
- Orders & shipping quotes
- Ads & engagement
- Chat, announcements & SMS
L03Data
2 modules- PostgreSQL · Prisma
- Uploaded media
Conceptual architecture: layers and their responsibilities. - 05
Design
The marketplace is mobile-first and installable, with a bottom navigation bar on phones and crop cards that show units, quality and discounts at a glance.
- Crop units shown in the reader's own language
- A floating chat button with swipe-to-reply
- Custom error pages and loading states throughout
- 06
Development
The application is TypeScript on Next.js with Prisma and PostgreSQL, and NextAuth for accounts, email verification and password resets.
- Ads with scheduled start and end dates, likes and comments
- Shipping quotes on orders
- Expense tracking for the business behind the marketplace
- Notifications to admins and staff when listings, vendors, ads or expenses are created
- 07
Data
PostgreSQL holds users, vendors, listings, orders, ads and conversations, with a Prisma migration committed for every schema change.
- Admin analytics across orders, listings and vendors
- An SMS delivery report stored for each recipient
- Uploaded images optimised before they are stored
- 08
Testing
Every deployment is checked against a short release list: the home page loads, sign-in and registration work, uploads persist and database writes succeed.
- Bulk SMS tried on a single test number before any real announcement
- The SMS test endpoint restricted to administrators and staff
- Email delivery confirmed on the fallback path when SMTP times out
- 09
Deployment
Apex Grain Market is live on Vercel, with PostgreSQL behind Prisma and uploaded images served from Cloudflare storage. A Railway setup with a managed database and a persistent upload volume is kept ready as an alternative host.
- Live at apexgrainmarket.vercel.app
- Installable as an app on phones and desktops
- One setting to choose between realtime sockets and polling
- 10
Result & current state
The marketplace is live with a clearly labelled sample catalogue, so buyers, vendors and partners can explore every screen, in English or Kiswahili, before real listings go up.
- Complete: listings, cart, checkout, shipping quotes, ads, chat, announcements, bulk SMS and admin
- Next: onboarding the first verified vendors and their real listings
What building it taught.
Challenges
- Reaching farmers who are not always online
- Realtime chat on a host that exposes only one public port
- Email failing where SMTP ports are blocked
Solutions
- Announcements that also go out as bulk SMS, with delivery reports
- A polling fallback that switches on automatically
- An HTTPS email API used whenever SMTP times out
Lessons
- Design for the network your users actually have
- Every outside dependency needs a plan for when it is down
- Language support is cheapest when it starts on day one





