BloodLink

BloodLink is a MERN-stack hospital & blood-bank management platform. It gives hospitals, blood banks, medical staff, and donors one system to manage donor records, blood inventory, donations, blood requests, and appointments โ€” with role-based access control and an audit trail.

๐Ÿ”— Live : bloodlink-s5d7.onrender.com


Features

  • Auth & RBAC โ€” JWT login, 7 user roles, passcode-gated staff registration, account status checks
  • Donor management โ€” profiles, blood group, eligibility status, donation history
  • Donation tracking โ€” record donations with unique blood bag IDs and expiry dates
  • Inventory management โ€” blood units move through quarantined โ†’ available โ†’ issued/expired, with a live summary view
  • Blood requests โ€” doctors/nurses raise requests, staff review and fulfill them by issuing specific units
  • Hospital management โ€” multi-hospital support with an approval workflow
  • Appointments โ€” donors book donation slots; staff approve/manage them
  • Notifications โ€” per-user alerts for requests, appointments, and low inventory
  • Blood compatibility lookup โ€” donor/recipient matching for all 8 blood groups
  • Dashboard & reports โ€” key stats: available units, expiring soon, pending/emergency requests
  • Audit logs โ€” action-level trail for admin oversight

Tech Stack

Frontend: React 19, Vite, React Router 7, Axios

Backend: Node.js, Express 4, MongoDB + Mongoose 8, JWT, bcryptjs

Deployment: Render

Project Structure

BloodLink/
โ”œโ”€โ”€ client/                  # React (Vite) frontend
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ context/         # Auth state
โ”‚       โ”œโ”€โ”€ services/        # API calls (Axios)
โ”‚       โ”œโ”€โ”€ layouts/         # Public & dashboard layouts
โ”‚       โ”œโ”€โ”€ components/      # Shared UI (Navbar, etc.)
โ”‚       โ””โ”€โ”€ pages/           # Route-level pages
โ”‚
โ”œโ”€โ”€ server/                  # Express + MongoDB backend
โ”‚   โ”œโ”€โ”€ config/db.js         # MongoDB connection
โ”‚   โ”œโ”€โ”€ models/              # User, Hospital, Donor, BloodDonation,
โ”‚   โ”‚                         # BloodUnit, BloodRequest, Appointment,
โ”‚   โ”‚                         # Notification, AuditLog
โ”‚   โ”œโ”€โ”€ controllers/         # Route logic per resource
โ”‚   โ”œโ”€โ”€ routes/              # Express routers per resource
โ”‚   โ”œโ”€โ”€ middleware/          # JWT auth + role-based access
โ”‚   โ””โ”€โ”€ utils/               # Token generation, helpers
โ”‚
โ””โ”€โ”€ README.md

Getting Started

Requirements: Node.js 18+, npm, a MongoDB connection string (Atlas or local)

git clone https://github.com/RehabTariqq/BloodLink.git
cd BloodLink

# Backend
cd server && npm install

# Frontend
cd ../client && npm install

server/.env

PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLIENT_URL=http://localhost:5173
STAFF_PASSCODE=your_staff_registration_passcode

client/.env (optional โ€” defaults to http://localhost:5000/api)

VITE_API_URL=http://localhost:5000/api

Run it:

# Terminal 1
cd server && npm run dev

# Terminal 2
cd client && npm run dev

Backend: http://localhost:5000 ยท Frontend: http://localhost:5173

API Overview

Base path: /api

Resource Endpoints
Auth POST /auth/register, POST /auth/login, POST /auth/verify-password
Donors GET/POST /donors, GET/PUT/DELETE /donors/:id
Donations GET/POST /donations, GET/PUT /donations/:id
Inventory GET/POST /inventory, GET /inventory/summary, PUT /inventory/:id
Requests GET/POST /requests, GET/PUT/DELETE /requests/:id, POST /requests/:id/issue
Hospitals GET/POST /hospitals, GET/PUT /hospitals/:id
Appointments GET/POST /appointments, PUT /appointments/:id
Notifications GET /notifications, PUT /notifications/:id/read
Compatibility GET /compatibility/:bloodGroup
Reports GET /reports/dashboard
Audit logs GET /audit-logs

All routes except /auth/register and /auth/login require a Bearer JWT; most write actions are further restricted by role.

User Roles

superAdmin ยท hospitalAdmin ยท bloodBankStaff ยท doctor ยท nurse ยท donor ยท patient

Contributing

  1. Fork the repo
  2. Create a branch: git checkout -b feature/your-feature
  3. Commit and push your changes
  4. Open a Pull Request

License

No license specified yet โ€” all rights reserved by the repository owner.

Built With

Share this project:

Updates

Submission history