A comprehensive Spring Boot web application for managing blood donation requests, connecting donors with recipients, and managing hospital information.
- 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
- Regular Users: Can post blood requests, search for donors, and view hospital information
- Administrators: Full system access including user management and system configuration
- Spring Security integration with BCrypt password encoding
- Role-based access control
- Secure session management
- CSRF protection
- Java 11
- Spring Boot 2.7.14
- Spring Data JPA
- Spring Security
- MySQL 8.0
- Thymeleaf (Server-side templating)
- Bootstrap 5.1.3 (Responsive UI framework)
- Font Awesome 6.0.0 (Icons)
- Custom CSS & JavaScript
- Maven (Dependency management and build)
- Gradle Wrapper (Alternative build option)
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)
git clone <repository-url>
cd blood-management-system- Create a MySQL database:
CREATE DATABASE blood_management;- 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# Using Maven
mvn clean install
mvn spring-boot:run
# Or using the JAR file
java -jar target/blood-management-system-0.0.1-SNAPSHOT.jarOpen your browser and navigate to: http://localhost:8080/bloodhub
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
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=adminYou 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- 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
- Users can have multiple roles
- Blood requests are associated with users
- Hospitals are categorized by division
- Form-based login with Spring Security
- Password encryption using BCrypt
- Session management with remember-me functionality
- Role-based access control
- URL-level security constraints
- Method-level security annotations
- Enabled by default
- Token-based protection for all forms
- Exceptions for specific endpoints if needed
GET /- Home pageGET /home- Home pageGET /login- Login pageGET /register- Registration pageGET /forgot-password- Password reset page
GET /dashboard- User dashboardGET /profile- User profileGET /blood-requests- List blood requestsPOST /blood-requests/create- Create blood requestGET /hospitals/nearby- Find nearby hospitals
GET /admin/**- Admin panel (requires ADMIN role)
- Mobile-first approach using Bootstrap 5
- Responsive navigation and layouts
- Touch-friendly interface elements
- Dynamic form validation
- Real-time search and filtering
- Smooth animations and transitions
- Toast notifications
- Light/dark theme toggle
- Customizable color schemes
- Consistent branding throughout
# Unit tests
mvn test
# Integration tests
mvn verify
# All tests with coverage
mvn clean test jacoco:report- Unit tests for services and controllers
- Integration tests for repositories
- End-to-end tests for critical workflows
mvn clean package -PprodFROM openjdk:11-jre-slim
COPY target/blood-management-system-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]- Development:
application-dev.properties - Production:
application-prod.properties - Testing:
application-test.properties
- Logback for logging framework
- Configurable log levels
- Structured logging for production
- Spring Boot Actuator endpoints
- Database connectivity checks
- Application health status
The application automatically creates the database schema on first run using:
spring.jpa.hibernate.ddl-auto=update- Entity annotations for table creation
- Automatic schema evolution
- Data migration scripts (if needed)
- Version control for database changes
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
- Follow Java coding conventions
- Use meaningful variable and method names
- Add comprehensive documentation
- Include unit tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- 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
For support and questions:
- Create an issue in the GitHub repository
- Check the documentation
- Review existing issues and discussions
- 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
- v0.0.1-SNAPSHOT: Initial release with core functionality
BloodHub - Connecting blood donors with those in need, one request at a time. โค๏ธ