Full-stack app that lets hospitals broadcast urgent blood needs and matches them with registered donors in real time. The project is split into backend (Node/Express) and frontend (Vite/React) so it can be packaged as a web app or wrapped into a mobile container later.
# backend
cd backend
npm install # already run once
echo PORT=4000> .env # optional; defaults shown below
echo CORS_ORIGIN=http://localhost:5173>> .env
npm run dev # starts API with nodemon
# frontend
cd ../frontend
npm install # already run once
echo VITE_API_BASE=http://localhost:4000> .env.local
npm run dev # opens on http://localhost:5173- Endpoints:
GET /healthPOST /api/donorsregister donorGET /api/donorsPATCH /api/donors/:id/statusupdate availability / cooldownPOST /api/requestscreate hospital requestGET /api/requestsPOST /api/requests/:id/responddonor accept/declineGET /api/match?bloodType=O%2B&city=Delhifind eligible donors
- Data is persisted to
backend/data/db.json(simple JSON store). - Config (via
.env):PORT(default4000)CORS_ORIGIN(default*, set to frontend URL in dev)
- Routes:
- Home overview
- Donor registration form
- Donor directory
- Hospital emergency request form
- Live requests list
- Match finder (blood type + city)
- Config (via
.env.local):VITE_API_BASE(defaulthttp://localhost:4000)
- Donation cooldown enforced at 90 days when calculating matches.
- When a donor accepts a request, they are marked
cooldownandlastDonationAtis updated. - To reset data, clear
backend/data/db.jsonwhile the server is stopped.