You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A production-grade, full-stack Blood Bank Management System powered by a custom-trained TensorFlow AI model that performs real-time blood sample infection screening — bridging the gap between donors, recipients, and healthcare providers.
"In India alone, the demand for blood exceeds supply by 3 million units annually. VitalLink was built to solve this with technology."
VitalLink is a healthcare-grade, production-deployed blood bank management system that tackles one of the most critical challenges in modern healthcare: the safe, efficient, and intelligent connection between blood donors, recipients, and healthcare administrators.
🩺 The Problem It Solves
Challenge
VitalLink Solution
Manual blood sample screening is error-prone & slow
Custom-trained TensorFlow AI analyzes blood samples in real-time
No centralized blood request management
Full-stack request workflow with admin approval system
Donors with blood infections slip through
AI infection detection blocks ineligible donors at registration
Hospitals lack transparency into blood requests
Admin dashboard with live stats, inventory charts & activity feed
No paper trail for blood approvals
PDF generation for approved blood requests via jsPDF
Announcements are fragmented
Priority-based announcement system (Normal / Urgent)
💡 Core Innovation
What makes VitalLink unique is its three-service microservices architecture where:
A Vanilla JS frontend (deployed as a static site) handles the user experience
A Node.js/Express REST API (backend service) manages all business logic and database operations
A Python Flask AI microservice runs a custom MobileNetV2-based TensorFlow Lite model for real-time blood infection analysis
These three services communicate seamlessly across the cloud, all deployed independently on Render.
Key Features
🔐 Authentication & Security
Role-based access control — user and admin roles enforced server-side
bcryptjs password hashing with salt rounds for secure credential storage
JWT-ready architecture with session management via localStorage
Protected frontend routes — unauthorized users redirected to login immediately
Admin-only access — dashboard checks user.role === 'admin' before rendering
Database availability guard — all auth routes check MongoDB state before processing
🩸 Donor Registration & AI Screening
Multi-field registration form — Name, Email, Age (18–60), Blood Group
Blood sample image upload with Multer file handling on the backend
Real-time AI blood screening — image sent to Flask AI service for infection detection
Animated progress bar — smooth fake-progress UX while AI processes the image
Binary diagnosis result — NORMAL (eligible) or INFECTION DETECTED (blocked)
Confidence score display — numerical confidence from model output shown to user
Downloadable Donor ID Card — generated via html2canvas as a PNG certificate
Admin AI stats tracking — normal vs. infected donor counts stored and visualized
🆘 Blood Request System
Emergency blood request form — Name, Phone, Blood Group, Reason for request
Duplicate request prevention — users cannot submit if an active request (Pending/Approved) exists
AI microservice — vitallink-ai-service.onrender.com
render.yaml
Infrastructure-as-Code, Blueprint deployment
System Architecture
High-Level Architecture
graph TB
subgraph CLIENT["Client Layer (Static Frontend - Render)"]
U["User Browser"]
A["Admin Browser"]
end
subgraph BACKEND["Backend API - Node.js / Express (Render)"]
API["REST API Server - Port: 3000"]
AUTH["/api/auth - register | login"]
DONORS["/api/donors - POST | GET | ai-stats"]
REQUESTS["/api/requests - CRUD + status"]
MESSAGES["/api/messages - submit | reply"]
ANNOUNCE["/api/announcements - CRUD"]
USERS["/api/users - list | delete"]
ANALYZE["/api/analyze - standalone scan"]
AI_CLIENT["aiClient.js - HTTP Bridge"]
end
subgraph AI["AI Microservice - Python / Flask (Render)"]
FLASK["Flask App - Gunicorn WSGI"]
MODEL["TFLite Interpreter - MobileNetV2"]
INFER["Binary Classification - normal | infected"]
end
subgraph DB["Database - MongoDB Atlas"]
USERS_COL[("users")]
DONORS_COL[("donors")]
REQUESTS_COL[("bloodrequests")]
MESSAGES_COL[("messages")]
ANNOUNCE_COL[("announcements")]
end
U -->|"HTTPS Fetch"| API
A -->|"HTTPS Fetch"| API
API --> AUTH & DONORS & REQUESTS & MESSAGES & ANNOUNCE & USERS & ANALYZE
DONORS --> AI_CLIENT
ANALYZE --> AI_CLIENT
AI_CLIENT -->|"POST imageBase64 JSON"| FLASK
FLASK --> MODEL --> INFER
INFER -->|"result + confidence"| AI_CLIENT
AUTH --> USERS_COL
DONORS --> DONORS_COL
REQUESTS --> REQUESTS_COL
MESSAGES --> MESSAGES_COL
ANNOUNCE --> ANNOUNCE_COL
Loading
Authentication Flow
sequenceDiagram
participant U as User
participant F as Frontend
participant B as Backend API
participant DB as MongoDB
U->>F: Enter email + password
F->>B: POST /api/auth/login
B->>DB: findOne(email)
DB-->>B: User document
B->>B: bcrypt.compare(password, hash)
alt Password Valid
B-->>F: 200 { id, name, email, role }
F->>F: localStorage.setItem(user, data)
F-->>U: Redirect to index.html or admin-dashboard.html
else Password Invalid
B-->>F: 400 { error: Invalid credentials }
F-->>U: Show error message
end
Loading
AI Blood Screening Flow
sequenceDiagram
participant U as Donor
participant F as Frontend
participant B as Node.js Backend
participant AI as Flask AI Service
participant DB as MongoDB
U->>F: Upload blood sample image
F->>F: Start animated progress bar
F->>B: POST /api/donors (multipart/form-data)
B->>B: Multer saves image to /uploads
B->>B: fs.readFileSync to base64 encode
B->>AI: POST /analyze { imageBase64 }
AI->>AI: Load TFLite interpreter
AI->>AI: Preprocess to 224x224 to normalize
AI->>AI: interpreter.invoke()
AI-->>B: { result: normal or infected, confidence: 0.87 }
alt Normal Blood Sample
B->>DB: Save Donor { ai_result: normal }
B-->>F: 201 { result: normal, confidence }
F-->>U: Show Donor ID Card + Download option
else Infection Detected
B->>DB: Save Donor { ai_result: infected }
B-->>F: 200 { result: infected, confidence }
F-->>U: Registration blocked, infection detected
end
Loading
Blood Request Lifecycle
stateDiagram-v2
[*] --> Submitted: User fills Need Blood form
Submitted --> Pending: POST /api/requests
Pending --> AdminReview: Admin opens dashboard
AdminReview --> Approved: Admin clicks Approve
AdminReview --> Rejected: Admin clicks Reject + reason
Approved --> PDFGenerated: User downloads PDF slip
Rejected --> [*]: User notified with reason
PDFGenerated --> [*]: Process complete
Loading
Database Entity Relationships
erDiagram
USERS {
ObjectId _id PK
string name
string email
string password_hash
string role
date createdAt
date updatedAt
}
DONORS {
ObjectId _id PK
string name
string email
number age
string blood_group
string image_path
string ai_result
number confidence
date createdAt
}
BLOOD_REQUESTS {
ObjectId _id PK
ObjectId userId FK
string name
string phone
string bloodGroup
string reason
string status
string rejectionReason
date createdAt
date updatedAt
}
MESSAGES {
ObjectId _id PK
ObjectId userId FK
string userName
string userEmail
string message
string reply
date createdAt
}
ANNOUNCEMENTS {
ObjectId _id PK
string title
string message
string bloodGroup
date date
string priority
date createdAt
}
USERS ||--o{ BLOOD_REQUESTS : submits
USERS ||--o{ MESSAGES : sends
Downloadable donor certificate generated via html2canvas
🆘 Blood Request System
Need Blood Form
My Blood Requests Modal
Emergency request submission with validation
Request status tracker with PDF download
🖥️ Admin Dashboard
Dashboard Overview
Blood Requests Management
Live stats, inventory chart & activity feed
Approve/Reject workflow with status badges
AI Insights Panel
Announcements System
Normal vs Infected donor analytics chart
Priority-based announcement broadcaster
User Management
Message Center
Full user registry with delete controls
Admin reply system for user messages
AI System & Blood Analysis Engine
Model Architecture
The VitalLink AI system uses Transfer Learning with MobileNetV2 — a lightweight, efficient CNN pre-trained on ImageNet, fine-tuned for binary blood infection classification.
{_id: ObjectId,name: String(required),email: String(required),age: Number(required),blood_group: String(required),// A+, A-, B+, B-, O+, O-, AB+, AB-image: String,// Server file path (/uploads/...)ai_result: "normal"|"infected",// AI diagnosis resultconfidence: Number,// 0.0 – 1.0 model confidencecreatedAt: Date}
🆘 bloodrequests Collection
{_id: ObjectId,userId: ObjectId(ref: "User"),name: String(required),phone: String(required),bloodGroup: String(required),reason: String(required),status: "Pending"|"Approved"|"Rejected",// default: "Pending"rejectionReason: String,// Set only when status = "Rejected"createdAt: Date,updatedAt: Date}
git clone https://github.com/rajayush6200/VitalLink.git
cd VitalLink
Step 2 — Backend Setup
cd backend
npm install
Create .env in the backend/ directory:
# MongoDB AtlasMONGO_URI=mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/vitallink?retryWrites=true&w=majority# AuthenticationJWT_SECRET=your_minimum_64_character_super_secure_random_secret_key_here_do_not_share# ServerPORT=3000# AI Microservice (local)AI_SERVICE_URL=http://localhost:5001/analyze# Admin CredentialsADMIN_EMAIL=admin@vitallink.comADMIN_PASSWORD=YourSecureAdminPassword123!
Step 3 — Seed Admin Account
# From the backend/ directory
node changeAdminPassword.js
This creates the admin user in MongoDB with the credentials from your .env file.
Step 4 — AI Service Setup
cd ../ai-service
pip install -r requirements.txt
Start the AI service:
python app.py
# Flask starts on http://localhost:5001# AI service endpoint: http://localhost:5001/analyze
Step 5 — Start the Backend Server
# In a new terminal, from backend/
npm run dev
# Express API starts on http://localhost:3000
Step 6 — Serve the Frontend
# Option A: Open directly in browser
open frontend/index.html
# Option B: Serve with a static server
npx serve frontend
# Serves on http://localhost:3000 (or nearest available port)
⚠️Security Note: Never commit .env files to version control. Always use Render's Environment Variables dashboard for production secrets.
Deployment on Render
VitalLink is fully deployed using Render's Blueprint infrastructure-as-code (render.yaml). Three independent services are deployed from a single repository.
Set these in Render Dashboard → Service → Environment:
Key
Source
MONGO_URI
MongoDB Atlas → Connect → Drivers
JWT_SECRET
Generate with openssl rand -hex 64
AI_SERVICE_URL
https://vitallink-ai-service.onrender.com/analyze
ADMIN_EMAIL
Your admin email
ADMIN_PASSWORD
Your secure admin password
Deploy with Blueprint
# 1. Push your code to GitHub
git push origin main
# 2. In Render Dashboard:# New → Blueprint → Connect your GitHub repo → Deploy
💡 Tip: Render free-tier services spin down after inactivity. First request after idle will take 30–60 seconds (cold start). The AI service has a --timeout 120 flag to handle this gracefully.
Security Architecture
Layer
Implementation
Details
Password Security
bcryptjs (salt rounds: 10)
Passwords never stored in plaintext
Frontend Auth Guard
JavaScript localStorage check
Immediate redirect if no session
Admin Route Guard
user.role === 'admin' check
Client-side role enforcement
Database Availability
isDatabaseReady() utility
All DB routes check connection state
CORS Policy
cors() middleware
Configurable cross-origin requests
Env Secrets
dotenv + Render Env Vars
No secrets in source code
Upload Handling
Multer with file path isolation
Uploads stored in /uploads, served statically
Duplicate Prevention
MongoDB query on active requests
Prevents request spam per user
Error Handling
Try-catch on all async routes
No stack traces leaked to clients
Note on JWT: The architecture is JWT-ready with a JWT_SECRET environment variable. Session data is currently stored client-side via localStorage. Full stateless JWT implementation is a planned enhancement.
Performance & Scalability
Current Architecture Strengths
Aspect
Design Decision
Benefit
Microservices
3 independent services
Scale AI, backend, frontend independently
TFLite Inference
Compiled TFLite model
~40% faster than full TF, minimal RAM
Static Frontend
No SSR, pure HTML/JS
Zero compute cost, instant CDN delivery
MongoDB Atlas
Cloud-native DB
Auto-scaling, backups, global clusters
Render Blueprint
IaC deployment
Reproducible, one-command redeploy
Mongoose Schemas
Strict validation
Data integrity enforced at ORM level
Gunicorn WSGI
Multi-process server
Production-grade Python serving
Scalability Vision
Current (MVP) → Enterprise Scale
─────────────────────────────────────────────────────
Single Render Free Tier → Multi-region deployment
localStorage auth → Redis session store + JWT
Gunicorn 1 worker → Kubernetes AI pod autoscaling
MongoDB Atlas M0 → Atlas M10+ with read replicas
Static HTML frontend → Next.js SSR + CDN edge caching
Manual blood stock → Real-time IoT blood bank sensors
Roadmap & Future Improvements
VITALLINK ROADMAP
══════════════════
🔜 Version 2.0 — Core Enhancements
Full JWT Authentication — stateless tokens, refresh token rotation
Real-time Notifications — WebSocket / Socket.io for live alerts
Email Notifications — Nodemailer for request status updates
Hospital/Blood Bank Onboarding — multi-organization support
SMS Alerts — Twilio integration for emergency donor matching
🔮 Version 3.0 — Intelligence Layer
Geolocation Donor Matching — find nearest compatible donors via Google Maps API
ML Demand Prediction — predict blood shortage by region using historical data
AI Model v2 — retrain on larger dataset with multi-class infection classification
Chatbot Assistant — conversational AI for donor/recipient guidance
React Native Mobile App — iOS & Android donor app with push notifications
Analytics Dashboard — advanced BI charts for healthcare administrators
API Versioning — /api/v2 with backward compatibility
Multi-language Support — i18n for regional healthcare accessibility
HIPAA Compliance — enterprise-grade data privacy for US markets
Blockchain Donor Records — immutable, verifiable donation history
Contributing
Contributions are welcome and appreciated! VitalLink is built to grow.
How to Contribute
# 1. Fork the repository# 2. Create your feature branch
git checkout -b feature/amazing-feature
# 3. Make your changes and commit
git commit -m "feat: add amazing feature"# 4. Push to your branch
git push origin feature/amazing-feature
# 5. Open a Pull Request
Contribution Guidelines
Follow the existing code style (ES2020+, async/await patterns)
An enterprise-grade, AI-driven healthcare platform designed to streamline blood bank operations, automate sample analysis, and orchestrate real-time emergency donor coordination.