A mobile-first food donation frontend built with React. The app helps donors browse NGOs, create food donation posts, choose delivery or pickup, and review donation activity.
This repository currently works in two modes:
- Demo mode: no backend required, uses local mock data and
localStorage - Connected mode: uses a backend URL for auth and NGO data
- Splash and sign-in flow
- NGO browsing and search
- NGO detail pages
- Donation type and food category selection
- Food details form
- Donation confirmation flow
- Delivery or pickup selection
- Activity screen for posted donations
- Profile screen with donation count
- React 17
- React Router DOM v5
- CSS Modules
- React Icons
- Create React App (
react-scripts)
The frontend is runnable and builds successfully.
What works now:
- Full frontend flow for posting a donation
- Local demo login
- Local mock NGO data
- Donation activity saved in browser storage
- Production build with
npm run build
What is still not fully production-ready:
- No real backend included in this repository
- No real database persistence
- No real donation submission API yet
- Google auth requires a backend implementation
npm installnpm startThe app will run at:
http://localhost:3000npm run buildIf you do not configure a backend, the app still works locally.
In demo mode:
- sign-in is simulated
- NGOs are loaded from mock data
- donations are stored in
localStorage - no API keys are required
This is the easiest way to preview the app.
To connect the frontend to a backend, create a .env.local file in the project root:
REACT_APP_BACKEND_URL=http://localhost:5000The frontend will then use that backend for supported requests.
If REACT_APP_BACKEND_URL is set, the frontend expects these endpoints:
GET /ngosGET /userGET /logoutGET /auth/google
Notes:
- Requests are sent with
credentials: "include" - The backend should support cookies/sessions and proper CORS configuration
- Donation posting is currently handled locally in the frontend, not through a backend endpoint
- None
- A backend API server
- Google OAuth credentials if you want real Google sign-in
- A database if you want persistent NGO/user/donation data
Recommended backend env vars would look something like:
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
SESSION_SECRET=your_session_secret
CLIENT_URL=http://localhost:3000Important:
- Do not put secret keys in the React app
- Only
REACT_APP_BACKEND_URLbelongs in the frontend env file - All OAuth secrets should live on the backend
From package.json:
npm start- run the development servernpm run build- create a production buildnpm test- run tests
src/
components/ Reusable UI pieces
constants/ Static assets, mock data, form defaults
hooks/ App data hooks
pages/ Route-level screens
services/ API and storage access
public/
images/ Static image assets
src/App.jsmanages routing and top-level flow statesrc/services/api.jshandles backend and local fallback behaviorsrc/hooks/useAuth.jshandles auth statesrc/hooks/useNgoData.jsloads NGO datasrc/hooks/useDonations.jsmanages donation history
- Add a real backend for donations, users, and NGOs
- Replace local donation storage with API persistence
- Add form validation for phone/date/time
- Add tests for core donation flow
- Add volunteer and pickup management workflows
- Upgrade React and routing stack over time
If you want to extend the project, a good order is:
- Keep the current demo mode working
- Add backend support without breaking the local fallback
- Implement real donation APIs
- Add tests around the main donation flow
This project is licensed under the terms in LICENSE.