A comprehensive hospital management system built with React, Node.js, Express, and MongoDB. The system includes patient portal, admin dashboard, and doctor dashboard with appointment management, user authentication, and medical records.
Hospital-Management-System/
βββ backend/ # Node.js API server
βββ clientside/ # Patient portal (React)
βββ admin/ # Admin & Doctor dashboard (React)
βββ api/ # Serverless API functions
βββ vercel.json # Deployment configuration
- User registration and authentication
- Doctor search and filtering
- Appointment booking
- Profile management
- Medical history
- Doctor management (add, edit, remove)
- Appointment oversight
- User management
- Analytics and reports
- Appointment management
- Patient records
- Schedule management
- Profile settings
- Node.js (v18 or higher)
- MongoDB database
- Cloudinary account (for image uploads)
# Clone the repository
git clone <repository-url>
cd Hospital-Management-System
# Install all dependencies
npm run install-all# Database Configuration
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net
DB_NAME=HospitalManagement
# JWT Configuration
JWT_SECRET=your_jwt_secret_key_here
# Cloudinary Configuration
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_SECRET_KEY=your_cloudinary_secret_key
# Admin Configuration
ADMIN_EMAIL=admin@hospital.com
ADMIN_PASSWORD=admin123
# Server Configuration
PORT=4000
NODE_ENV=developmentVITE_BACKEND_URL=http://localhost:4000
VITE_ADMIN_URL=/admin
VITE_APP_NAME=Hospital Management SystemVITE_BACKEND_URL=http://localhost:4000
VITE_APP_NAME=Hospital Management System- Create a MongoDB database (local or Atlas)
- Update the
MONGODB_URIin backend/.env - The application will create necessary collections automatically
- Sign up at Cloudinary
- Get your cloud name, API key, and API secret
- Update the Cloudinary variables in backend/.env
npm run devThis will start:
- Backend server on
http://localhost:4000 - Client (Patient Portal) on
http://localhost:5173 - Admin Dashboard on
http://localhost:5174
# Backend only
npm run backend
# Client only
npm run client
# Admin only
npm run adminnpm run build- Patient Portal:
http://localhost:5173 - Admin/Doctor Login:
http://localhost:5174 - API Server:
http://localhost:4000 - API Documentation:
http://localhost:4000/api
- Email:
admin@hospital.com - Password:
admin123
- Doctors are created through admin dashboard
- Each doctor gets login credentials via the admin panel
-
Connect your repository to Vercel
-
Set environment variables in Vercel dashboard:
MONGODB_URI=your_mongodb_connection JWT_SECRET=your_jwt_secret CLOUDINARY_NAME=your_cloudinary_name CLOUDINARY_API_KEY=your_cloudinary_key CLOUDINARY_SECRET_KEY=your_cloudinary_secret ADMIN_EMAIL=admin@hospital.com ADMIN_PASSWORD=admin123
-
Update frontend environment variables:
VITE_BACKEND_URL=https://your-app.vercel.app/api
-
Deploy using:
vercel --prod
POST /register- User registrationPOST /login- User loginGET /get-profile- Get user profilePOST /update-profile- Update user profileGET /doctors- Get all doctorsPOST /book-appointment- Book appointment
POST /add-doctor- Add new doctorPOST /login- Admin loginGET /appointments- Get all appointmentsGET /dashboard- Dashboard statistics
POST /login- Doctor loginGET /appointments- Get doctor appointmentsPOST /complete-appointment- Mark appointment completeGET /dashboard- Doctor dashboard data
- JWT-based authentication
- Password hashing with bcrypt
- Input validation
- CORS configuration
- Environment variable protection
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose
- Authentication: JWT + bcrypt
- File Upload: Multer + Cloudinary
- Validation: Custom middleware
- Framework: React 18
- Build Tool: Vite
- Styling: Tailwind CSS
- Routing: React Router v6
- HTTP Client: Axios
- Notifications: React Toastify
- Deployment: Vercel
- Environment: Node.js serverless functions
- Database: MongoDB Atlas
- Storage: Cloudinary CDN
-
CORS Errors
- Ensure backend URL is correctly set in frontend .env files
- Check CORS configuration in backend/server.js
-
Database Connection
- Verify MongoDB URI in backend/.env
- Check network access in MongoDB Atlas
-
Image Upload Issues
- Verify Cloudinary credentials
- Check file size limits
-
Build Errors
- Run
npm run install-allto ensure all dependencies are installed - Clear node_modules and reinstall if needed
- Run
- Payment integration
- SMS/Email notifications
- Video consultation
- Mobile application
- Advanced reporting
- Multi-language support
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email support@hospital.com or create an issue in the repository.