A comprehensive telemedicine platform built with the MERN stack (MongoDB, Express.js, React, Node.js) that connects patients with healthcare providers through AI-powered features.
- User Authentication & Authorization: Secure JWT-based authentication for patients, doctors, and admins
- Doctor Management: Complete doctor profiles with specialties, availability, and ratings
- Patient Management: Patient profiles with medical history and records
- Appointment Booking: Real-time scheduling with calendar integration
- Video Consultations: WebRTC-based video calling for remote consultations
- AI Symptom Checker: Intelligent symptom analysis and triage system
- Prescription Management: E-prescriptions with digital records
- Medical Records: Secure storage and management of medical documents
- Payment Integration: Stripe integration for consultation fees
- Real-time Notifications: Socket.io for instant updates
- Symptom Analysis: AI-powered symptom checker with condition probability assessment
- Triage System: Emergency level assessment and care setting recommendations
- Doctor Recommendations: AI-based doctor matching based on symptoms and specialization
- Health Insights: Personalized health recommendations and lifestyle suggestions
telemedicine-app/
├── backend/ # Node.js/Express backend
│ ├── src/
│ │ ├── controllers/ # Route controllers
│ │ ├── models/ # MongoDB models
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Authentication and validation
│ │ ├── config/ # Configuration files
│ │ └── utils/ # Utility functions
│ ├── package.json
│ └── server.js
├── middleware/ # API gateway and business logic
│ ├── src/
│ │ ├── services/ # Service layers
│ │ ├── utils/ # Utility functions
│ │ └── config/ # Configuration
│ └── package.json
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── pages/ # Page components
│ │ ├── context/ # React context
│ │ ├── hooks/ # Custom hooks
│ │ ├── services/ # API services
│ │ └── styles/ # CSS and styling
│ ├── public/
│ └── package.json
└── README.md
- Node.js: Runtime environment
- Express.js: Web framework
- MongoDB: NoSQL database
- Mongoose: ODM for MongoDB
- JWT: Authentication
- Socket.io: Real-time communication
- Stripe: Payment processing
- Twilio: SMS and notifications
- Bcryptjs: Password hashing
- Z-AI Web Dev SDK: AI integration
- Express.js: API gateway
- Redis: Caching layer
- Axios: HTTP client
- Winston: Logging
- Joi: Data validation
- React: UI framework
- Vite: Build tool
- React Router: Client-side routing
- React Query: Server state management
- Zustand: Client state management
- Tailwind CSS: Styling
- Axios: HTTP client
- Socket.io Client: Real-time features
- React Hot Toast: Notifications
- Node.js (v16 or higher)
- MongoDB
- Redis (optional, for caching)
-
Clone the repository
git clone https://github.com/SaqibShah-dev/Symptoscan.git cd telemedicine-app -
Install dependencies for all components
# Backend cd backend npm install # Middleware cd ../middleware npm install # Frontend cd ../frontend npm install
-
Environment Configuration
# Copy environment template cp .env.example .env # Edit .env file with your configuration # Make sure to set all required variables
-
Database Setup
# Start MongoDB service # Make sure MongoDB is running on default port 27017 # Optional: Start Redis for caching # redis-server
-
Run the Application
Terminal 1 - Backend:
cd backend npm run devTerminal 2 - Middleware:
cd middleware npm run devTerminal 3 - Frontend:
cd frontend npm run dev -
Access the Application
- Frontend: http://localhost:3000
- Middleware API: http://localhost:3001
- Backend API: http://localhost:5000
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current userPOST /api/auth/logout- User logout
GET /api/doctors- List doctors with filteringGET /api/doctors/:id- Get doctor detailsPUT /api/doctors/:id/profile- Update doctor profilePUT /api/doctors/:id/status- Update doctor status
POST /api/appointments- Book appointmentGET /api/appointments- List appointmentsGET /api/appointments/:id- Get appointment detailsPUT /api/appointments/:id/status- Update appointment status
POST /api/ai/symptom-checker- Analyze symptomsPOST /api/ai/triage- Get triage assessmentPOST /api/ai/doctor-recommendation- Get doctor recommendations
The AI symptom checker uses the Z-AI Web Dev SDK to provide intelligent health insights:
// Example AI symptom analysis
const completion = await zai.chat.completions.create({
messages: [
{
role: 'system',
content: 'You are an AI medical assistant providing preliminary symptom analysis.'
},
{
role: 'user',
content: 'Analyze these symptoms: headache, fever, fatigue'
}
]
});Socket.io enables real-time features:
// Video call signaling
socket.emit('video-call', {
roomId: appointment._id,
signal: data.signal
});
// Chat messaging
socket.emit('chat-message', {
roomId: consultation._id,
message: messageData
});JWT-based authentication with role-based authorization:
// Authentication middleware
const auth = async (req, res, next) => {
const token = req.header('Authorization')?.replace('Bearer ', '');
const decoded = jwt.verify(token, process.env.JWT_SECRET);
req.user = await User.findById(decoded.userId);
next();
};- Set all environment variables in production
- Use strong JWT secrets
- Configure production database URLs
- Set up proper CORS origins
# Backend
cd backend
npm run build
# Frontend
cd frontend
npm run build
# Middleware
cd middleware
npm run build- Authentication: JWT tokens with proper expiration
- Authorization: Role-based access control
- Data Validation: Input sanitization and validation
- Rate Limiting: API rate limiting to prevent abuse
- HTTPS: SSL/TLS encryption in production
- Environment Variables: Sensitive data in environment variables
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please open an issue in the repository or contact the development team.
Note: This is a healthcare application and should be used in compliance with healthcare regulations such as HIPAA. Always consult with healthcare professionals for medical advice and treatment.