A comprehensive Hospital Management System built with the MERN stack (MongoDB, Express.js, React, Node.js) featuring patient management, appointment scheduling, medical records, and digital health cards.
- Patient Account Management: Create and manage patient accounts with complete profiles
- Digital Health Cards: Issue, manage, and validate digital health cards with QR codes
- Appointment Scheduling: Book, reschedule, and manage appointments with real-time availability
- Medical Records: Comprehensive medical record management for doctors
- Role-based Access Control: Secure access for Admin, Doctor, Staff, and Patient roles
- Notification System: Real-time notifications for appointments and updates
- Admin: Full system access and management
- Staff: Patient management and appointment scheduling
- Doctor: Patient care, medical records, and appointment management
- Patient: Personal profile, appointment booking, and health card access
- Node.js 16+
- MongoDB 4.4+
- npm or yarn
-
Clone the repository:
git clone <repository-url> cd hospital-management
-
Set up the backend:
cd backend npm install cp config.env .env # Edit .env with your configuration npm run dev
-
Set up the frontend:
cd ../frontend npm install npm run dev -
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
hospital-management/
βββ backend/ # Node.js/Express API
β βββ models/ # MongoDB schemas
β βββ routes/ # API routes
β βββ middleware/ # Authentication & validation
β βββ utils/ # Utility functions
β βββ server.js # Main server file
βββ frontend/ # React application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Page components
β β βββ contexts/ # React contexts
β β βββ services/ # API services
β β βββ App.jsx # Main app component
β βββ public/ # Static assets
βββ README.md # This file
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- bcryptjs - Password hashing
- CORS - Cross-origin resource sharing
- React 18 - UI library
- Vite - Build tool
- React Router - Client-side routing
- React Hook Form - Form handling
- React Query - Data fetching
- Axios - HTTP client
- Lucide React - Icons
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update profilePUT /api/auth/change-password- Change password
GET /api/patients- Get all patientsPOST /api/patients- Create patientGET /api/patients/:id- Get patient by IDPUT /api/patients/:id- Update patientDELETE /api/patients/:id- Delete patient
GET /api/doctors- Get all doctorsPOST /api/doctors- Create doctorGET /api/doctors/:id- Get doctor by IDGET /api/doctors/specialization/:specialization- Get doctors by specialization
GET /api/appointments- Get all appointmentsPOST /api/appointments- Create appointmentPUT /api/appointments/:id- Update appointmentPUT /api/appointments/:id/cancel- Cancel appointmentGET /api/appointments/availability/:doctorId- Get available time slots
GET /api/medical-records- Get all medical recordsPOST /api/medical-records- Create medical recordPUT /api/medical-records/:id- Update medical recordPOST /api/medical-records/:id/medication- Add medicationPOST /api/medical-records/:id/lab-result- Add lab result
GET /api/health-cards- Get all health cardsPOST /api/health-cards- Create health cardGET /api/health-cards/validate/:cardNumber- Validate health cardPUT /api/health-cards/:id/block- Block health card
- JWT Authentication: Secure token-based authentication
- Password Hashing: bcrypt for secure password storage
- Role-based Access Control: Granular permissions system
- Input Validation: Server-side validation for all inputs
- CORS Protection: Configured for secure cross-origin requests
- Rate Limiting: Protection against brute force attacks
- Responsive Design: Mobile-first, works on all devices
- Modern Interface: Clean, intuitive user interface
- Role-based Navigation: Different menus for different user types
- Real-time Updates: Live data updates and notifications
- Form Validation: Client-side and server-side validation
- Loading States: Smooth loading indicators
- Error Handling: User-friendly error messages
- Register for an account
- Complete your profile
- Browse available doctors
- Book appointments
- View your health card
- Access your medical records
- Register with medical credentials
- Set up your profile and specialization
- View your appointments
- Create medical records for patients
- Manage your schedule
- Access patient management
- Schedule appointments
- Issue health cards
- Manage doctor schedules
- Handle check-ins
- Full system access
- Manage all users
- Oversee appointments
- System configuration
- Analytics and reporting
- Set up MongoDB Atlas or local MongoDB
- Configure environment variables
- Deploy to platforms like Heroku, Railway, or DigitalOcean
- Set up CORS for your frontend domain
- Build the production version:
npm run build - Deploy to platforms like Vercel, Netlify, or GitHub Pages
- Configure API endpoints for production
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Commit your changes:
git commit -m 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the documentation in the
/backendand/frontenddirectories - Review the API documentation
- v1.0.0 - Initial release with core functionality
- User authentication and role management
- Patient and doctor management
- Appointment scheduling
- Medical records system
- Digital health cards
- Notification system