Inspiration Every day, restaurants, bakeries, caterers, and wedding halls end up with edible surplus food while local NGOs and community kitchens struggle to source enough meals. In most places, coordination happens through last-minute phone calls or scattered messages—meaning donors don't know which organizations actually have capacity, volunteers drop off mid-pickup, and large donations go to waste because no single NGO can take everything at once.

We built RePlate to turn surplus food rescue into a reliable, accountable, end-to-end operation rather than a simple bulletin board.

What It Does

  • RePlate connects four stakeholders—Food Donors, NGOs, Volunteers, and Administrators—around a single real-time rescue lifecycle:
  1. Donors List Surplus: Donors post available meals with quantity, category, storage/packaging details, pickup address, and deadline. The matching engine ranks verified NGOs and lets donors send targeted offers (or leave the listing open for direct claims).
  2. Partial & Multi-NGO Allocations: A 120-meal donation doesn't have to go to one place. Multiple NGOs can claim or accept partial quantities based on their active demand and daily receiving capacity.
  3. Volunteer Pickup & Safety Checks: Once an NGO accepts or claims an allocation, an open pickup task is created for volunteers. At pickup, volunteers complete a 4-point food-safety checklist (preparation time, storage, packaging, and contamination check).
  4. Code-Verified Handover & Recovery: Accepting a task generates a 6-character handover code stored as a SHA-256 hash. Delivery is only marked complete when verified with that code and the actual delivered quantity. If a volunteer cancels, admins can reassign the pickup without losing the food.

How We Built It

  • Frontend: React 18, TypeScript, Vite, Tailwind CSS, React Router, Recharts, and Lucide Icons—featuring custom 2D animated role banners, a 4-stage live rescue pipeline tracker, and visual analytics.
  • Backend & Security: Supabase (PostgreSQL, Auth, Row-Level Security, and SECURITY DEFINER PL/pgSQL RPCs).
  • Smart Matching Engine: Ranks verified NGOs using a weighted multi-factor score:

Challenges We Faced

  • Preventing Over-Allocation: When multiple NGOs claim or accept parts of the same donation concurrently, naive client-side updates can over-allocate food. We solved this using row-level locking (SELECT ... FOR UPDATE) inside PostgreSQL transactional RPCs (accept_match, claim_donation).
  • Multi-Role RLS vs. Cross-Stakeholder Visibility: Strict Row-Level Security keeps user data isolated, but complex joins across donations, matches, assignments, and safety_checks caused visibility gaps between donors, NGOs, and volunteers. We refactored sensitive cross-role reads and state transitions into auth.uid()-verified SECURITY DEFINER RPCs.
  • Persistent Handover Codes: Volunteers handling multiple rescues needed reliable access to their active handover codes across refreshes without weakening verification, which we solved by pairing SHA-256 hash verification with assignment-scoped code retrieval.

What We Learned

  • Designing state machines in SQL (available → partially_allocated → fully_allocated → in_rescue → completed) keeps business invariants intact even under concurrent requests.
  • Good coordination software isn't just about the "happy path"—handling failed pickups, partial quantities, and audit trails (rescue_events) is what makes a rescue platform usable in the real world.

What's Next for RePlate

  • Real-time push/WhatsApp alerts for urgent pickup deadlines
  • Live GPS routing and interactive map pins for donors and NGOs
  • Photo proof uploads at pickup and delivery via Supabase Storage

Built With

Share this project:

Updates

Submission history