How arpitaghetiya/foodrescue works
FoodRescue connects food donors with verified NGOs through donation listings, claim requests, donor approval, pickup and completion; administrators verify NGOs and moderate the platform. The client provides public discovery, role-specific dashboards and account flows, while the Express API enforces authorization and persists platform records through Prisma. The README documents SQLite and lifecycle capabilities; some implementation details are unsampled, so those relationships are shown only where documented or evidenced by the excerpts and source index.
Main entry points: App.tsx Application routing · api.ts API client · prisma.ts Prisma client · index.ts REST API server
Components 26
Web client
- Application routing
client/src/App.tsx - Account and session
client/src/context/AuthContext.tsx - Public discovery
client/src/pages/LandingPage.tsx - Donor dashboard
client/src/pages/donor/DonorDashboard.tsx - Create donation
client/src/pages/donor/CreateDonationPage.tsx - NGO browsing
client/src/pages/ngo/BrowseDonationsPage.tsx - NGO requests
client/src/pages/ngo/NgoDashboard.tsx - API client
client/src/services/api.ts
Donation workflow
- Donation routes
server/src/routes/donationRoutes.ts - Request routes
server/src/routes/requestRoutes.ts - Listing lifecycle
server/src/controllers/donationController.ts - Request lifecycle
server/src/controllers/requestController.ts
API and security
- REST API server
server/src/index.ts - Authentication routes
server/src/routes/authRoutes.ts - Account services
server/src/controllers/authController.ts - JWT and role checks
server/src/middleware/auth.ts - JWT utilities
server/src/utils/token.ts
Administration
- Admin console
client/src/pages/admin/AdminDashboard.tsx - Admin routes
server/src/routes/adminRoutes.ts - Public statistics
server/src/routes/statsRoutes.ts - Verification and moderation
server/src/controllers/adminController.ts
Persistence
- Prisma client
server/src/prisma.ts - SQLite records
server/prisma
Other components
- Food donor
- Verified NGO
- Administrator
Connections 37
- Application routing → Account and session: provides session
client/src/App.tsx - Application routing → Public discovery: routes to
client/src/App.tsx - Application routing → Donor dashboard: routes to
client/src/App.tsx - Application routing → Create donation: routes to
client/src/App.tsx - Application routing → NGO browsing: routes to
client/src/App.tsx - Application routing → NGO requests: routes to
client/src/App.tsx - Application routing → Admin console: routes to
client/src/App.tsx - Public discovery → API client: fetches summary
client/src/pages/LandingPage.tsx - Account and session → API client: calls account API
client/src/context/AuthContext.tsx - Donor dashboard → API client: uses API
client/src/pages/donor/DonorDashboard.tsx - Create donation → API client: uses API
client/src/pages/donor/CreateDonationPage.tsx - NGO browsing → API client: uses API
client/src/pages/ngo/BrowseDonationsPage.tsx - NGO requests → API client: uses API
client/src/pages/ngo/NgoDashboard.tsx - Admin console → API client: uses API
client/src/pages/admin/AdminDashboard.tsx - API client → REST API server: sends REST requests
- REST API server → Authentication routes: mounts
server/src/index.ts - REST API server → Donation routes: mounts
server/src/index.ts - REST API server → Request routes: mounts
server/src/index.ts - REST API server → Admin routes: mounts
server/src/index.ts - REST API server → Public statistics: mounts
server/src/index.ts - Authentication routes → Account services: dispatches to
server/src/routes/authRoutes.ts - Donation routes → Listing lifecycle: dispatches to
server/src/routes/donationRoutes.ts - Request routes → Request lifecycle: dispatches to
server/src/routes/requestRoutes.ts - Request routes → JWT and role checks: checks access
server/src/routes/requestRoutes.ts - Admin routes → Verification and moderation: dispatches to
server/src/routes/adminRoutes.ts - Admin console → Verification and moderation: requests verification
- Account services → Prisma client: queries records
server/src/controllers/authController.ts - Listing lifecycle → Prisma client: reads and writes
server/src/controllers/donationController.ts - Request lifecycle → Prisma client: reads and writes
server/src/controllers/requestController.ts - Verification and moderation → Prisma client: reads and writes
server/src/controllers/adminController.ts - Public statistics → Prisma client: queries statistics
server/src/routes/statsRoutes.ts - JWT and role checks → JWT utilities: verifies tokens
server/src/middleware/auth.ts - JWT and role checks → Prisma client: loads user
server/src/middleware/auth.ts - Prisma client → SQLite records: persists records
- Food donor → Create donation: posts surplus
- Verified NGO → NGO browsing: browses listings
- Administrator → Admin console: manages platform