A full-stack Hospital Management System (HMS) built with Flask, SQLite, Redis, Celery, Vue 3, Vite, Bootstrap, and Axios.
This application supports three roles:
AdminDoctorPatient
It provides role-based dashboards, appointment management, patient treatment history, doctor availability, Redis caching, and Celery background jobs in a clean and easy-to-follow architecture.
- JWT-based authentication for all roles
- Programmatic SQLite database creation
- Auto-created admin account
- Doctor management and patient search for admin users
- Doctor availability management for the next 7 days
- Appointment booking, rescheduling, and cancellation
- Diagnosis, prescription, and treatment history tracking
- Redis caching for doctor lists, departments, and admin dashboard statistics
- Celery background tasks for reminders, reports, and CSV export
- Vue 3 + Vite frontend with Bootstrap UI
- Flask
- Flask Blueprints
- Flask SQLAlchemy
- Flask JWT Extended
- SQLite
- Redis
- Celery
- Vue 3
- Vite
- Vue Router
- Bootstrap
- Axios
- View dashboard statistics
- Add, update, and delete doctor profiles
- Search doctors and patients
- Manage appointments
- Blacklist and unblacklist users
- View today and weekly appointments
- Add availability for the next 7 days
- Complete or cancel appointments
- Add diagnosis, prescription, and notes
- View patient history
- Register and log in
- View departments
- Search doctors
- Book, reschedule, and cancel appointments
- View treatment history
- Update personal profile
- Trigger CSV export of treatment records
backend/
├── app.py
├── config.py
├── extensions.py
├── models/
├── routes/
├── services/
├── tasks/
├── templates/
└── utils/
frontend/
├── index.html
├── package.json
├── vite.config.js
└── src/
├── components/
├── pages/
├── router/
├── services/
├── App.vue
└── main.js
- Jinja2 is used only to serve the initial HTML entry point
- Vue handles the full application UI
- SQLAlchemy models create the database programmatically
- Service files keep business logic separate from route files
- Role-based access is enforced using JWT and custom decorators
Redis caching is used for:
- doctor list
- department list
- admin dashboard statistics
The system includes cache expiry and cache invalidation after updates.
Celery + Redis are used for:
- Daily patient reminders
- Monthly doctor activity reports
- User-triggered CSV export of patient treatment history
These accounts are seeded automatically when the backend starts for the first time:
admin / admin123doctor1 / doctor123doctor2 / doctor123patient1 / patient123
git clone https://github.com/23f2001850/hospital-management-system-v2.git
cd hospital-management-system-v2python -m pip install -r requirements.txtcd frontend
npm install
cd ..Redis must be running on port 6379.
redis-server --port 6379docker run --name hms-redis -p 6379:6379 redis:7winget install Redis.Redisor
choco install redis -yOpen separate terminals for each service.
redis-server --port 6379cd "c:\Krishna_Jain\Hospital Management System"
New-Item -ItemType Directory -Force backend\runtime | Out-Null
$env:HMS_DATA_DIR = (Resolve-Path backend\runtime).Path
$env:HMS_EXPORT_DIR = (Resolve-Path backend\exports).Path
python -m backend.appBackend runs at:
http://localhost:5000
cd "c:\Krishna_Jain\Hospital Management System"
$env:HMS_DATA_DIR = (Resolve-Path backend\runtime).Path
$env:HMS_EXPORT_DIR = (Resolve-Path backend\exports).Path
python -m celery -A backend.tasks.celery_app.celery_app worker --loglevel=info --pool=solocd "c:\Krishna_Jain\Hospital Management System"
$env:HMS_DATA_DIR = (Resolve-Path backend\runtime).Path
$env:HMS_EXPORT_DIR = (Resolve-Path backend\exports).Path
python -m celery -A backend.tasks.celery_app.celery_app beat --loglevel=infocd "c:\Krishna_Jain\Hospital Management System\frontend"
npm run devFrontend runs at:
http://localhost:5173
- Base URL:
http://localhost:5000 - Frontend Axios client automatically sends the JWT token in the
Authorizationheader - The system uses proper role checks for admin, doctor, and patient routes
POST /api/auth/login
Content-Type: application/json{
"username": "admin",
"password": "admin123"
}POST /api/patient/appointments
Authorization: Bearer <token>
Content-Type: application/json{
"doctor_id": 1,
"appointment_date": "2026-04-08",
"appointment_time": "11:00",
"reason": "Follow-up consultation"
}- Only the next 7 days are allowed for doctor availability and patient booking
- Double booking is prevented for the same doctor, date, and time
- Only booked appointments can be completed, cancelled, or rescheduled
- Blacklisted users cannot access protected actions
- Landing page
- Login page
- Register page
- Admin dashboard
- Doctor dashboard
- Patient dashboard
- Patient profile page
- Appointment booking page
The project has been validated with:
- backend role-based API smoke tests
- appointment booking, rescheduling, and completion checks
- CSV export task execution
- Vite production build verification
GitHub Repository:
https://github.com/23f2001850/hospital-management-system-v2