BloodVault is a full-stack web application that revolutionizes blood donation and distribution by creating a centralized, real-time blood inventory system. The platform connects blood donors, hospitals, and individuals in need through an intuitive interface that requires no login for searching blood availability.
During medical emergencies, finding the right blood type quickly can mean the difference between life and death:
- π©Έ Blood shortages cause preventable deaths annually
- π₯ Hospitals struggle to maintain optimal inventory levels
- β° Manual coordination between donors and recipients wastes critical time
- π No centralized database of blood availability across locations
- π Patients' families must call multiple hospitals individually
BloodVault eliminates these pain points through:
- Public Blood Search - Anyone can search for available blood without creating an account
- Real-time Inventory - Hospitals update stock instantly, visible to all users
- Direct Communication - Contact information provided for immediate coordination
- Donor Network - Platform to connect willing donors with those in need
- Location-based Matching - Find blood near you using city and state filters
- Two-way Requests - Hospitals can request blood, donors can offer donations
- Search available blood by type, city, and state
- View real-time inventory from all registered hospitals
- See blood expiry dates and quantities
- Get hospital contact information instantly
- Filter by location for nearby options
- Browse urgent blood requirements from hospitals
- View patient details and urgency levels
- Filter by blood type and location
- Access contact information for immediate response
- No registration needed to view or contact
- Register with blood type and location
- Persistent login (stays logged in across sessions)
- Update profile information
- Dashboard with personalized statistics
- Offer to Donate - Post blood donation offers publicly
- Search Needs - Find patients/hospitals needing your blood type
- Location Matching - See nearby blood requirements
- Request Blood - Create urgent requests for family/friends
- Manage Requests - Track and update all your requests
- Status Updates - Mark requests as fulfilled or cancel them
- View active donation offers
- Track blood requests created
- See nearby urgent needs
- Statistics on your contributions
- Upload Blood Stock - Add available blood units to public database
- Update Inventory - Modify quantities, expiry dates, status
- Delete Items - Remove expired or used blood units
- Real-time Sync - Changes reflect immediately in public search
- Bulk Operations - Manage multiple blood types efficiently
- Post Requirements - Create urgent blood need requests
- Patient Details - Add patient name and contact for emergencies
- Urgency Levels - System auto-calculates urgency based on date
- Status Tracking - Monitor active, fulfilled, and cancelled requests
- Public Visibility - Requests appear on public dashboard
- Find Donors - Search for donors by blood type and location
- View Offers - See all active blood donation offers
- Contact Donors - Direct communication with willing donors
- Filter Options - Sort by blood type, location, date
- Total stock overview (all blood types combined)
- Active requests counter
- Urgent needs tracker
- Quick action buttons (Upload Stock, Request Blood)
- Recent donor offers feed
- Inventory table with expiry tracking
- JWT-based - Secure token authentication
- Password Encryption - bcrypt hashing for user passwords
- Hospital Verification - Secret key required for hospital accounts
- Persistent Sessions - localStorage for seamless experience
- Auto-logout - Session management for security
- Role-based Routes - Donors and hospitals have separate dashboards
- Protected Endpoints - Middleware verification on sensitive operations
- Data Privacy - Users see only authorized information
- Safe Defaults - Public data carefully filtered
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (React) β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Public Pages β β Donor β β Hospital β β
β β (No Auth) β β Dashboard β β Dashboard β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β β
β ββββββββββββββββββββΌββββββββββββββββββββ β
β β β
β βββββββββΌβββββββββ β
β β API Service β β
β β (Axios) β β
β βββββββββ¬βββββββββ β
ββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β
HTTP/HTTPS Requests
β
ββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β BACKEND (Node.js + Express) β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API Routes β β
β β /api/auth /api/inventory β β
β β /api/blood-requests /api/public β β
β βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ β
β β Middleware Layer β β
β β β’ JWT Verification β’ CORS β’ Error Handling β β
β βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ β
β β Controllers β β
β β β’ Business Logic β’ Validation β’ Processing β β
β βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ β
β β Mongoose Models β β
β β β’ User β’ Inventory β’ BloodRequest β β
β βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β
β Database Queries
β
ββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β MongoDB Atlas β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Users β β Inventories β βBlood Requestsβ β
β β Collection β β Collection β β Collection β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
User β Search Blood Page β Select (A+, Mumbai, Maharashtra)
β Frontend sends GET /api/public/search-blood?bloodType=A+&city=Mumbai
β Backend queries Inventory collection
β Returns matching blood stock with hospital details
β Frontend displays results in BloodStockCard components
β User sees: 3 hospitals with A+ blood in Mumbai
β User clicks "Contact Hospital" to get phone number
Hospital Login β Hospital Dashboard β Click "Upload Blood Stock"
β Fill form (O+, 50 units, expiry: 30 days)
β Frontend sends POST /api/inventory/upload with JWT token
β Backend verifies token (authMiddleware)
β Checks user role = hospital
β Saves to Inventory collection with hospital reference
β Returns success
β Frontend redirects to My Inventory
β Blood now visible in public search immediately
Donor Login β Donor Dashboard β Click "Offer Blood Donation"
β Form pre-filled with donor's blood type (O+), city, state
β Donor enters quantity (1), available date, notes
β Frontend sends POST /api/blood-requests/create
β Backend validates: requestType=donation, requesterType=donor
β Auto-calculates urgency based on date
β Saves to BloodRequest collection
β Returns success
β Hospitals can now see this offer in "Find Donors" page
- Visit the homepage or click "Search Blood" in navbar
- Select blood type from dropdown (A+, B+, O+, etc.)
- Enter city and state (e.g., Mumbai, Maharashtra)
- Click "Search" button
- View available blood stock from hospitals:
- Blood type and quantity
- Hospital name and location
- Expiry date
- Contact number
- Call hospital directly or visit for blood
- Visit homepage (public dashboard)
- See list of urgent blood requirements
- Filter by:
- Blood type
- City
- State
- Urgency level
- View patient details and contact information
- Contact hospital/donor to help
- Click "Register" in navbar
- Select "I am a Donor"
- Fill form:
- Full Name
- Email (used for login)
- Password (minimum 6 characters)
- Phone number
- Blood type (A+, A-, B+, B-, AB+, AB-, O+, O-)
- City and State
- Address (optional)
- Click "Register"
- Redirect to login page
- Login with email and password
- Login to donor account
- Navigate to "Offer Blood Donation" (navbar or dashboard button)
- Form shows:
- Request type: Donation (pre-selected)
- Blood type: Your blood type (auto-filled)
- Quantity: Number of units (1-2 typically)
- Available by: Date when you can donate
- City/State: Your location (auto-filled, can change)
- Contact person: Your name (auto-filled)
- Contact number: Your phone (auto-filled)
- Additional notes: Optional message
- Click "Submit Donation Offer"
- View confirmation message
- Offer appears in hospital's "Find Donors" page
- Hospitals can contact you directly
- Login to donor account
- Click "Request Blood" in navbar
- Toggle to "Need Blood (Request)"
- Fill form:
- Blood type needed
- Quantity required
- Required by date
- Patient name
- Patient contact
- Your location
- Submit request
- Request appears on public dashboard
- Hospitals/donors can see and contact you
- Go to "Manage Requests"
- View all your requests (donations offers + blood needs)
- For each request:
- See status (Active, Fulfilled, Cancelled)
- View creation date and details
- Update status when completed
- Delete request if no longer needed
- Click "Register" in navbar
- Select "I am a Hospital/Blood Bank"
- Fill form:
- Organization Name (hospital name)
- Email (official hospital email)
- Password
- Hospital Secret Key (obtain from admin)
- Phone number
- City and State
- Address
- Click "Register"
- Login with email, password, and secret key
- Login to hospital account
- Navigate to "Upload Blood Stock"
- Fill form:
- Blood type (A+, B+, O+, etc.)
- Quantity (number of units available)
- Expiry date (when blood expires)
- City/State (auto-filled from profile)
- Contact number (auto-filled from profile)
- Click "Upload Blood Stock"
- Blood appears in:
- Your inventory ("My Inventory" page)
- Public search results immediately
- Public homepage stock feed
- Go to "My Inventory" from navbar
- View all uploaded blood stock:
- Blood type
- Quantity
- Expiry date
- Status (Available, Reserved, Expired)
- Actions:
- Update: Click edit icon, modify quantity/status
- Delete: Remove expired or used blood
- Filter: Search by blood type or status
- Changes reflect in public search immediately
- Click "Request Blood" in navbar or dashboard
- Select "Need Blood (Request)"
- Fill form:
- Blood type needed
- Quantity required
- Required by date (urgency auto-calculated)
- Patient name
- Patient contact
- Hospital location (auto-filled)
- Notes (optional: reason, urgency details)
- Submit request
- Request appears:
- Public dashboard (homepage)
- Donors can see and contact you
- Your "Manage Requests" page
- Navigate to "Find Donors" page
- View all active blood donation offers
- Filter by:
- Blood type
- City
- State
- See donor information:
- Blood type and quantity
- Location
- Available date
- Contact number
- Call donor directly to coordinate
| Technology | Version | Purpose |
|---|---|---|
| React | 18.2.0 | UI library for building components |
| React Router | 6.10.0 | Client-side routing and navigation |
| Axios | 1.3.4 | HTTP client for API requests |
| Tailwind CSS | 3.3.0 | Utility-first CSS framework |
| Context API | Built-in | Global state management (auth) |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 16+ | JavaScript runtime environment |
| Express.js | 4.18.2 | Web application framework |
| MongoDB | 5+ | NoSQL database |
| Mongoose | 7.0.0 | MongoDB object modeling (ODM) |
| JWT | 9.0.0 | JSON Web Tokens for authentication |
| bcryptjs | 2.4.3 | Password hashing |
| CORS | 2.8.5 | Cross-origin resource sharing |
| dotenv | 16.0.3 | Environment variable management |
- Nodemon - Auto-restart server on changes
- Postman - API testing and documentation
- MongoDB Compass - Database GUI for debugging
- Git - Version control
- Frontend: Vercel / Netlify
- Backend: Render / Railway / Heroku
- Database: MongoDB Atlas (Cloud)
MongoDB: bloodvault
βββ users (Donors + Hospitals)
βββ inventories (Blood Stock)
βββ bloodrequests (Needs + Offers)
{
_id: ObjectId("..."),
role: "donor" | "hospital" | "organization",
// Common fields
email: "user@example.com",
password: "$2a$10$hashed_password...",
phone: "+919876543210",
city: "Mumbai",
state: "Maharashtra",
address: "123 Main Street",
// Donor-specific
name: "John Doe",
bloodType: "O+",
// Hospital-specific
organizationName: "Apollo Hospital",
hospitalSecretKey: "apollo123",
// Timestamps
createdAt: ISODate("2025-01-15T10:30:00Z"),
updatedAt: ISODate("2025-01-20T14:45:00Z")
}Indexes: email (unique), role, city, bloodType
{
_id: ObjectId("..."),
hospital: ObjectId("..."), // Reference to User
bloodType: "A+",
quantity: 25,
expiryDate: ISODate("2025-03-15T00:00:00Z"),
status: "available" | "reserved" | "expired",
// Location (copied from hospital for faster queries)
city: "Mumbai",
state: "Maharashtra",
address: "Apollo Hospital, Bandra West",
contactNumber: "+912212345678",
// Timestamps
createdAt: ISODate("2025-01-15T10:30:00Z"),
updatedAt: ISODate("2025-02-01T09:15:00Z")
}Indexes: hospital, bloodType, city, status, expiryDate
{
_id: ObjectId("..."),
requestType: "need" | "donation",
requesterType: "hospital" | "donor",
requester: ObjectId("..."), // Reference to User
// Blood details
bloodType: "B+",
quantity: 3,
requiredBy: ISODate("2025-02-10T00:00:00Z"),
urgency: "normal" | "moderate" | "urgent", // Auto-calculated
// Location
city: "Delhi",
state: "Delhi",
address: "Max Hospital, Saket",
// Patient info (only for "need" requests)
patientName: "Jane Smith",
patientContact: "+919876543210",
// Contact info
contactPerson: "Dr. Kumar",
contactNumber: "+911112345678",
notes: "Emergency surgery required",
// Status
status: "active" | "fulfilled" | "cancelled",
isPublic: true,
// Timestamps
createdAt: ISODate("2025-01-18T14:20:00Z"),
updatedAt: ISODate("2025-01-19T11:30:00Z")
}Indexes: requester, requestType, bloodType, city, status, urgency
Production: https://api.bloodvault.com/api
Development: http://localhost:5000/api
POST /api/auth/register
Content-Type: application/json
{
"role": "donor",
"name": "John Doe",
"email": "john@example.com",
"password": "password123",
"phone": "+919876543210",
"bloodType": "O+",
"city": "Mumbai",
"state": "Maharashtra",
"address": "123 Main St"
}
Response (201):
{
"success": true,
"message": "User registered successfully",
"data": {
"_id": "...",
"name": "John Doe",
"email": "john@example.com",
"role": "donor",
"token": "eyJhbGc..."
}
}POST /api/auth/login
Content-Type: application/json
{
"email": "john@example.com",
"password": "password123"
}
Response (200):
{
"success": true,
"token": "eyJhbGc...",
"user": {
"_id": "...",
"name": "John Doe",
"email": "john@example.com",
"role": "donor",
"bloodType": "O+",
"city": "Mumbai",
"state": "Maharashtra"
}
}GET /api/auth/me
Authorization: Bearer <token>
Response (200):
{
"success": true,
"user": { ... }
}GET /api/public/search-blood?bloodType=A+&city=Mumbai&state=Maharashtra
Response (200):
{
"success": true,
"count": 3,
"data": [
{
"_id": "...",
"bloodType": "A+",
"quantity": 15,
"expiryDate": "2025-11-15T00:00:00.000Z",
"city": "Mumbai",
"state": "Maharashtra",
"address": "Apollo Hospital, Bandra",
"contactNumber": "+912212345678",
"hospital": {
"organizationName": "Apollo Hospital",
"phone": "+912212345678"
}
}
]
}GET /api/public/blood-needs?bloodType=B+&city=Delhi
Response (200):
{
"success": true,
"count": 2,
"data": [
{
"_id": "...",
"requestType": "need",
"bloodType": "B+",
"quantity": 3,
"requiredBy": "2025-10-20T00:00:00.000Z",
"urgency": "urgent",
"city": "Delhi",
"patientName": "Patient Name",
"contactPerson": "Dr. Smith",
"contactNumber": "+911112345678",
"requester": {
"organizationName": "Max Hospital"
}
}
]
}POST /api/inventory/upload
Authorization: Bearer <hospital_token>
Content-Type: application/json
{
"bloodType": "O+",
"quantity": 20,
"expiryDate": "2025-12-31",
"city": "Mumbai",
"state": "Maharashtra",
"address": "Apollo Hospital, Bandra",
"contactNumber": "+912212345678"
}
Response (201):
{
"success": true,
"message": "Blood stock uploaded successfully",
"data": { ... }
}GET /api/inventory/my-inventory
Authorization: Bearer <hospital_token>
Response (200):
{
"success": true,
"count": 5,
"data": [...]
}PUT /api/inventory/:id
Authorization: Bearer <hospital_token>
Content-Type: application/json
{
"quantity": 15,
"status": "available"
}DELETE /api/inventory/:id
Authorization: Bearer <hospital_token>
Response (200):
{
"success": true,
"message": "Blood inventory deleted successfully"
}POST /api/blood-requests/create
Authorization: Bearer <token>
Content-Type: application/json
{
"requestType": "need",
"requesterType": "hospital",
"bloodType": "A+",
"quantity": 3,
"requiredBy": "2025-10-25",
"city": "Mumbai",
"state": "Maharashtra",
"patientName": "Patient Name",
"patientContact": "+919876543210",
"contactPerson": "Dr. Smith",
"contactNumber": "+912212345678",
"notes": "Emergency surgery"
}
Response (201):
{
"success": true,
"message": "Blood request created successfully",
"data": { ... }
}GET /api/blood-requests/all?requestType=donation&bloodType=O+&city=Delhi
Authorization: Bearer <token>
Query Parameters:
- requestType: need | donation
- bloodType: A+, B+, O+, etc.
- city: City name
- state: State name
- status: active | fulfilled | cancelled
- urgency: normal | moderate | urgentGET /api/blood-requests/my-requests
Authorization: Bearer <token>
Response (200):
{
"success": true,
"count": 2,
"data": [...]
}PUT /api/blood-requests/:id/status
Authorization: Bearer <token>
Content-Type: application/json
{
"status": "fulfilled"
}DELETE /api/blood-requests/:id
Authorization: Bearer <token>
Response (200):
{
"success": true,
"message": "Blood request deleted successfully"
}After running seed script (node seedData.js):
Hospitals:
Email: apollohospital@hospital.com
Password: password123
Secret Key: apollo123
Email: maxhealthcare@hospital.com
Password: password123
Secret Key: max123
Donors:
Email: donor1@gmail.com to donor16@gmail.com
Password: password123
1. Visit homepage (no login)
2. Click "Search Blood"
3. Select: Blood Type = A+, City = Mumbai
4. Verify: See available blood from hospitals
5. Click hospital contact number
6. Expected: Can call/email hospital directly
1. Login as: apollohospital@hospital.com
2. Click "Upload Blood Stock"
3. Fill: O+ blood, 50 units, expiry 30 days from now
4. Submit
5. Verify: Appears in "My Inventory"
6. Logout
7. Go to "Search Blood" (public)
8. Search for O+ in Mumbai
9. Expected: See uploaded blood in results
1. Login as: donor1@gmail.com
2. Click "Offer Blood Donation"
3. Fill form with donation details
4. Submit
5. Verify: Appears in "Manage Requests"
6. Logout
7. Login as hospital
8. Go to "Find Donors"
9. Expected: See donor's offer
- User authentication (donors and hospitals)
- Public blood search (no login)
- Hospital inventory management
- Blood request system (needs + offers)
- Location-based filtering
- Dashboard analytics
- Email notifications for matches
- SMS alerts for urgent needs
- Blood donation history tracking
- Hospital verification system
- Advanced search filters
- Mobile responsive design improvements
- Mobile app (React Native)
- Real-time chat between users
- Blood donation appointments
- Donation camps management
- Analytics and reporting dashboard
- Multi-language support
- Integration with health records
- AI-based blood demand prediction
We welcome contributions from the community! Here's how you can help:
- π Report Bugs - Found an issue? Let us know!
- β¨ Suggest Features - Have ideas? We'd love to hear them
- π Improve Documentation - Help others understand the project
- π» Submit Code - Fix bugs or add features
- π§ͺ Test - Help us find issues before users do
- π Translate - Make BloodVault accessible to more people
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Write clear, commented code
- Follow existing code style (Prettier/ESLint)
- Test your changes thoroughly
- Update documentation as needed
- Keep commits atomic and meaningful
**Made with β€οΈ for saving