Backend system for a food donation platform connecting restaurants and eateries with communities to reduce food waste.
Food waste in the restaurant industry is a coordination problem: surplus food exists, communities need it, but there's no reliable system connecting them. ShareABite is the backend infrastructure that makes that coordination work: role-separated access, consistent API contracts, and a data model built for real operational workflows.
The API covers authentication, role management, donation workflows, and pickup request handling, all with a consistent response structure.
The architecture supports three distinct client types: a restaurant portal, an eatery dashboard, and an admin panel, each with separate permissions managed through role-based access control.
Three distinct client types (Admin, Eatery, Restaurant), each with different data access requirements. The goal was clean role separation at the API layer, so each client sees exactly what it should and nothing else.
A complete API covering all core workflows: authentication, role separation, donation listings, and pickup requests. Consistent response contracts and clean architecture, ready for team handoff.
Role-based JWT middleware over per-route authorization logic
Three client types needed different permission sets without a complex permissions table. JWT claims carry the role; a single middleware layer checks it before the route handler runs. Stateless, simple, and consistent. Adding a new protected route required no changes to the auth logic.
MongoDB for donation listing schemas
Food donation listings have variable fields: item types, quantities, expiry windows, dietary flags, and pickup availability. A flexible document structure handled this better than forcing a rigid relational schema onto inherently semi-structured listing data.
Consistent API response envelope across all endpoints
All endpoints return { success, data, message }. With three client types and a planned team handoff, inconsistent response shapes would have caused brittle frontend parsing. A shared envelope made integration predictable and reduced coordination overhead between the API and consuming clients.
3
Auth roles
4
Entity schemas
5
Resource groups
Unified
Response contract