Skip to content
RefayatulPublic

About

A comprehensive blood donor management system for Bangladesh University of Professionals (BUP). Built with Flask, Supabase, and TailwindCSS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BUP Blood Bank 🩸

A comprehensive blood donor management system for Bangladesh University of Professionals (BUP) with user authentication, secure password management, and advanced search capabilities.

🎯 Project Overview

Live Website: https://bupblood.org/ (Mirror: https://bupblood.vercel.app/)
Purpose: Blood donor registry and management system
Institution: Bangladesh University of Professionals (BUP)
Admin Contact: refayat.connect@gmail.com
Current Users: 500+ registered donors

πŸ› οΈ Tech Stack

  • Backend: Flask 3.1.3 (Python)
  • Database: SQLite (local) β†’ Supabase PostgreSQL (production)
  • Image Storage: Local static files β†’ Supabase Storage (production)
  • Frontend: Tailwind CSS + DaisyUI
  • Server: Gunicorn (local), Vercel (production)
  • Authentication: Flask-Login with secure password hashing

✨ Features

πŸ‘€ User Features

  • βœ… Secure Registration - Password-protected accounts with strength validation
  • βœ… User Authentication - Login/logout system with session management
  • βœ… Personal Dashboard - Update profile, availability, last donation date, and profile picture
  • βœ… Password Management - Change password and secure reset functionality
  • βœ… Self-Service Password Reset - Multi-factor verification (Student ID + Mobile + Dept + Blood Group)
  • βœ… Email Verification - Required for password resets (with one-time exception for legacy users)
  • βœ… Availability Status - Toggle between Available/Unavailable with visual badges
  • βœ… Profile Image Upload - Custom profile pictures with automatic resizing
  • βœ… BUP Program Integration - Faculty and program-based filtering using official structure

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

  • βœ… Admin Panel - Approve/reject new donor registrations
  • βœ… User Management - View all pending and approved donors
  • βœ… Secure Admin Login - Hardcoded credentials (admin/adminpassword)

πŸ” Public Features

  • βœ… Blood Group Search - Filter by all 8 blood types (A+, A-, B+, B-, AB+, AB-, O+, O-)
  • βœ… Faculty/Program Filter - Search by BUP faculties and programs
  • βœ… Donor Cards - Visual cards showing availability status
  • βœ… Direct Contact - Call donors via tel: links
  • βœ… Responsive Design - Mobile-optimized interface

πŸ” Authentication & Security

Password Reset Workflow

  1. User clicks "Forgot Password?" on login page
  2. Identity Verification - Enter Student ID, Mobile, Department, Blood Group
  3. Email Verification (for users with email):
    • System shows masked email (e.g., r***t@gmail.com)
    • User confirms full email address
    • Password reset allowed upon confirmation
  4. One-Time Reset (for legacy users without email):
    • System allows single password reset using verified identity
    • Subsequent resets require email verification
    • Users encouraged to add email to profile

User Categories

  • New Users (registered after updates): Full email verification required
  • Legacy Users (441 existing): One-time password reset without email, then email required

πŸ“‚ Directory Structure

BloodBank/
β”œβ”€β”€ app.py                          # Main Flask application with routes
β”œβ”€β”€ models.py                       # SQLAlchemy database models
β”œβ”€β”€ forms.py                        # WTForms (registration, login, password reset)
β”œβ”€β”€ config.py                       # Color palette configuration
β”œβ”€β”€ requirements.txt                # Python dependencies
β”œβ”€β”€ vercel.json                     # Vercel deployment config
β”œβ”€β”€ .env.example                    # Environment variables template
β”œβ”€β”€ PROJECT_MEMORY.md              # Detailed project documentation
β”œβ”€β”€ instance/
β”‚   └── bup_blood_bank.db          # SQLite database (local development)
β”œβ”€β”€ migrations/                     # Flask-Migrate database migrations
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/                       # Tailwind CSS (compiled)
β”‚   └── images/                    # User profile images (local)
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ base.html                  # Base template with navigation
β”‚   β”œβ”€β”€ home.html                  # Homepage with donor search
β”‚   β”œβ”€β”€ register.html              # User registration form
β”‚   β”œβ”€β”€ user_login.html            # User login form
β”‚   β”œβ”€β”€ dashboard.html             # User dashboard
β”‚   β”œβ”€β”€ forgot_password.html       # Password reset - identity verification
β”‚   β”œβ”€β”€ verify_email.html          # Password reset - email confirmation
β”‚   β”œβ”€β”€ reset_password.html        # Password reset - new password entry
β”‚   β”œβ”€β”€ change_password.html       # Change password (logged in users)
β”‚   β”œβ”€β”€ admin_panel.html           # Admin approval panel
β”‚   └── [other templates]
└── utils/
    └── color_palettes.json        # UI color scheme

πŸš€ Local Development Setup

1. Clone and Setup Environment

# Navigate to project directory
cd f:\BloodBank

# Create virtual environment
python -m venv venv

# Activate virtual environment
venv\Scripts\activate  # Windows
# or
source venv/bin/activate  # Linux/Mac

# Install dependencies
pip install -r requirements.txt

2. Install Node Dependencies (for CSS)

npm install

3. Build Tailwind CSS (optional, already compiled)

npm run build

4. Database Setup

# Run migrations (if needed)
flask db upgrade

# Database will be created at instance/bup_blood_bank.db

5. Run the Application

Development Mode:

python app.py
# or
flask run --host=0.0.0.0 --port=5000

Production Mode (local):

gunicorn app:app -b 0.0.0.0:8086 --workers=4

Access Points

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

  • URL: /admin or /login
  • Username: admin
  • Password: adminpassword

⚠️ IMPORTANT: Change these credentials before production deployment!

πŸ—„οΈ Database Schema

User Model

  • id - Primary key
  • student_id - Unique identifier (username)
  • name - Full name
  • department - Department name
  • batch - Batch year/number
  • blood_group - Blood type (A+, A-, B+, B-, AB+, AB-, O+, O-)
  • mobile - Contact number
  • address - Residential address
  • email - Email address (optional for legacy users)
  • image - Profile picture URL (500 chars for Supabase)
  • password_hash - Bcrypt hashed password (128 chars)
  • is_approved - Admin approval status (Boolean)
  • is_available - Donor availability (Boolean)
  • last_donation_date - Last donation date (Date, nullable)
  • password_reset_count - Tracks password reset without email (Integer)
  • created_at - Registration timestamp (DateTime, Asia/Dhaka)

🌐 Production Deployment (Vercel + Supabase)

Prerequisites

  1. Supabase Account - Create project at supabase.com
  2. Vercel Account - Sign up at vercel.com
  3. GitHub Repository - Code must be in Git repo

Step 1: Supabase Setup

# 1. Create new project on Supabase
# 2. Get Database connection string from Settings > Database
# 3. Create Storage bucket named 'images' (set to Public)
# 4. Copy Project URL and anon key from Settings > API

Step 2: Environment Variables

Create .env file (NEVER commit this):

SECRET_KEY=your-super-secret-key-here
SQLALCHEMY_DATABASE_URI=postgresql://postgres:[PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres
SUPABASE_URL=https://[PROJECT-REF].supabase.co
SUPABASE_KEY=[YOUR-ANON-KEY]

Step 3: Vercel Deployment

  1. Push code to GitHub
  2. Import repository in Vercel
  3. Add environment variables from .env
  4. Deploy

πŸ”’ Security Notes

Files to NEVER Commit

  • temp_passwords.txt - Contains all user passwords
  • .env - Contains API keys and secrets
  • instance/bup_blood_bank.db - Contains user data
  • venv/ - Virtual environment

Recommended .gitignore

temp_passwords.txt
.env
instance/
venv/
__pycache__/
*.pyc
*.pyo
*.db
.DS_Store
node_modules/

πŸ“Š Current Statistics

  • Total Registered Users: 500+
  • All users have secure passwords: βœ… Yes
  • Email verification enabled: βœ… Yes
  • Password reset available: βœ… Yes (with email verification)

πŸ› Known Issues / TODO

High Priority

  • Implement rate limiting for password reset attempts

Medium Priority

  • Add "Remember Me" option on login
  • Improve error messages and user feedback
  • Add donation history tracking

Low Priority

  • Add blood request system
  • Add notification system for urgent requests
  • Mobile app (React Native/Flutter)

πŸ“ Change Log

Version 3.4 - May 2026

  • βœ… Full Supabase Migration - SQLite data and images moved to Supabase
  • βœ… Triple-Soft Architecture - Soft-delete for users (hide/delete without data loss)
  • βœ… SweetAlert2 UI - Enhanced confirmation dialogs and UI interactions
  • βœ… Admin Panel Upgrades - Improved user management, filtering, and activity logs
  • βœ… Dynamic Availability - Mathematical 120-day cooldown logic for donors
  • βœ… Official Program Integration - Standardized BUP program hierarchy mapped for 500+ users
  • βœ… Email Notifications - Added email notifications for password resets and registrations

Version 2.0 - November 2024

  • βœ… User Authentication System - Full login/logout with session management
  • βœ… Password Reset with Email Verification - Multi-step secure reset process
  • βœ… BUP Program Integration - Faculty and program-based filtering
  • βœ… Enhanced Security - Limited one-time resets for users without email
  • βœ… Profile Management - Dashboard for updating availability, images, contact info
  • βœ… Password Strength Indicator - Visual feedback during password creation
  • βœ… Mobile-Responsive Navigation - Auth state-aware mobile menu

Version 1.0 - Initial Release

  • Basic donor registration
  • Blood group search
  • Admin approval system

πŸ“ž Contact & Support

  • Admin Email: refayat.connect@gmail.com
  • Project Type: Humanitarian - Blood Donation Management
  • Institution: Bangladesh University of Professionals (BUP)

πŸ“„ License

Internal use for BUP Blood Bank project.


Last Updated: May 2026
Version: 3.4
Status: Active Development

About

A comprehensive blood donor management system for Bangladesh University of Professionals (BUP). Built with Flask, Supabase, and TailwindCSS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages