- What is this project?
- Why it’s useful
- Tech stack
- Quick start
- API overview
- Development notes & useful scripts
- Where to get help
- Contributing & maintainers
- Acknowledgements
Nourish is a full-stack food donation platform that connects donors, delivery riders, and beneficiary organisations. The backend (Express + Prisma) exposes APIs for authentication, donations, and admin reporting; the frontend is a Vite + React app that consumes those APIs.
- Centralises food donation workflows: donors, riders, and organisations.
- Automated assignment logic for organisations and available riders.
- Lightweight, developer-friendly stack for rapid iteration (Prisma, Express, Vite, React).
- Backend: Node.js, Express, Prisma, PostgreSQL
- Frontend: Vite, React, TypeScript, Tailwind CSS
- Auth: JWT
A short guide to get the project running locally.
- Node.js (>= 18) and npm
- PostgreSQL database
- Optional: pnpm or yarn
- Open terminal and install dependencies:
cd backend
npm install- Create a
.envfile inbackend/with at least the following variables:
DATABASE_URL=postgresql://USER:PASSWORD@HOST:PORT/DATABASE
JWT_SECRET=replace_with_a_secure_secret
PORT=5000 # optional- Run Prisma migrations (development):
# inside backend/
npx prisma migrate dev --name init
# or to apply already-created migrations in CI/production
# npx prisma migrate deploy- (Optional) Seed the database with an admin user:
# inside backend/
node prisma/seed.js- Start the backend dev server:
cd backend
npm run dev
# server runs on http://localhost:5000 by default- Install dependencies and start dev server:
cd frontend
npm install
npm run dev
# app served by Vite, typically on http://localhost:5173Note: The frontend's API base URL is
http://localhost:5000/apiby default (seefrontend/src/lib/api.ts). Ensure the backend is running onPORT=5000or update the base URL accordingly.
- Schema file:
backend/prisma/schema.prisma - Run interactive DB GUI:
cd backend
npx prisma studioThis is a short reference for common endpoints. See code in backend/src/controllers and backend/src/routes for details.
-
Authentication
- POST
/api/auth/signup— Register a user (roles:DONOR,RIDER,ORGANISATION,ADMIN) - POST
/api/auth/login— Login (returns JWT token)
- POST
-
Donations
- POST
/api/donations/— Create a donation (Auth required —Bearer <token>) - GET
/api/donations/my— Donor's donations (Auth) - GET
/api/donations/rider— Rider's assigned/delivering donations (Auth) - PATCH
/api/donations/:id/rider-action— Rider accepts/rejects assignment (Auth) - PATCH
/api/donations/:id/status— Update donation status (Auth) - GET
/api/donations/organisation— Organisation's donations (Auth)
- POST
-
Admin
- GET
/api/admin/stats— Aggregated stats and recent items - GET
/api/admin/donations— All donations - GET
/api/admin/donations/:id— Donation details - GET
/api/admin/donors|riders|organisations— Lists and details
- GET
# Signup
curl -X POST http://localhost:5000/api/auth/signup \
-H 'Content-Type: application/json' \
-d '{"role":"DONOR","name":"Alice","email":"alice@example.com","password":"secret"}'
# Login
curl -X POST http://localhost:5000/api/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"alice@example.com","password":"secret","role":"DONOR"}'
# response contains `token` — include as `Authorization: Bearer <token>` in subsequent requestscurl -X POST http://localhost:5000/api/donations/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"pickupTime":"2025-12-21T10:00:00.000Z",
"notes":"Extra bread and fruits",
"foodItems":[{"name":"Bread","quantity":10,"unit":"loaves","category":"Bakery"}]
}'- Backend
npm run dev— Start Express server withnodemon(frombackend/)- Prisma commands:
npx prisma migrate dev,npx prisma studio
- Frontend
npm run dev— Start Vite dev server (fromfrontend/)npm run build— Create production build
Useful file pointers:
backend/src/app.js— Express app (registered routes)backend/src/routes/*— Routes for auth, donations, adminbackend/src/controllers/*— API logicbackend/prisma/schema.prisma— DB modelsfrontend/src/lib/api.ts— Axios instance and base API URL