A comprehensive telemedicine platform enabling seamless doctor-patient consultations with AI-powered features, real-time communication, and digital health record management.
- Secure user registration and login
- Role-based access control (Doctor/Patient)
- JWT-based session management
- Protected routes and API endpoints
- Patient Queue Management - View and manage incoming patient appointments
- Attended Patients - Track completed consultations with detailed records
- Digital Records - Comprehensive patient history with secure unique IDs
- Prescription Management - Create, view, and download prescriptions
- Real-time Statistics - Monitor daily appointments and patient data
- Health Records - Personal medical history and prescription tracking
- Appointment Booking - Schedule consultations with available doctors
- Medicine Tracker - Monitor current medications and dosages
- Live Medicine Stock - Check medicine availability in real-time
- WebRTC Integration - High-quality peer-to-peer video calls
- Real-time Communication - Instant messaging during consultations
- Call Notifications - Audio/visual alerts for incoming calls
- Cross-platform Support - Works on desktop and mobile browsers
- RAG System - Retrieval-Augmented Generation for medical queries
- Symptom Analysis - AI-powered preliminary diagnosis assistance
- Smart Recommendations - Intelligent treatment suggestions
- Medical Knowledge Base - Extensive medical information retrieval
- Secure Patient Records - HIPAA-compliant data storage
- Export Functionality - Download medical records in various formats
- Digital Prescriptions - Generate and manage electronic prescriptions
- Comprehensive Reporting - Detailed medical history reports
- Socket.io Integration - Live updates and notifications
- Live Status Tracking - Real-time appointment status updates
- Instant Messaging - Chat system during consultations
- Notification System - Push notifications for important events
- React 18.3.1 - Modern UI framework with hooks and context
- Redux Toolkit - State management with RTK Query
- React Router Dom - Client-side routing and navigation
- Tailwind CSS - Utility-first CSS framework
- Framer Motion - Advanced animations and transitions
- Three.js - 3D graphics and interactive elements
- Vite - Fast development server and build tool
- Node.js & Express - Server-side JavaScript runtime
- MongoDB & Mongoose - NoSQL database with ODM
- Socket.io - Real-time bidirectional communication
- JWT - JSON Web Tokens for authentication
- bcryptjs - Password hashing and security
- Google Generative AI - AI integration for medical assistance
- WebRTC - Peer-to-peer video/audio communication
- Simple-peer - WebRTC wrapper for easier implementation
- Socket.io - Real-time messaging and notifications
- Nodemon - Automatic server restart during development
- CORS - Cross-origin resource sharing configuration
- dotenv - Environment variable management
- Body-parser - Request body parsing middleware
- Node.js 18.x or higher
- MongoDB (local or cloud instance)
- Modern web browser with WebRTC support
- Git for version control
-
Clone the repository
git clone https://github.com/Rupendra0/Medi-mitra.git cd Medi-mitra -
Backend Setup
cd backend npm install # Create .env file cp .env.example .env # Edit .env with your configuration
-
Frontend Setup
cd ../frontend npm install -
Environment Configuration
Create
backend/.env:PORT=5000 MONGO_URI=mongodb://localhost:27017/medimitra JWT_SECRET=your_jwt_secret_key GEMINI_API_KEY=your_google_ai_api_key NODE_ENV=development
-
Database Setup
# Make sure MongoDB is running # The application will create collections automatically
-
Start Backend Server
cd backend npm start # Server runs on http://localhost:5000
-
Start Frontend Development Server
cd frontend npm run dev # Frontend runs on http://localhost:5173
-
Access the Application
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:5000
- Frontend:
POST /api/auth/register - User registration
POST /api/auth/login - User login
POST /api/auth/logout - User logout
GET /api/auth/verify - Token verification
GET /api/patients - Get all patients
GET /api/patients/:id - Get patient by ID
POST /api/patients - Create new patient
PUT /api/patients/:id - Update patient
DELETE /api/patients/:id - Delete patient
GET /api/patient/:id/complete-history - Get complete patient history
GET /api/appointments - Get all appointments
POST /api/appointments - Create new appointment
PUT /api/appointments/:id - Update appointment
DELETE /api/appointments/:id - Delete appointment
GET /api/doctor-queue - Get doctor's patient queue
GET /api/attended-patients - Get attended patients
GET /api/prescriptions - Get all prescriptions
POST /api/prescriptions - Create new prescription
PUT /api/prescriptions/:id - Update prescription
DELETE /api/prescriptions/:id - Delete prescription
connect - User connection
disconnect - User disconnection
join-room - Join video call room
leave-room - Leave video call room
call-user - Initiate video call
call-accepted - Accept incoming call
call-rejected - Reject incoming call
Medi-mitra/
βββ backend/ # Backend API server
β βββ controllers/ # Route controllers
β β βββ authController.js
β β βββ mainController.js
β β βββ debugController.js
β βββ middleware/ # Custom middleware
β β βββ auth.js
β βββ models/ # Database models
β β βββ User.js
β β βββ Appointment.js
β β βββ Prescription.js
β β βββ ChatMessage.js
β βββ routes/ # API routes
β β βββ auth.js
β β βββ main.js
β β βββ protected.js
β β βββ ragRoutes.js
β βββ services/ # Business logic
β β βββ socket.js
β β βββ ragService.js
β βββ config/ # Configuration
β β βββ config.js
β βββ utils/ # Utilities
β β βββ vectorstore.json
β βββ index.js # Entry point
β
βββ frontend/ # React frontend
β βββ src/
β β βββ components/ # Reusable components
β β β βββ Navbar.jsx
β β β βββ Footer.jsx
β β β βββ CallNotification.jsx
β β β βββ patient-panels/
β β βββ pages/ # Page components
β β β βββ Home.jsx
β β β βββ Login.jsx
β β β βββ Signup.jsx
β β β βββ DoctorDashboard.jsx
β β β βββ PatientDashboard.jsx
β β β βββ CallPage.jsx
β β βββ hooks/ # Custom hooks
β β β βββ useWebRTC.js
β β β βββ usePatientWebRTC.js
β β βββ utils/ # Utilities
β β β βββ api.js
β β β βββ authSlice.js
β β β βββ store.js
β β β βββ socket.js
β β βββ styles/ # CSS files
β β βββ App.jsx # Main app component
β βββ public/ # Static assets
β βββ package.json
β
βββ LICENSE # MIT License
βββ README.md # Project documentation
Users Collection:
{
name: String,
email: String (unique),
password: String (hashed),
role: String (enum: ['doctor', 'patient']),
uniqueId: String,
specialization: String, // for doctors
age: Number,
gender: String,
phone: String,
createdAt: Date,
updatedAt: Date
}Appointments Collection:
{
patient: ObjectId (ref: 'User'),
doctor: ObjectId (ref: 'User'),
uniqueId: String,
symptoms: [String],
complaints: String,
reason: String,
status: String (enum: ['pending', 'completed', 'cancelled']),
attendedAt: Date,
prescription: ObjectId (ref: 'Prescription'),
createdAt: Date,
updatedAt: Date
}Prescriptions Collection:
{
patient: ObjectId (ref: 'User'),
doctor: ObjectId (ref: 'User'),
appointment: ObjectId (ref: 'Appointment'),
uniqueId: String,
medicines: [{
name: String,
dosage: String,
frequency: String,
duration: String
}],
notes: String,
nextVisit: String,
createdAt: Date,
updatedAt: Date
}- Password Hashing: bcryptjs with salt rounds
- JWT Authentication: Secure token-based auth
- CORS Protection: Configured cross-origin policies
- Data Sanitization: Secure unique IDs (no MongoDB ObjectIDs exposed)
- Input Validation: Server-side request validation
- Role-based Access: Protected routes and API endpoints
- Login with doctor credentials
- View Patient Queue to see pending appointments
- Start Video Call with patient
- Conduct Consultation using video/chat
- Create Prescription with medicines and notes
- Mark Appointment Complete and move to attended patients
- Export Records for patient history
- Register/Login with patient credentials
- Book Appointment by selecting symptoms
- Wait for Doctor in the queue
- Join Video Call when doctor is ready
- Receive Prescription after consultation
- Track Medicines in the medicine tracker
- View Health Records for medical history
- Ask Medical Questions in the chat interface
- Get Symptom Analysis for preliminary diagnosis
- Receive Treatment Recommendations based on symptoms
- Access Medical Knowledge through RAG system
Frontend Build Errors:
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm install
npm run devBackend Connection Issues:
# Check MongoDB connection
mongosh # or mongo
show dbs
# Verify environment variables
cat backend/.envWebRTC Connection Problems:
- Ensure HTTPS in production
- Check browser permissions for camera/microphone
- Verify STUN/TURN servers configuration
- Test with different browsers
Socket.io Issues:
- Check CORS configuration
- Verify server and client versions match
- Test connection with browser dev tools
- Use Browser Dev Tools for debugging WebRTC
- Monitor Network Tab for API call failures
- Check Console Logs for Socket.io connection status
- Verify Database connections and data structure
- Test with Multiple Browsers for compatibility
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes with proper documentation
- Add tests if applicable
- Commit your changes
git commit -m "Add amazing feature" - Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow ES6+ syntax and modern JavaScript practices
- Use meaningful commit messages with conventional commits
- Add JSDoc comments for functions and components
- Ensure responsive design for mobile compatibility
- Write clean, readable code with proper indentation
- Test cross-browser compatibility before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
- React Team for the amazing frontend framework
- MongoDB for the flexible NoSQL database
- Socket.io for real-time communication capabilities
- WebRTC for peer-to-peer video calling
- Google AI for generative AI integration
- Open Source Community for various packages and libraries
For support and questions:
- GitHub Issues: Create an issue
- Email: Contact the maintainer
- Documentation: Check this README and inline code comments
Built with β€οΈ for better healthcare accessibility