Skip to content

sazzadul1205/BloodConnect-Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

62 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🩸 BloodConnect - Blood Donation Community Platform

Version React License

BloodConnect is a comprehensive full-stack web application designed to bridge the gap between blood donors, recipients, hospitals, and blood banks. The platform facilitates efficient blood donation management, real-time inventory tracking, and streamlined communication between all stakeholders in the blood donation ecosystem.

πŸ“‹ Table of Contents

✨ Features

For All Users

  • πŸ” Secure authentication and authorization
  • πŸ‘€ Role-based access control (RBAC)
  • πŸ“± Fully responsive design
  • πŸŒ™ Dark/Light theme support
  • πŸ“Š Real-time notifications and updates

For Donors

  • 🩸 Complete donor profile management
  • πŸ“… Donation event registration
  • πŸ“œ Donation history tracking
  • πŸ₯ Medical information management
  • πŸ” Blood request browsing

For Hospitals

  • πŸ₯ Hospital profile management
  • πŸ’‰ Blood bank inventory viewing
  • πŸ“ Blood request creation and management
  • πŸ‘₯ Donor search functionality
  • πŸ“Š Dashboard with key metrics

For Blood Banks

  • πŸ“¦ Inventory management with real-time updates
  • πŸŽ‰ Blood donation event management
  • πŸ‘¨β€βš•οΈ Staff dashboard for check-ins
  • πŸ“ˆ Analytics and reporting
  • βœ… Donor eligibility verification

For Requesters

  • πŸ“ Blood request creation
  • πŸͺ Blood bank directory
  • πŸ“‹ Request status tracking
  • πŸ“Š Request history

For Administrators

  • πŸ‘₯ User management across all roles
  • 🏒 Blood bank management
  • πŸ“Š System-wide statistics
  • πŸ“‹ Audit logs and monitoring
  • πŸ“ˆ Comprehensive reporting

πŸ‘₯ User Roles & Permissions

Role Hierarchy

Super Admin β†’ Admin β†’ Blood Bank Staff β†’ Hospital Staff β†’ Donor/Requester

Navigation by Role

Donor

  • Dashboard
  • Donor Profile
  • My Profile
  • Medical Information
  • Donation History
  • Blood Requests
  • Donation Events
  • Settings

Hospital

  • Dashboard
  • Blood Banks
  • Create Request
  • My Requests
  • Donor Search
  • Events
  • Settings

Requester

  • Dashboard
  • Create Request
  • My Requests
  • Blood Banks
  • Settings

Blood Bank

  • Bank Profile
  • Inventory Management
  • Events Management
  • Staff Dashboard
  • Settings

Admin & Super Admin

  • Admin Dashboard
  • My Profile
  • Users Management
  • Audit Logs
  • System Statistics
  • Blood Banks Management
  • Settings

πŸ›  Technology Stack

Frontend

  • React 18 - UI library
  • React Router v6 - Navigation and routing
  • Tailwind CSS - Styling and responsive design
  • React Query - Server state management
  • Axios - HTTP client
  • React Hook Form - Form handling
  • Recharts - Data visualization
  • React Hot Toast - Toast notifications
  • Date-fns - Date manipulation

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - Database
  • JWT - Authentication
  • Bcrypt - Password hashing

Development Tools

  • Vite - Build tool
  • ESLint - Code linting
  • Prettier - Code formatting
  • Git - Version control

πŸ“ Project Structure

src/
β”œβ”€β”€ πŸ“‚ assets/              # Static assets (images, icons)
β”œβ”€β”€ πŸ“‚ hooks/               # Custom React hooks
β”‚   β”œβ”€β”€ useAuth.js         # Authentication hook
β”‚   └── useAxiosPublic.js  # Axios instance hook
β”œβ”€β”€ πŸ“‚ middleware/          # Route protection middleware
β”‚   β”œβ”€β”€ AlreadyLoggedIn.jsx
β”‚   β”œβ”€β”€ RequireAuth.jsx
β”‚   └── RequireRole.jsx
β”œβ”€β”€ πŸ“‚ Pages/               # Main application pages
β”‚   β”œβ”€β”€ πŸ“‚ auth/           # Authentication pages
β”‚   β”œβ”€β”€ πŸ“‚ backend/        # Role-specific dashboards
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ Admin/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ Blood_Bank/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ Donor/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ Hospital/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ Requester/
β”‚   β”‚   └── πŸ“‚ Layout/
β”‚   └── πŸ“‚ Frontend/        # Public facing pages
β”œβ”€β”€ πŸ“‚ shared/              # Shared components
β”œβ”€β”€ πŸ“‚ utils/               # Utility functions
└── main.jsx               # Application entry point

πŸš€ Installation

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • MongoDB (local or Atlas)

Setup Instructions

  1. Clone the repository

    git clone https://github.com/yourusername/bloodconnect.git
    cd bloodconnect
  2. Install dependencies

    npm install
    # or
    yarn install
  3. Environment Configuration Create a .env file in the root directory:

    VITE_API_URL=http://localhost:5000/api
    VITE_APP_NAME=BloodConnect
  4. Start the development server

    npm run dev
    # or
    yarn dev
  5. Build for production

    npm run build
    # or
    yarn build

βš™οΈ Configuration

Authentication Setup

The application uses JWT-based authentication with role-based access control. Configure your authentication settings in the backend environment variables:

JWT_SECRET=your_jwt_secret
JWT_EXPIRE=7d
BCRYPT_SALT_ROUNDS=10

Database Configuration

Ensure your MongoDB connection is properly configured:

MONGODB_URI=mongodb://localhost:27017/bloodconnect
# or MongoDB Atlas
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/bloodconnect

πŸ“– Usage

Running the Application

  1. Development Mode

    npm run dev

    Access the application at http://localhost:5173

  2. Production Build

    npm run build
    npm run preview

Default User Roles for Testing

// Test credentials (development only)
{
  donor: { email: 'donor@test.com', password: 'Donor@123' },
  hospital: { email: 'hospital@test.com', password: 'Hospital@123' },
  admin: { email: 'admin@test.com', password: 'Admin@123' }
}

πŸ“‘ API Documentation

Authentication Endpoints

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • POST /api/auth/forgot-password - Password reset request
  • POST /api/auth/reset-password - Password reset
  • GET /api/auth/verify-email - Email verification

User Endpoints

  • GET /api/users/profile - Get user profile
  • PUT /api/users/profile - Update user profile
  • GET /api/users/:userId - Get user by ID
  • GET /api/users - Get all users (admin only)

Donor Endpoints

  • GET /api/donors/:donorId/medical - Get medical information
  • PUT /api/donors/:donorId/medical - Update medical information
  • GET /api/donors/:donorId/history - Get donation history
  • POST /api/donors/:donorId/check-eligibility - Check donation eligibility

Blood Request Endpoints

  • POST /api/blood-requests - Create blood request
  • GET /api/blood-requests - Get all blood requests
  • GET /api/blood-requests/:requestId - Get request details
  • PUT /api/blood-requests/:requestId - Update request status

Blood Bank Endpoints

  • GET /api/blood-banks - Get all blood banks
  • GET /api/blood-banks/:bankId/inventory - Get inventory
  • PUT /api/blood-banks/:bankId/inventory - Update inventory
  • POST /api/blood-banks/:bankId/events - Create donation event

🀝 Contributing

We welcome contributions to BloodConnect! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/AmazingFeature
  3. Commit your changes
    git commit -m 'Add some AmazingFeature'
  4. Push to the branch
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Contribution Guidelines

  • Follow the existing code style
  • Write meaningful commit messages
  • Update documentation as needed
  • Add tests for new features
  • Ensure all tests pass

πŸ“„ License

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

πŸ™ Acknowledgments

  • Icons provided by Feather Icons
  • UI inspiration from modern healthcare platforms
  • Community contributors and testers

πŸ“ž Contact & Support


Made with ❀️ for the blood donation community
```

About

A Simple community blood Donation / Requesting website

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages