|
Patient Appointment Booking |
Staff & Management Portal |
Full Project Details & Contribution |
๐ฌ Feedback is warmly welcomed! Found a bug? Have a feature idea? Open an issue or reach out directly.
Click to expand
- โจ Overview
- ๐ฏ Key Features
- ๐๏ธ Architecture Diagram
- ๐ฅ User Role Access Matrix
- ๐ ๏ธ Tech Stack
- ๐ Project Structure
- ๐ Getting Started
- โ๏ธ Environment Variables
- ๐ Test Credentials
- ๐ก API Endpoints
- ๐ Security Features
- ๐ฃ๏ธ Roadmap
- ๐ค Contributing
- ๐ Reporting Issues
- ๐ Pull Request Rules
- โญ Show Your Support
- ๐ License
- ๐จโ๐ป Developer
Hospital Management System (HMS) is a comprehensive, full-stack, open-source healthcare management platform designed to streamline hospital operations. It features role-based access control with dedicated portals for Admins, Receptionists, and Doctors, along with a public-facing site for patients to book appointments online.
๐ฅ One Platform โ Three Powerful Portals โ Infinite Possibilities
| ๐ Public Site | ๐ Admin Portal | ๐ฉโโ๏ธ Receptionist Portal | ๐ฉบ Doctor Portal |
|---|---|---|---|
| Appointment Booking | Full System Control | Operations & Billing | Clinical Management |
| Department Browsing | User & Role Management | Patient Records | Appointment Handling |
| Doctor Discovery | Analytics Dashboard | Invoice Generation | Profile & Availability |
|
|
|
|
|
|
graph TB
subgraph Frontend["Frontend - Vercel"]
A["Public Site\nReact + Vite\nhms.gu-saurabh.site"]
B["Admin Panel\nReact 19 + Vite + Tailwind\nhms-admin.gu-saurabh.site"]
end
subgraph Backend["Backend - Node.js Server"]
C["Express.js API\nREST Endpoints"]
D["Auth Middleware\nJWT Verification"]
E["Controllers\nBusiness Logic"]
end
subgraph Services["Data and Services"]
F[("MongoDB Atlas\nDatabase")]
G["AWS S3\nFile Storage"]
H["AWS SES\nEmail Service"]
I["Google reCAPTCHA\nBot Protection"]
end
A -->|"API Calls"| C
B -->|"API Calls"| C
C --> D
D --> E
E --> F
E --> G
E --> H
A --> I
style A fill:#0d9488,stroke:#0d9488,color:#fff
style B fill:#6366f1,stroke:#6366f1,color:#fff
style C fill:#f59e0b,stroke:#f59e0b,color:#fff
style D fill:#ef4444,stroke:#ef4444,color:#fff
style E fill:#8b5cf6,stroke:#8b5cf6,color:#fff
style F fill:#47A248,stroke:#47A248,color:#fff
style G fill:#FF9900,stroke:#FF9900,color:#fff
style H fill:#FF9900,stroke:#FF9900,color:#fff
style I fill:#4285F4,stroke:#4285F4,color:#fff
| Feature | ๐ Admin | ๐ฉโโ๏ธ Receptionist | ๐ฉบ Doctor | ๐ Public |
|---|---|---|---|---|
| Dashboard & Analytics | โ | โ | โ | โ |
| User Management (CRUD) | โ | โ | โ | โ |
| Doctor Management | โ | โ | โ | โ |
| Receptionist Management | โ | โ | โ | โ |
| Department Management | โ | โ | โ | โ |
| Appointment Management | โ | โ | ๐๏ธ View | โ Book |
| Patient Management | โ | โ | ๐๏ธ View | โ |
| Billing & Invoicing | โ | โ | ๐๏ธ Read-only | โ |
| Slot Configuration | โ | โ | โ | โ |
| Invoice Template Design | โ | โ | โ | โ |
| Announcements (CMS) | โ | โ | โ | โ |
| Site Updates (CMS) | โ | โ | โ | โ |
| Support Tickets | โ | โ | โ | โ |
| Profile Management | โ | โ | โ | โ |
| Settings | โ | โ | โ | โ |
๐ฆ Full Dependency List
| Package | Version | Purpose |
|---|---|---|
| Backend | ||
express |
5.x | Web framework |
mongoose |
9.x | MongoDB ODM |
jsonwebtoken |
9.x | JWT authentication |
bcryptjs |
3.x | Password hashing |
helmet |
8.x | Security headers |
cors |
2.x | Cross-origin support |
morgan |
1.x | HTTP request logging |
multer |
2.x | File upload handling |
@aws-sdk/client-s3 |
3.x | AWS S3 integration |
@aws-sdk/client-ses |
3.x | AWS SES email |
axios |
1.x | HTTP client |
dotenv |
17.x | Environment variables |
| Admin Panel | ||
react |
19.x | UI framework |
react-router-dom |
7.x | Client-side routing |
recharts |
3.x | Charts & visualization |
lucide-react |
0.56x | Modern icons |
react-icons |
5.x | Additional icons |
react-hot-toast / sonner |
latest | Toast notifications |
react-quill-new |
3.x | Rich text editor |
react-easy-crop |
5.x | Image cropping |
qrcode |
1.x | QR code generation |
@headlessui/react |
2.x | Accessible UI components |
tailwindcss |
3.x | Utility-first CSS |
| Client Site | ||
react |
18.x | UI framework |
react-router-dom |
6.x | Client-side routing |
react-google-recaptcha |
3.x | Bot protection |
html2pdf.js |
0.14 | PDF generation |
Hospital-Management-System/
โ
โโโ ๐ server/ # โ๏ธ Backend API (Node.js + Express)
โ โโโ ๐ package.json
โ โโโ ๐ seed.js # ๐ฑ Database seeding script
โ โโโ ๐ .env # ๐ Server environment variables
โ โโโ ๐ src/
โ โโโ ๐ app.js # Express app configuration
โ โโโ ๐ server.js # Server entry point
โ โโโ ๐ config/
โ โ โโโ ๐ db.js # MongoDB connection
โ โ โโโ ๐ s3.js # AWS S3 config
โ โโโ ๐ controllers/ # ๐ Route handlers
โ โ โโโ ๐ authController.js
โ โ โโโ ๐ appointmentController.js
โ โ โโโ ... more controllers
โ โโโ ๐ middleware/
โ โ โโโ ๐ authMiddleware.js # ๐ก๏ธ JWT auth middleware
โ โโโ ๐ models/ # ๐ Mongoose schemas
โ โ โโโ ๐ User.js
โ โ โโโ ๐ Admin.js
โ โ โโโ ๐ Doctor.js
โ โ โโโ ... more models
โ โโโ ๐ routes/ # ๐ค๏ธ API route definitions
โ โ โโโ ๐ authRoutes.js
โ โ โโโ ๐ appointmentRoutes.js
โ โ โโโ ... more routes
โ โโโ ๐ services/ # โ๏ธ External service integrations
โ โ โโโ ๐ awsSesService.js # Email via AWS SES
โ โ โโโ ๐ captchaService.js # reCAPTCHA verification
โ โ โโโ ๐ s3Service.js # File upload via AWS S3
โ โโโ ๐ utils/ # ๐ง Utility functions
โ
โโโ ๐ Admin/ # ๐ Admin Panel (React 19 + Tailwind)
โ โโโ ๐ package.json
โ โโโ ๐ vite.config.js
โ โโโ ๐ tailwind.config.js
โ โโโ ๐ vercel.json
โ โโโ ๐ .env
โ โโโ ๐ src/
โ โโโ ๐ App.jsx # App router & route config
โ โโโ ๐ main.jsx # Entry point
โ โโโ ๐ components/ # ๐งฉ Reusable components
โ โ โโโ ๐ ProtectedRoute.jsx
โ โ โโโ ... more components
โ โโโ ๐ context/
โ โ โโโ ๐ AuthContext.jsx # ๐ Auth state management
โ โโโ ๐ layouts/
โ โ โโโ ๐ AdminLayout.jsx # ๐ Main layout wrapper
โ โโโ ๐ pages/ # ๐ Page components
โ โ โโโ ๐ Login.jsx
โ โ โโโ ๐ Dashboard.jsx # Admin dashboard
โ โ โโโ ๐ ReceptionistDashboard.jsx
โ โ โโโ ๐ *Profile.jsx # Role-specific profiles
โ โ โโโ ... more pages
โ โโโ ๐ services/
โ โ โโโ ๐ api.js # ๐ Axios API client
โ โโโ ๐ styles/
โ โ โโโ ๐ action-buttons.css
โ โโโ ๐ utils/
โ โโโ ๐ helpers.js # ๐ง Utility functions
โ
โโโ ๐ Client/ # ๐ Public Patient Site (React 18)
โ โโโ ๐ package.json
โ โโโ ๐ vite.config.js
โ โโโ ๐ vercel.json
โ โโโ ๐ .env
โ โโโ ๐ src/
โ โโโ ๐ App.jsx
โ โโโ ๐ main.jsx
โ โโโ ๐ pages/
โ โ โโโ ๐ Home.jsx # Landing page
โ โ โโโ ๐ AppointmentBooking.jsx
โ โ โโโ ๐ AppointmentConfirmation.jsx
โ โโโ ๐ services/
โ โโโ ๐ api.js # ๐ API client
โ
โโโ ๐ README.md # ๐ You are here!
โโโ ๐ .gitignore
| Requirement | Minimum Version | Recommended |
|---|---|---|
| v18+ | v20 LTS | |
| v6+ | Atlas (Cloud) | |
| v9+ | Latest | |
| v2+ | Latest |
1๏ธโฃ Clone the Repository
git clone https://github.com/Saurabhtbj1201/Hospital-Management-System.git
cd Hospital-Management-System2๏ธโฃ Install Server Dependencies
cd server
npm install3๏ธโฃ Install Admin Panel Dependencies
cd ../Admin
npm install4๏ธโฃ Install Client Site Dependencies
cd ../Client
npm install5๏ธโฃ Configure Environment Variables (see Environment Variables section)
6๏ธโฃ Seed the Database (creates test users)
cd ../server
node seed.jsOpen three terminals and run:
| Terminal | Command | URL |
|---|---|---|
| ๐ข Server | cd server && npm run dev |
http://localhost:5000 |
| ๐ต Admin Panel | cd Admin && npm run dev |
http://localhost:5173 |
| ๐ฃ Client Site | cd Client && npm run dev |
http://localhost:5174 |
๐ก The server runs on port 5000 by default. Admin and Client panels will auto-assign available ports via Vite.
# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGO_URI=your_mongodb_connection_string_here
# Authentication
JWT_SECRET=your_super_secret_jwt_key_here
# AWS SES (Email Service)
AWS_REGION=your_aws_region
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_SES_FROM_EMAIL=noreply@yourhospital.com
# AWS S3 (File Storage)
AWS_S3_BUCKET_NAME=your_s3_bucket_name
# Google reCAPTCHA
RECAPTCHA_SECRET_KEY=your_recaptcha_secret_keyVITE_API_URL=http://localhost:5000/api
VITE_APP_NAME=HMS Admin Portal
VITE_APP_VERSION=1.0.0
VITE_ENABLE_NOTIFICATIONS=true
VITE_ENABLE_ANALYTICS=falseVITE_API_URL=http://localhost:5000/api
โ ๏ธ Never commit.envfiles to version control. Use the.env.examplefiles as reference.
Use these credentials on the Admin Panel to explore different roles.
Note
These test credentials only work when running the project locally (localhost). You must seed the database first by running:
cd server
node seed.jsThis creates the default Admin, Receptionist, and Doctor accounts in your local MongoDB.
| ๐ Admin | ๐ฉโโ๏ธ Receptionist | ๐ฉบ Doctor | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
๐ Authentication โ /api/auth
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/auth/login |
Login with email/phone & password | โ |
POST |
/api/auth/register |
Register new user | โ |
GET |
/api/auth/profile |
Get current user profile | โ |
๐ฅ User Management โ /api/user-management
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/user-management |
Get all users | โ Admin |
POST |
/api/user-management |
Create new user | โ Admin |
PUT |
/api/user-management/:id |
Update user | โ Admin |
DELETE |
/api/user-management/:id |
Delete user | โ Admin |
๐ฉบ Doctors โ /api/doctors
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/doctors |
Get all doctors | โ |
POST |
/api/doctors |
Create doctor | โ Admin |
PUT |
/api/doctors/:id |
Update doctor | โ Admin |
DELETE |
/api/doctors/:id |
Delete doctor | โ Admin |
๐
Appointments โ /api/admin/appointments
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/admin/appointments |
Get all appointments | โ |
POST |
/api/admin/appointments |
Create appointment | โ |
PUT |
/api/admin/appointments/:id |
Update appointment | โ |
DELETE |
/api/admin/appointments/:id |
Delete appointment | โ Admin |
๐ Public Appointments โ /api/public-appointments
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/public-appointments/doctors |
Get available doctors | โ |
GET |
/api/public-appointments/slots |
Get available slots | โ |
POST |
/api/public-appointments |
Book public appointment | โ |
๐ค Patients โ /api/patients
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/patients |
Get all patients | โ |
POST |
/api/patients |
Create patient | โ |
PUT |
/api/patients/:id |
Update patient | โ |
๐ฐ Billing โ /api/bills
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/bills |
Get all bills | โ |
POST |
/api/bills |
Create bill | โ |
PUT |
/api/bills/:id |
Update bill | โ |
๐ข Departments โ /api/departments
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/departments |
Get all departments | โ |
POST |
/api/departments |
Create department | โ Admin |
PUT |
/api/departments/:id |
Update department | โ Admin |
DELETE |
/api/departments/:id |
Delete department | โ Admin |
๐ง More Endpoints
| Base Route | Description |
|---|---|
/api/services |
Hospital services management |
/api/profile |
User profile operations |
/api/slot-config |
Appointment slot configuration |
/api/invoice-template |
Invoice template management |
/api/dashboard |
Dashboard analytics data |
/api/support |
Support ticket management |
/api/announcements |
Announcement management (CMS) |
/api/site-updates |
Site update management (CMS) |
| Feature | Implementation | Status |
|---|---|---|
| ๐ Password Hashing | bcrypt with salt rounds (10) | โ Active |
| ๐ซ Token Authentication | JWT (JSON Web Tokens) | โ Active |
| ๐ก๏ธ HTTP Security Headers | Helmet.js | โ Active |
| ๐ CORS Protection | Configurable origin whitelist | โ Active |
| ๐ฎ Role-Based Access | Middleware-level RBAC | โ Active |
| ๐ค Bot Protection | Google reCAPTCHA v2 | โ Active |
| ๐ Request Logging | Morgan HTTP logger | โ Active |
| ๐ Environment Secrets | dotenv (never committed) | โ Active |
| ๐ค Secure File Upload | Multer with size/type limits | โ Active |
gantt
title HMS Development Roadmap
dateFormat YYYY-MM
axisFormat %b %Y
section โ
Completed
Core Authentication & RBAC :done, 2025-01, 2025-03
Admin Dashboard & Analytics :done, 2025-02, 2025-04
Appointment Management :done, 2025-03, 2025-05
Billing & Invoice System :done, 2025-04, 2025-06
Public Appointment Booking :done, 2025-05, 2025-07
AWS S3 & SES Integration :done, 2025-06, 2025-08
CMS (Announcements & Updates) :done, 2025-07, 2025-09
Slot Configuration System :done, 2025-08, 2025-10
section ๐ In Progress
Performance Optimization :active, 2026-01, 2026-03
Mobile Responsiveness Polish :active, 2026-02, 2026-04
section ๐ Planned
SMS Notifications (Twilio) : 2026-04, 2026-06
Payment Gateway Integration : 2026-05, 2026-07
Advanced Reporting & Analytics : 2026-06, 2026-08
Multi-language Support (i18n) : 2026-07, 2026-09
Prescription PDF Generation : 2026-08, 2026-10
Patient Mobile App (React Native) : 2026-09, 2026-12
We love contributions! This is an open-source project and every contribution counts โ whether it's fixing a bug, improving docs, or building a new feature. ๐
Step 1 โ Step 2 โ Step 3 โ Step 4 โ Step 5 โ Step 6 โ Step 7
Fork Clone Branch Code Commit Push PR + Form
1๏ธโฃ Fork the Repository
Click the Fork button at the top-right of this repo to create your own copy.
2๏ธโฃ Clone Your Fork
git clone https://github.com/<your-username>/Hospital-Management-System.git
cd Hospital-Management-System3๏ธโฃ Create a Feature Branch
git checkout -b feature/your-feature-name
# Examples:
# git checkout -b feature/add-prescription-module
# git checkout -b fix/login-validation-error
# git checkout -b docs/update-api-docs4๏ธโฃ Make Your Changes
- Follow existing code style and conventions
- Write clean, commented code
- Test your changes locally
5๏ธโฃ Commit Your Changes
git add .
git commit -m "feat: add prescription generation module"Use Conventional Commits format:
feat:โ New featurefix:โ Bug fixdocs:โ Documentation changesstyle:โ Code formatting (no logic change)refactor:โ Code restructuringtest:โ Adding/updating tests
6๏ธโฃ Push to Your Fork
git push origin feature/your-feature-name7๏ธโฃ Open a Pull Request & Submit Contribution Form
- Go to the original repository and click "New Pull Request"
- Provide a clear title and description of your changes
- Link any related issues using
Fixes #issue-number
๐ Final Step: After opening your PR, please fill out the contribution form by clicking the "Contribute Now" button on the HMS Contribution Page. This helps us track and acknowledge your contribution!
Found a bug? Help us improve by reporting it!
- ๐ Search Existing Issues โ Check if the issue has already been reported in Issues
- ๐ Create a New Issue โ Click New Issue
- ๐ Fill in the Details:
- Title: Short, descriptive title (e.g., "Login fails with phone number on mobile")
- Description: Clear explanation of the issue
- Steps to Reproduce: Numbered steps to recreate the problem
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Screenshots: Attach screenshots if applicable
- Environment: Browser, OS, Node.js version, etc.
- ๐ท๏ธ Add Labels โ Use appropriate labels like
bug,enhancement,documentation, etc. - ๐ค Submit โ Click "Submit new issue"
๐ก Tip: The more details you provide, the faster we can fix it!
To keep the codebase clean and maintainable, please follow these PR guidelines:
| โ Do | โ Don't |
|---|---|
|
|
Submit PR โ Auto Checks โ Code Review โ Changes Requested? โ Approved โ Merged! ๐
โ
Make Changes
โ
Push Updates โ Re-Review โ Merged! ๐
If you find this project helpful or learned something from it, please consider:
โญ Star this repository โ It helps others discover this project!
๐ด Fork it โ And build something amazing!
๐ฃ Share it โ Spread the word on social media!
๐ Report bugs โ Help us make it better!
๐ก Suggest features โ We'd love to hear your ideas!
This project is licensed under the MIT License โ you are free to use, modify, and distribute this project.
MIT License
Copyright (c) 2026 Saurabh Kumar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.