Skip to content

Dibya-Saha/Blood-Connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🩸 BloodConnect

A modern, bilingual (English/বাংলা) blood donation management platform connecting donors with those in need across Bangladesh.

✨ Features

  • Bilingual Support: Full English and Bengali language support
  • Real-time Emergency Map: Interactive Leaflet map showing blood requests
  • AI Health Assistant: Gemini-powered chatbot for myth-busting and health advice
  • Inventory Management: Track blood stock levels across hospitals
  • Donor Dashboard: Personal dashboard with points and statistics
  • Ramadan Special: Post-Iftar donation slot booking system
  • Responsive Design: Works perfectly on desktop, tablet, and mobile

πŸš€ Quick Start

Prerequisites

Installation

  1. Clone this repository

  2. Install dependencies:

npm install
npm install d3
  1. Set up environment variables:
# backend .env file should contain:

MONGODB_URI=

JWT_SECRET=kdsjfK32dksldfsksdAd323lksdkskskfsdkjieksjio232klSDFWEsjfeisakdjiweksjdei

PORT=5000
NODE_ENV=development
VITE_OPENAI_API_KEY=
  1. Run the development server:
#start
npm run dev 
#terminate
ctrl + C 
  1. Open your browser to http://localhost:3000

Building for Production

npm run build

The production files will be in the dist/ folder.

πŸ“ Project Structure

##Frontend 
src/
β”œβ”€β”€ components/              # React Components
β”‚   β”œβ”€β”€ Auth.tsx            # Login/Register UI
β”‚   β”œβ”€β”€ Dashboard.tsx       # Main dashboard view
β”‚   β”œβ”€β”€ RequestBlood.tsx    # Blood request form
β”‚   β”œβ”€β”€ Inventory.tsx       # Blood inventory viewer
β”‚   β”œβ”€β”€ AppointmentBooking.tsx  # Appointment booking form
β”‚   β”œβ”€β”€ Appointments.tsx    # User's appointments list
β”‚   β”œβ”€β”€ Chat.tsx            # Real-time chat interface
β”‚   β”œβ”€β”€ MythsAssistant.tsx  # AI-powered myths assistant
β”‚   β”œβ”€β”€ EmergencyMap.tsx    # Interactive blood request map
β”‚   └── Profile.tsx         # User profile management
β”‚
β”œβ”€β”€ services/                # API Service Layer
β”‚   β”œβ”€β”€ authService.ts      # Authentication API calls
β”‚   β”œβ”€β”€ dashboardService.ts # Dashboard data fetching
β”‚   β”œβ”€β”€ inventoryService.ts # Inventory API calls
β”‚   β”œβ”€β”€ requestService.ts   # Blood request API calls
β”‚   β”œβ”€β”€ appointmentService.ts # Appointment API calls
β”‚   β”œβ”€β”€ chatService.ts      # Chat messaging API calls
β”‚   └── geminiService.ts    # Gemini/OpenAI integration
β”‚
β”œβ”€β”€ App.tsx                  # Root component
β”œβ”€β”€ main.tsx                # Vite entry point
└── index.css               # Global styles

##Backend

backend/
β”œβ”€β”€ config/                    # Configuration Files
β”‚   β”œβ”€β”€ database.js           # MongoDB connection setup
β”‚   └── constants.js          # Application constants (blood types, roles, etc)
β”‚
β”œβ”€β”€ models/                    # MongoDB Mongoose Models
β”‚   β”œβ”€β”€ User.js               # User schema (donors, recipients, admins)
β”‚   β”œβ”€β”€ BloodInventory.js     # Blood stock tracking
β”‚   β”œβ”€β”€ BloodRequest.js       # Blood request submissions
β”‚   β”œβ”€β”€ Appointment.js        # Donation appointment bookings
β”‚   β”œβ”€β”€ Conversation.js       # Chat conversation threads
β”‚   └── Message.js            # Chat messages
β”‚
β”œβ”€β”€ routes/                    # API Route Handlers
β”‚   β”œβ”€β”€ auth.js               # Auth endpoints (register, login)
β”‚   β”œβ”€β”€ users.js              # User profile management
β”‚   β”œβ”€β”€ inventory.js          # Blood inventory endpoints
β”‚   β”œβ”€β”€ requests.js           # Blood request endpoints
β”‚   β”œβ”€β”€ appointments.js       # Appointment booking endpoints
β”‚   β”œβ”€β”€ chat.js               # Chat messaging endpoints
β”‚   β”œβ”€β”€ dashboard.js          # Dashboard statistics endpoints
β”‚   └── notifications.js      # Notification endpoints
β”‚
β”œβ”€β”€ middleware/                # Express Middleware
β”‚   └── auth.js               # JWT authentication middleware
β”‚
β”œβ”€β”€ controllers/               # Route Logic Controllers
β”‚   └── authController.js     # Authentication controller
β”‚
β”œβ”€β”€ helpers/                   # Helper Functions
β”‚   └── responseHandler.js    # Standardized API response formatting
β”‚
β”œβ”€β”€ validators/                # Input Validation
β”‚   └── authValidator.js      # Auth endpoint validation rules
β”‚
β”œβ”€β”€ utils/                     # Utility Functions
β”‚   └── emailService.js       # Email sending service
β”‚
β”œβ”€β”€ server.js                 # Main Express server file
β”œβ”€β”€ package.json              # Backend dependencies
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ .env                      # Backend environment variables
β”œβ”€β”€ .env.example             # Environment template
└── .gitignore               # Git ignore rules

πŸ”§ Key Technologies

  • React 18 with TypeScript
  • Vite for fast development and building
  • Tailwind CSS for styling
  • Recharts for data visualization
  • Leaflet for interactive maps
  • Google Open AI for health assistant
  • LocalStorage for mock database (development) (in Future connet into Claude MongoDB Atlas)
  • BackEed Express js and connects APIs from front to backend

🎨 Features Breakdown

1. Authentication System

  • Secure login/signup with validation
  • Age verification (18+)
  • Phone number validation (Bangladesh format)
  • Password strength indicator
  • Bilingual forms

2. Dashboard

  • Personal statistics and reward points
  • Donation trends charts
  • Blood inventory pie chart
  • Ramadan donation drive with slot booking
  • Real-time data updates

3. Emergency Map

  • Interactive map powered by Leaflet
  • Live blood request markers
  • Emergency vs Normal request indicators
  • Click to view details and call
  • Special Thalassemia patient badges

4. Inventory Management

  • Complete hospital blood stock tracking
  • Division-wise summaries
  • Critical shortage alerts
  • Expiry date monitoring
  • Filtering by city, type, and blood group

5. AI Health Assistant

  • Powered by Google Gemini
  • Myth-busting about blood donation
  • Health safety information
  • Culturally relevant for Bangladesh
  • Quick suggestion buttons

6. Profile Management

  • Personal information display
  • Medical records
  • Emergency contacts
  • Achievement badges (gamification)

7.User to User Message System

  • Login user can communicate with themselves for blood requests

🌐 Deployment

Get the OpenAi Api key (activated)

πŸ› Troubleshooting

Map not showing

  • Make sure Leaflet CSS and JS are loaded (check index.html)
  • Check browser console for errors

AI Assistant not working

  • Verify your Gemini API key is correct in .env
  • Make sure the file is named .env (not .env.txt)
  • Restart the dev server after adding the API key

Build errors

  • Delete node_modules and run npm install again
  • Make sure you're using Node.js 18 or higher

πŸ“ License

This project is open source and available for educational purposes.

πŸ“§ Contact

For questions or support, please open an issue on GitHub.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors