Skip to content

prashant9546/BloodBankManagementSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

BloodHub - Blood Management System

A comprehensive Spring Boot web application for managing blood donation requests, connecting donors with recipients, and managing hospital information.

๐Ÿš€ Features

Core Functionality

  • User Management: Registration, authentication, and profile management
  • Blood Request Management: Post, view, edit, and manage blood donation requests
  • Hospital Directory: Find and manage nearby hospitals and blood banks
  • Search & Filter: Advanced search capabilities for blood requests and donors
  • Real-time Updates: Dynamic content updates and notifications

User Roles

  • Regular Users: Can post blood requests, search for donors, and view hospital information
  • Administrators: Full system access including user management and system configuration

Security Features

  • Spring Security integration with BCrypt password encoding
  • Role-based access control
  • Secure session management
  • CSRF protection

๐Ÿ› ๏ธ Technology Stack

Backend

  • Java 11
  • Spring Boot 2.7.14
  • Spring Data JPA
  • Spring Security
  • MySQL 8.0

Frontend

  • Thymeleaf (Server-side templating)
  • Bootstrap 5.1.3 (Responsive UI framework)
  • Font Awesome 6.0.0 (Icons)
  • Custom CSS & JavaScript

Build Tools

  • Maven (Dependency management and build)
  • Gradle Wrapper (Alternative build option)

๐Ÿ“‹ Prerequisites

Before running this application, ensure you have:

  • Java 11 or higher
  • MySQL 8.0 or higher
  • Maven 3.6 or higher
  • Git (for cloning the repository)

๐Ÿš€ Quick Start

1. Clone the Repository

git clone <repository-url>
cd blood-management-system

2. Database Setup

  1. Create a MySQL database:
CREATE DATABASE blood_management;
  1. Update database configuration in src/main/resources/application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/blood_management?createDatabaseIfNotExist=true&useSSL=false&serverTimezone=UTC
spring.datasource.username=your_username
spring.datasource.password=your_password

3. Build and Run

# Using Maven
mvn clean install
mvn spring-boot:run

# Or using the JAR file
java -jar target/blood-management-system-0.0.1-SNAPSHOT.jar

4. Access the Application

Open your browser and navigate to: http://localhost:8080/bloodhub

๐Ÿ—๏ธ Project Structure

src/
โ”œโ”€โ”€ main/
โ”‚   โ”œโ”€โ”€ java/
โ”‚   โ”‚   โ””โ”€โ”€ com/
โ”‚   โ”‚       โ””โ”€โ”€ bloodhub/
โ”‚   โ”‚           โ”œโ”€โ”€ BloodManagementApplication.java
โ”‚   โ”‚           โ”œโ”€โ”€ config/
โ”‚   โ”‚           โ”‚   โ””โ”€โ”€ SecurityConfig.java
โ”‚   โ”‚           โ”œโ”€โ”€ controller/
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ AuthController.java
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ BloodRequestController.java
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ DashboardController.java
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ HomeController.java
โ”‚   โ”‚           โ”‚   โ””โ”€โ”€ HospitalController.java
โ”‚   โ”‚           โ”œโ”€โ”€ entity/
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ User.java
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ BloodRequest.java
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ Hospital.java
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ Role.java
โ”‚   โ”‚           โ”‚   โ””โ”€โ”€ enums/
โ”‚   โ”‚           โ”œโ”€โ”€ repository/
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ UserRepository.java
โ”‚   โ”‚           โ”‚   โ”œโ”€โ”€ BloodRequestRepository.java
โ”‚   โ”‚           โ”‚   โ””โ”€โ”€ HospitalRepository.java
โ”‚   โ”‚           โ””โ”€โ”€ service/
โ”‚   โ”‚               โ”œโ”€โ”€ UserService.java
โ”‚   โ”‚               โ”œโ”€โ”€ BloodRequestService.java
โ”‚   โ”‚               โ””โ”€โ”€ HospitalService.java
โ”‚   โ””โ”€โ”€ resources/
โ”‚       โ”œโ”€โ”€ static/
โ”‚       โ”‚   โ”œโ”€โ”€ css/
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ style.css
โ”‚       โ”‚   โ””โ”€โ”€ js/
โ”‚       โ”‚       โ””โ”€โ”€ script.js
โ”‚       โ”œโ”€โ”€ templates/
โ”‚       โ”‚   โ”œโ”€โ”€ auth/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ login.html
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ register.html
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ forgot-password.html
โ”‚       โ”‚   โ”œโ”€โ”€ blood-requests/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ list.html
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ create.html
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ view.html
โ”‚       โ”‚   โ”œโ”€โ”€ dashboard.html
โ”‚       โ”‚   โ””โ”€โ”€ home.html
โ”‚       โ””โ”€โ”€ application.properties

๐Ÿ”ง Configuration

Application Properties

Key configuration options in application.properties:

# Server Configuration
server.port=8080
server.servlet.context-path=/bloodhub

# Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/blood_management
spring.datasource.username=root
spring.datasource.password=password

# JPA Configuration
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true

# Security Configuration
spring.security.user.name=admin
spring.security.user.password=admin

Environment Variables

You can override configuration using environment variables:

export SPRING_DATASOURCE_URL=jdbc:mysql://localhost:3306/blood_management
export SPRING_DATASOURCE_USERNAME=your_username
export SPRING_DATASOURCE_PASSWORD=your_password

๐Ÿ“Š Database Schema

Core Tables

  • users: User accounts and profiles
  • roles: User roles and permissions
  • user_roles: Many-to-many relationship between users and roles
  • blood_requests: Blood donation requests
  • hospitals: Hospital and blood bank information

Key Relationships

  • Users can have multiple roles
  • Blood requests are associated with users
  • Hospitals are categorized by division

๐Ÿ” Security

Authentication

  • Form-based login with Spring Security
  • Password encryption using BCrypt
  • Session management with remember-me functionality

Authorization

  • Role-based access control
  • URL-level security constraints
  • Method-level security annotations

CSRF Protection

  • Enabled by default
  • Token-based protection for all forms
  • Exceptions for specific endpoints if needed

๐ŸŒ API Endpoints

Public Endpoints

  • GET / - Home page
  • GET /home - Home page
  • GET /login - Login page
  • GET /register - Registration page
  • GET /forgot-password - Password reset page

Protected Endpoints

  • GET /dashboard - User dashboard
  • GET /profile - User profile
  • GET /blood-requests - List blood requests
  • POST /blood-requests/create - Create blood request
  • GET /hospitals/nearby - Find nearby hospitals

Admin Endpoints

  • GET /admin/** - Admin panel (requires ADMIN role)

๐ŸŽจ UI Components

Responsive Design

  • Mobile-first approach using Bootstrap 5
  • Responsive navigation and layouts
  • Touch-friendly interface elements

Interactive Features

  • Dynamic form validation
  • Real-time search and filtering
  • Smooth animations and transitions
  • Toast notifications

Theme Support

  • Light/dark theme toggle
  • Customizable color schemes
  • Consistent branding throughout

๐Ÿงช Testing

Running Tests

# Unit tests
mvn test

# Integration tests
mvn verify

# All tests with coverage
mvn clean test jacoco:report

Test Structure

  • Unit tests for services and controllers
  • Integration tests for repositories
  • End-to-end tests for critical workflows

๐Ÿš€ Deployment

Production Build

mvn clean package -Pprod

Docker Support

FROM openjdk:11-jre-slim
COPY target/blood-management-system-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

Environment-Specific Configurations

  • Development: application-dev.properties
  • Production: application-prod.properties
  • Testing: application-test.properties

๐Ÿ“ˆ Monitoring & Logging

Logging Configuration

  • Logback for logging framework
  • Configurable log levels
  • Structured logging for production

Health Checks

  • Spring Boot Actuator endpoints
  • Database connectivity checks
  • Application health status

๐Ÿ”„ Database Migrations

Initial Setup

The application automatically creates the database schema on first run using:

  • spring.jpa.hibernate.ddl-auto=update
  • Entity annotations for table creation

Schema Updates

  • Automatic schema evolution
  • Data migration scripts (if needed)
  • Version control for database changes

๐Ÿค Contributing

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

Code Standards

  • Follow Java coding conventions
  • Use meaningful variable and method names
  • Add comprehensive documentation
  • Include unit tests for new features

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Spring Boot team for the excellent framework
  • Bootstrap team for the responsive UI components
  • Font Awesome for the icon library
  • The open-source community for various libraries and tools

๐Ÿ“ž Support

For support and questions:

  • Create an issue in the GitHub repository
  • Check the documentation
  • Review existing issues and discussions

๐Ÿ”ฎ Roadmap

Planned Features

  • Real-time notifications
  • Mobile app (React Native/Flutter)
  • Advanced analytics dashboard
  • Integration with external blood banks
  • SMS/Email notifications
  • Multi-language support
  • API documentation (Swagger)
  • Performance monitoring
  • Automated testing pipeline

Version History

  • v0.0.1-SNAPSHOT: Initial release with core functionality

BloodHub - Connecting blood donors with those in need, one request at a time. โค๏ธ

About

Developed a dynamic web application for managing blood donations, donor registrations, and blood requests with full CRUD functionality. Included Patient and Doctor Modules where patients can register and add blood group details, and doctors can view and contact patients as needed. Technologies Used: Spring Boot, Hibernate, JSP, MySQL,WebTechnology

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors