Skip to content
Bhargav3905Public

About

Production-ready MERN Blood Bank Management System with role-based authentication, donation & request workflows, Razorpay integration, analytics dashboard, and responsive UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🩸 BloodLink – MERN Blood Bank Management System

A production-quality full-stack MERN application that streamlines blood donation, blood requests, inventory management, secure payments, and role-based administration through a centralized digital platform.

Built with scalability, security, clean architecture, and real-world workflows in mind.


React Node.js MongoDB TailwindCSS JWT Razorpay License


πŸ“– Overview

BloodLink is a production-ready Blood Bank Management System designed to simplify the complete blood donation lifecycle through a secure role-based platform.

The application connects Patients, Donors, Hospitals, and Administrators into a single centralized ecosystem where blood inventory, donation records, request approvals, secure online payments, and analytics are managed transparently.

Unlike traditional CRUD-based academic projects, BloodLink follows real-world business workflows including approval processes, payment verification, inventory deduction, email notifications, dashboard analytics, and role-specific permissions.

The project was built with an emphasis on clean architecture, maintainability, scalability, responsive UI, and industry-standard development practices.

πŸ“‘ Table of Contents


🌐 Live Demo

Frontend Dependencies

Add your deployed frontend URL here

https://blood-link-phi.vercel.app

Backend API

Add your deployed backend URL here

https://bloodlink-api-6cmq.onrender.com

✨ Highlights

  • πŸ” JWT Authentication with Refresh Tokens
  • πŸ‘₯ Multi-Role Access Control
  • 🩸 Blood Donation Management
  • πŸ“¦ Central Blood Inventory
  • πŸ“‹ Blood Request Workflow
  • πŸ’³ Razorpay Payment Integration
  • πŸ“§ Email Notifications
  • πŸ“Š Dashboard Analytics
  • πŸŒ™ Dark / Light Theme
  • πŸ“± Fully Responsive Design
  • ⚑ Modern React Architecture
  • πŸ›‘οΈ Secure Backend Validation
  • πŸš€ Production Ready

πŸš€ Features

Authentication Screenshots

  • User Registration
  • Secure Login
  • Logout
  • JWT Authentication
  • Refresh Token Authentication
  • Forgot Password
  • Reset Password
  • Protected Routes
  • Role-Based Authorization

User Management

  • Profile Management
  • Update Profile
  • Admin Approval Workflow
  • Pending User Management
  • User Search
  • Pagination
  • Role Filtering

Blood Donation

  • Record Blood Donations
  • Donation History
  • 90-Day Donor Cooldown
  • Hospital Blood Donations
  • Automatic Inventory Updates
  • Blood Group Validation

Blood Requests

  • Create Blood Requests
  • Patient Request Validation
  • Hospital Request Validation
  • Admin Approval
  • Request Rejection
  • Dynamic Processing Fee (β‚Ή500 per Blood Unit)
  • Razorpay Payment
  • Automatic Inventory Deduction
  • Request History

Inventory

  • Central Blood Inventory
  • Blood Group Distribution
  • Live Blood Stock
  • Low Stock Detection
  • Inventory Summary
  • Automatic Quantity Updates

Dashboard & Analytics

  • System Overview
  • User Statistics
  • Donation Statistics
  • Request Statistics
  • Revenue Analytics
  • Blood Units Delivered
  • Blood Group Distribution
  • Low Stock Monitoring
  • Recent Donations

User Experience

  • Responsive Layout
  • Sidebar Navigation
  • Dark / Light Theme
  • Skeleton Loaders
  • Empty States
  • Confirmation Dialogs
  • Toast Notifications
  • Animated Components
  • Clean Dashboard UI

πŸ›  Tech Stack

Frontend

  • React 19
  • Vite
  • React Router DOM
  • Tailwind CSS
  • Axios
  • React Hook Form
  • React Hot Toast
  • Framer Motion
  • Recharts
  • Lucide React

Backend Scripts

  • Node.js
  • Express.js
  • MongoDB Atlas
  • Mongoose
  • JWT Authentication
  • Zod Validation
  • Razorpay
  • Nodemailer (Brevo SMTP)

Development Tools

  • Git
  • GitHub
  • VS Code
  • ESLint
  • Prettier
  • Postman

πŸ—οΈ System Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚        React (Vite)       β”‚
                    β”‚     Tailwind CSS UI       β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
                          REST API (Axios)
                                  β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      Express.js API       β”‚
                    β”‚ Authentication & Business β”‚
                    β”‚         Logic Layer       β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚               β”‚                β”‚
                  β–Ό               β–Ό                β–Ό
             MongoDB Atlas    Razorpay       Brevo SMTP
              Database        Payments          Emails

BloodLink follows a modular MVC architecture where the frontend communicates with the backend through REST APIs. The backend manages authentication, authorization, validation, business rules, payment verification, inventory management, and email notifications before persisting data into MongoDB.


πŸ“‚ Project Structure

BloodLink/
β”‚
β”œβ”€β”€ client/
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ constants/
β”‚   β”‚   β”œβ”€β”€ contexts/
β”‚   β”‚   β”œβ”€β”€ features/
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ providers/
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   └── utils/
β”‚   β”‚
β”‚   └── package.json
β”‚
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ constants/
β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ database/
β”‚   β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ seed/
β”‚   β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── validations/
β”‚   β”‚
β”‚   └── package.json
β”‚
β”œβ”€β”€ docs/
β”œβ”€β”€ screenshots/
β”œβ”€β”€ LICENSE
└── README.md

πŸ‘₯ User Roles

BloodLink supports four different user roles, each with dedicated permissions.

Role Permissions
Admin Approve users, manage requests, monitor inventory, dashboard analytics
Donor Donate blood, view donation information, manage profile
Patient Request blood matching their registered blood group, complete payment, view request history
Hospital Donate blood inventory, request multiple blood units, manage hospital requests

πŸ” Authentication & Authorization

The application implements secure authentication using JWT-based access control.

Authentication Features

  • User Registration
  • Secure Login
  • Logout
  • JWT Access Token
  • Refresh Token
  • Forgot Password
  • Reset Password
  • Protected Routes
  • Role-Based Authorization

Approval Workflow

Register
      β”‚
      β–Ό
Patient ───────────────► Active Account

Donor / Hospital
      β”‚
      β–Ό
Pending Approval
      β”‚
      β–Ό
Admin Review
      β”‚
 β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
 β”‚         β”‚
 β–Ό         β–Ό
Approved  Rejected
 β”‚
 β–Ό
Active Account

Patients receive immediate access after registration, while donor and hospital accounts require administrator approval before they can access the system.


🩸 Blood Donation Workflow

Donor / Hospital
        β”‚
        β–Ό
Submit Donation
        β”‚
        β–Ό
Validate Blood Group
        β”‚
        β–Ό
Donation Recorded
        β”‚
        β–Ό
Inventory Updated

Blood Request Business Rules

  • Donors can donate 1 blood unit per donation.
  • Donors must wait 90 days before donating again.
  • Hospitals can donate 1–10 blood units in a single donation.
  • Inventory is updated immediately after a successful donation.

πŸ“‹ Blood Request Workflow

Create Request
      β”‚
      β–Ό
Pending
      β”‚
      β–Ό
Admin Approval
      β”‚
      β–Ό
Payment Pending
      β”‚
      β–Ό
Razorpay Payment
      β”‚
      β–Ό
Payment Verification
      β”‚
      β–Ό
Inventory Deduction
      β”‚
      β–Ό
Request Completed

Business Rules

  • Patients can request only their registered blood group.
  • Patients can request up to 2 blood units.
  • Hospitals can request up to 5 blood units.
  • Processing charges are calculated dynamically at β‚Ή500 per blood unit.
  • Inventory is deducted only after successful payment verification.

πŸ’³ Payment Workflow

BloodLink integrates Razorpay Test Mode for secure payment processing.

Approved Request
        β”‚
        β–Ό
Create Razorpay Order
        β”‚
        β–Ό
Complete Payment
        β”‚
        β–Ό
Verify Signature
        β”‚
        β–Ό
Update Payment Status
        β”‚
        β–Ό
Deduct Inventory
        β”‚
        β–Ό
Send Confirmation Email

Payment Features

  • Dynamic pricing based on requested blood units
  • Secure Razorpay signature verification
  • Automatic payment status updates
  • Automatic inventory deduction
  • Email confirmation after successful payment

πŸ“Š Dashboard Analytics

The administrator dashboard provides real-time operational insights.

Available Metrics

  • Total Users
  • Total Donors
  • Total Patients
  • Total Hospitals
  • Pending Approvals
  • Completed Requests
  • Revenue Generated
  • Blood Units Delivered
  • Blood Inventory Summary
  • Blood Group Distribution
  • Low Stock Alerts
  • Recent Donations

These analytics help administrators monitor the overall health of the blood management system from a single dashboard.


βš™οΈ Installation

Follow the steps below to set up BloodLink on your local machine.

1. Clone the Repository

git clone https://github.com/Bhargav3905/BloodLink.git

cd BloodLink

2. Install Dependencies

Server Dependencies

cd server

npm install

Client Dependencies

cd ../client

npm install

πŸ”‘ Environment Variables

Backend (.env)

Create a .env file inside the server directory.

PORT=8000

MONGODB_URI=your_mongodb_connection_string

DB_NAME=bloodlink

CLIENT_URL=http://localhost:5173

ACCESS_TOKEN_SECRET=your_access_token_secret
ACCESS_TOKEN_EXPIRY=15m

REFRESH_TOKEN_SECRET=your_refresh_token_secret
REFRESH_TOKEN_EXPIRY=7d

RESET_TOKEN_SECRET=your_reset_token_secret
RESET_TOKEN_EXPIRY=15m

PROCESSING_FEE_PER_UNIT=500

LOW_STOCK_THRESHOLD=5

RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret

EMAIL_HOST=smtp-relay.brevo.com
EMAIL_PORT=587
EMAIL_USER=your_brevo_login
EMAIL_PASS=your_brevo_password

ADMIN_NAME=Admin
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=your_secure_password
ADMIN_PHONE=9999999999
ADMIN_CITY=Ahmedabad
ADMIN_BLOOD_GROUP=O+

Frontend (.env)

Create a .env file inside the client directory.

VITE_API_BASE_URL=http://localhost:8000/api/v1
VITE_RAZORPAY_KEY_ID=your_razorpay_key_id

▢️ Running the Project

Start Backend

cd server

npm run dev

Backend runs on:

http://localhost:8000

Start Frontend

cd client

npm run dev

Frontend runs on:

http://localhost:5173

🌱 Database Seeding

To create the default administrator account and initialize blood inventory, run:

cd server

npm run seed

This command:

  • Creates the default administrator account.
  • Initializes blood inventory for all supported blood groups.
  • Prevents duplicate seed data on subsequent executions.

πŸ“œ Available Scripts

Backend

Command Description
npm run dev Start development server
npm start Start production server
npm run seed Seed admin account and inventory

Frontend Scripts

Command Description
npm run dev Start Vite development server
npm run build Create production build
npm run preview Preview production build
npm run lint Run ESLint

πŸ”Œ API Overview

Authentication Endpoints

Method Endpoint
POST /api/v1/auth/register
POST /api/v1/auth/login
POST /api/v1/auth/logout
POST /api/v1/auth/refresh-token
POST /api/v1/auth/forgot-password
POST /api/v1/auth/reset-password/:token

Users

Method Endpoint
GET /api/v1/users/profile
PATCH /api/v1/users/profile
GET /api/v1/users/pending
PATCH /api/v1/users/:id/approve
PATCH /api/v1/users/:id/reject

Donations

Method Endpoint
POST /api/v1/donations
GET /api/v1/donations/history

Blood Requests Screenshot

Method Endpoint
POST /api/v1/requests
GET /api/v1/requests/my
GET /api/v1/requests/pending
PATCH /api/v1/requests/:id/approve
PATCH /api/v1/requests/:id/reject

Payments

Method Endpoint
POST /api/v1/payments/create-order/:requestId
POST /api/v1/payments/verify

Analytics

Method Endpoint
GET /api/v1/analytics/overview
GET /api/v1/analytics/inventory-summary
GET /api/v1/analytics/request-statistics
GET /api/v1/analytics/blood-distribution
GET /api/v1/analytics/low-stock
GET /api/v1/analytics/donation-statistics

πŸ›‘ Security Features

  • JWT Access & Refresh Token Authentication
  • Secure Password Hashing with bcrypt
  • Role-Based Authorization
  • Protected API Routes
  • Request Validation using Zod
  • Secure Razorpay Signature Verification
  • Environment Variable Configuration
  • Input Validation
  • Centralized Error Handling
  • Secure Email-Based Password Reset

πŸ“Έ Project Screenshots

The following screenshots showcase the major features and workflows of BloodLink.


🏠 Landing Page

Landing Page


✨ Features Section

Features Section


πŸ” Authentication

Login

Login

Register

Register

Forgot Password

Forgot Password


πŸ‘¨β€πŸ’Ό Admin Dashboard

Admin Dashboard


πŸ‘₯ User Management

Approve or reject donor and hospital registrations.

User Management


⏳ Pending Blood Requests

Approve or reject blood requests submitted by patients and hospitals.

Pending Requests


🩸 Blood Inventory

Monitor available blood units across all blood groups.

Inventory


❀️ Donation History

Track every blood donation recorded in the system.

Donation History


πŸ§‘ Donor Dashboard

Donor Dashboard


🩸 Donor – Donate Blood

Record a new blood donation with cooldown validation.

Donate Blood


πŸ₯ Patient Dashboard

Patient Dashboard


πŸ“ Patient – Create Blood Request

Dynamic request form with real-time processing fee calculation.

Patient Create Request


πŸ“‹ Patient – My Requests

Track request status and complete payment after approval.

Patient My Requests


πŸ₯ Hospital Dashboard

Hospital Dashboard


❀️ Hospital – Donate Blood

Hospital blood donation workflow.

Hospital Donate Blood


🩸 Hospital – Create Blood Request

Hospital request workflow with dynamic pricing.

Hospital Create Request


πŸ’³ Razorpay Payment

Secure payment flow after administrator approval.

Razorpay Payment


πŸ‘€ User Profile

Manage personal information and account details.

Profile


πŸŒ™ Dark Mode

Fully responsive interface with complete Light and Dark theme support.

Dark Mode Dashboard


πŸ§ͺ Testing

The application was manually tested across all supported user roles to ensure correctness of authentication, authorization, workflows, payment processing, and UI responsiveness.

Guest

  • Landing Page
  • Navigation
  • Theme Toggle
  • Register
  • Login
  • Forgot Password
  • Reset Password
  • Protected Routes

Admin

  • Dashboard
  • Pending User Approval
  • User Rejection
  • Pending Blood Requests
  • Request Approval
  • Request Rejection
  • Inventory Dashboard
  • Donation History
  • Analytics Dashboard
  • Revenue Analytics
  • Sidebar Navigation
  • Theme Switching

Donor

  • Blood Donation
  • Donation Cooldown Validation
  • Profile Management
  • Dashboard
  • Theme Support

Patient

  • Blood Request Creation
  • Blood Group Validation
  • Dynamic Pricing
  • Razorpay Payment
  • Request History
  • Profile Management

Hospital

  • Multi-unit Blood Donation
  • Multi-unit Blood Requests
  • Dynamic Pricing
  • Razorpay Payment
  • Request History
  • Profile Management

⚑ Performance Optimizations

  • Modular Feature-Based Architecture
  • Reusable UI Components
  • Lazy API Loading
  • Axios Service Layer
  • React Hook Form Validation
  • Optimized MongoDB Queries
  • Parallel Database Queries using Promise.all()
  • Centralized Error Handling
  • Environment Variable Configuration
  • Responsive UI with Tailwind CSS

πŸš€ Production Ready Features

βœ” JWT Authentication

βœ” Refresh Token Authentication

βœ” Role-Based Authorization

βœ” Approval Workflow

βœ” Password Reset via Email

βœ” Dynamic Processing Fee

βœ” Razorpay Payment Integration

βœ” Revenue Analytics

βœ” Blood Inventory Management

βœ” Low Stock Detection

βœ” Email Notifications

βœ” Responsive Design

βœ” Dark / Light Theme

βœ” Skeleton Loaders

βœ” Empty States

βœ” Confirmation Dialogs

βœ” Toast Notifications

βœ” Form Validation

βœ” Protected Routes

βœ” Modular Folder Structure

βœ” Clean Code Architecture


🌱 Future Enhancements

Although BloodLink is production-ready, the following improvements can be considered for future versions:

  • Blood Donation Appointment Scheduling
  • Nearby Blood Bank Locator
  • Emergency Blood Request Notifications
  • PDF Receipt Generation
  • Blood Compatibility Recommendation
  • Real-Time Notifications
  • Admin Activity Logs
  • Audit Trail
  • Docker Support
  • CI/CD Pipeline
  • Unit & Integration Testing
  • Multi-language Support

🌍 Deployment

The application can be deployed using the following services:

Service Purpose
Vercel Frontend Deployment
Render Backend Deployment
MongoDB Atlas Cloud Database
Razorpay Payment Gateway
Brevo SMTP Email Service

πŸ’Ό Why BloodLink?

BloodLink was built as a production-quality portfolio project to demonstrate real-world full-stack software engineering practices beyond basic CRUD applications.

The project focuses on secure authentication, role-based access control, modular architecture, payment processing, analytics, inventory management, and scalable code organization while delivering a responsive and modern user experience.

It reflects industry-standard development practices suitable for internships, placements, and full-stack developer portfolios.


🀝 Contributing

Contributions, feature suggestions, and bug reports are always welcome.

If you'd like to contribute:

  1. Fork the repository.
  2. Create a new feature branch.
git checkout -b feature/your-feature-name

3.Commit your changes.

git commit -m "feat: add new feature"

4.Push your branch.

git push origin feature/your-feature-name

5.Open a Pull Request.

Please ensure that your code follows the existing project structure, coding standards, and naming conventions.


πŸš€ Future Improvements

The current release (v1.0.0) provides a complete production-ready blood bank management system. Future versions may include:

  • πŸ“± Progressive Web App (PWA) support
  • πŸ“ Live donor location and nearby donor search
  • πŸ”” Real-time notifications using WebSockets
  • πŸ“Š Advanced analytics and reporting dashboard
  • πŸ₯ Multi-branch hospital inventory management
  • πŸ“… Donation appointment scheduling
  • πŸ“„ Blood request invoice and PDF generation
  • 🌐 Multi-language (i18n) support
  • πŸ“¦ Docker and Kubernetes deployment support
  • πŸ§ͺ Automated testing with Jest and Cypress
  • πŸ” Elasticsearch-powered search
  • πŸ“² SMS and WhatsApp notifications
  • πŸ€– AI-powered blood demand forecasting
  • ☁️ AWS S3 image storage for user profiles
  • πŸ“ˆ Audit logs and activity tracking

πŸ“ License

This project is licensed under the MIT License.

See the LICENSE file for more details.


πŸ‘¨β€πŸ’» Author

Bhargav K. Prajapati

B.Tech Information & Communication Technology

Pandit Deendayal Energy University (PDEU)

Full Stack MERN Developer


Connect with Me

Replace these with your own links.


πŸ™ Acknowledgements

Special thanks to the open-source community and the technologies that made this project possible.

  • React
  • Vite
  • Tailwind CSS
  • Node.js
  • Express.js
  • MongoDB Atlas
  • Mongoose
  • Razorpay
  • Brevo SMTP
  • React Hook Form
  • Recharts
  • Lucide React
  • React Hot Toast
  • Framer Motion
  • JWT
  • Zod
  • Axios

⭐ Repository Support

If you found this project helpful:

  • ⭐ Star this repository
  • 🍴 Fork the project
  • πŸ› Report issues
  • πŸ’‘ Suggest improvements

Your support helps improve the project and motivates future development.


πŸ“Œ Project Status

Current Version: v1.0.0

Development Status: Production Ready

Completed Modules

  • Authentication
  • User Management
  • Blood Donation
  • Blood Requests
  • Inventory Management
  • Razorpay Payments
  • Dashboard Analytics
  • Revenue Analytics
  • Profile Management
  • Email Notifications
  • Responsive UI
  • Dark Mode
  • Production Deployment Support

πŸ“ˆ Project Statistics

Category Status
Architecture Feature-Based MERN
Authentication JWT + Refresh Token
Authorization Role Based
Database MongoDB Atlas
Payment Gateway Razorpay
Email Service Brevo SMTP
API Style REST
Validation Zod
UI Framework Tailwind CSS
Charts Recharts
Theme Light / Dark
Responsive βœ…
Production Ready βœ…

🎯 Learning Outcomes

This project demonstrates practical experience with:

  • Production-grade MERN application architecture
  • JWT Authentication & Authorization
  • Secure REST API development
  • MongoDB schema design
  • Payment gateway integration
  • Email automation
  • Dashboard analytics
  • Inventory management
  • Feature-based frontend architecture
  • Responsive UI/UX
  • Clean code principles
  • Scalable project organization
  • Industry-standard development workflow

❀️ Built with React, Node.js, MongoDB & Tailwind CSS

Thank you for visiting this repository

If you like this project, consider giving it a ⭐ on GitHub.

About

Production-ready MERN Blood Bank Management System with role-based authentication, donation & request workflows, Razorpay integration, analytics dashboard, and responsive UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages