Technical Spec Part 1: Database Schema & API Endpoints
Back to blog
Agritech 4 min read

Technical Spec Part 1: Database Schema & API Endpoints

MB
Anselmo Boaventura
Maputo Bridge Capital
The Nature of the Harvest · Read free chapters · $19.99

System Architecture

To build a scalable platform for rural development, one must consider the flow of data from the end-user to the backend services. The following architecture provides a blueprint for managing user profiles, field projects, and communication channels.

Frontend (React + Vite)
    ↓
API Gateway (Base44 / Express)
    ↓
Auth Service | Listings Service | Chat Service
    ↓
Database (MongoDB)
  Users | Projects | ChatRooms | Messages

Database Schema

Users Collection

FieldTypeDescription
emailStringRequired, unique
phoneStringFor WhatsApp/SMS alerts
full_nameStringRequired
user_typeEnumfarmer, sponsor, admin
languageEnumpt, en
kyc_verifiedBooleanDefault false
kyc_documentsArrayID/verification uploads
ratingNumberCommunity-based score
online_statusEnumonline, away, offline
notification_prefsObjectemail, sms, whatsapp, push

AgriculturalProjects Collection

FieldTypeDescription
user_idObjectIdProject owner
titleStringProject name or ID
statusEnumdraft, pending, active, completed
crop_typeEnummaize, beans, groundnuts, soy, other
provinceEnumZambezia, Nampula, etc
verification_statusBooleanVerified by MBC
verification_docsStringReceipt and photo metadata
area_hectaresNumberLand size cultivated
harvest_cycleDateExpected maturity date
community_fund_idObjectIdReference to repayment pool
site_photosArrayImage URLs from the field
descriptionStringRich text detail
viewsNumberEngagement metrics
impact_metricsNumberYield improvements documented

ChatRooms Collection

FieldTypeDescription
project_idObjectIdReference to specific project
sender_idObjectIdUser ID
recipient_idObjectIdUser ID
statusEnumactive, closed, archived
participantsArrayMulti-party support
last_message_atDateFor sorting conversations
last_message_previewStringFirst 100 characters
unread_countNumberBadge counter
categoryEnumsupport, general, updates

Messages Collection

FieldTypeDescription
chat_room_idObjectIdReference to chat room
sender_idObjectIdUser ID
typeEnumtext, file, image, voice, system
textStringMessage content
original_languageString"pt", "en"
translationsObjectAuto-translated content
file_urlStringURL for document or image
file_nameStringOriginal filename
file_typeStringMIME type
voice_urlStringURL for audio messages
read_byArrayUser IDs who viewed message
deletedBooleanSoft delete support
Book by Anselmo Boaventura

The Nature of the Harvest

Agriculture as the engine of wealth: ten great books on farming, land, seed, water, risk and innovation, and who funds agriculture in Mozambique.

Read free chapters

PDF ebook, instant download. $5 of every copy buys seed for a farmer.

API Endpoints

Authentication

POST   /api/auth/register     # Create account
POST   /api/auth/login        # Login
POST   /api/auth/verify-kyc   # Upload documentation
GET    /api/auth/me           # Get profile
PUT    /api/auth/me           # Update profile

Agricultural Projects

GET    /api/projects?crop_type=maize&region=zambezia
GET    /api/projects/:slug    # Project details
POST   /api/projects          # Create listing
PUT    /api/projects/:id      # Update listing
DELETE /api/projects/:id      # Delete
POST   /api/projects/:id/verify   # Admin: verify field location
POST   /api/projects/:id/favorite  # Add to watchlist
GET    /api/projects/map      # Geo-coordinates for map view

Chat Rooms

GET    /api/chat/rooms        # User's chat rooms
POST   /api/chat/rooms        # Create room
GET    /api/chat/rooms/:id    # Room details
PUT    /api/chat/rooms/:id    # Close/archive
POST   /api/chat/rooms/:id/participants  # Add field verifier

Messages

GET    /api/chat/rooms/:id/messages?limit=50
POST   /api/chat/rooms/:id/messages  # Send message
PUT    /api/chat/messages/:id       # Edit message
DELETE /api/chat/messages/:id       # Delete message
POST   /api/chat/messages/:id/read  # Mark read
POST   /api/chat/messages/:id/translate  # Translate
POST   /api/chat/upload             # Upload receipt/photo

Sponsorship Deals

GET    /api/deals             # List user's sponsorships
GET    /api/deals/:id         # Sponsorship details
POST   /api/deals             # Create from chat
PUT    /api/deals/:id         # Update status
POST   /api/deals/:id/milestone    # Complete verification
POST   /api/deals/:id/confirm      # Receipt confirmed
POST   /api/deals/:id/rate    # Rate experience

Impact on the Farmer's Season

For a smallholder farmer working with the COJAZ cooperative in Zambezia, these technical systems bridge the gap between their labor and international support. During the season, accurate digital logging ensures that funds reach the local seed and fertilizer shops exactly when needed. By tracking field verification and documentation through these endpoints, the farmer gains transparency, ensuring the integrity of the support system that helps them prepare their soil and secure a successful harvest.

Frequently asked questions

What is an API endpoint? An API endpoint is a specific digital location where an application sends requests to retrieve or update data, such as project listings or message histories.

Why is database schema important? It defines the structure of information, such as how user profiles and project details are organized, ensuring the platform runs reliably.

How does real-time messaging improve project management? Real-time communication allows for rapid coordination between stakeholders, ensuring that documents like field photos and receipts are shared and translated efficiently.

Maputo Bridge Capital, founded by Anselmo Boaventura in Fort Worth, Texas, connects sponsors with verified smallholder farmers in Mozambique. You can sponsor a farmer from just $25 at https://maputobridgecapital.com/sponsor-a-farmer-mozambique. Please note that sponsorships are gifts, not investments, and are not tax-deductible; 92% of your contribution goes directly to the farmer's local seed and fertilizer shop, while 8% covers verification and documentation.

Planting with the November rains

Help Lidia S. plant maize in Quelimane this season

From $25. Your gift buys seed and fertilizer at Lidia's local seed shop, and you get the receipt and field photos.

Meet Lidia

Gifts, not investments. See every sponsorship live.

Partilhar este artigo

Get Mozambique Agriculture Insights

Join sponsors and farmers getting farmer stories, market notes, and updates on where every dollar goes.

No spam. Unsubscribe anytime. We respond within 24 hours.

agritech database designmongodb schemaagricultural APIrural development techdatabase architectureMozambique agricultural data

Get one farmer story a month

— and see where every dollar goes.

Discussion (0)

Be respectful. Comments are moderated.

No comments yet. Be the first to start the discussion.

Ready to sponsor a farmer?

Your gift goes straight to the farmer's seed shop, and you get the receipt. Sponsorships are gifts, not investments.

Last updated: October 10, 2026