A comprehensive Hospital Management System built with Django REST Framework (Backend) and React + Vite (Frontend). This system enables patients to book appointments with doctors and allows doctors to manage their availability and appointments.
- User registration and authentication
- Browse available doctors by specialization
- View doctor profiles and availability slots
- Book appointments with doctors
- View appointment history
- Dedicated doctor registration
- Create and manage professional profile
- Set availability slots (date, time, status)
- View and manage appointments
- Update profile information
- Role-based authentication (Patient/Doctor)
- Secure session-based authentication
- Responsive UI with modern design
- RESTful API architecture
- PostgreSQL database
- Django 6.0 - Web framework
- Django REST Framework - API development
- PostgreSQL - Database
- CORS Headers - Cross-origin resource sharing
- React 19.2 - UI library
- Vite 7.2 - Build tool
- React Router DOM 7.11 - Routing
- Axios 1.13 - HTTP client
- Bootstrap 5.3 - CSS framework
- Python 3.10+
- Node.js 20.19+ or 22.12+
- PostgreSQL 12+
- npm or yarn
- Navigate to backend directory
cd HMS-Backend- Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install django djangorestframework psycopg2-binary django-cors-headers- Configure PostgreSQL
Create a database named hms_db:
CREATE DATABASE hms_db;Update hms_backend/settings.py with your PostgreSQL credentials:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "hms_db",
"USER": "your_postgres_user",
"PASSWORD": "your_postgres_password",
"HOST": "127.0.0.1",
"PORT": "5432",
}
}- Run migrations
python manage.py makemigrations
python manage.py migrate- Create superuser (optional)
python manage.py createsuperuser- Run development server
python manage.py runserverBackend will be available at http://127.0.0.1:8000
- Navigate to frontend directory
cd HMS-Frontend/react-app- Install dependencies
npm install- Run development server
npm run devFrontend will be available at http://localhost:5173
HMS/
โโโ HMS-Backend/
โ โโโ accounts/ # User authentication & authorization
โ โโโ doctors/ # Doctor profiles & availability
โ โโโ patients/ # Patient management
โ โโโ appointments/ # Appointment booking system
โ โโโ hms_backend/ # Project settings
โ โโโ manage.py
โ
โโโ HMS-Frontend/
โโโ react-app/
โโโ src/
โ โโโ components/
โ โ โโโ header/
โ โ โโโ footer/
โ โ โโโ main/
โ โ โโโ login/
โ โ โโโ register/
โ โ โโโ doctor/
โ โ โโโ patient-dashboard/
โ โ โโโ about/
โ โ โโโ services/
โ โโโ App.jsx
โ โโโ AuthContext.jsx
โ โโโ main.jsx
โโโ package.json
POST /api/accounts/register/- User registrationPOST /api/accounts/login/- User login
GET /api/doctors/doctors/- List all doctorsGET /api/doctors/doctor/profile/- Get doctor profile (authenticated)GET /api/doctors/profile-status/- Check if user has doctor profileGET /api/doctors/doctor/availability/- Get doctor availabilityPOST /api/doctors/doctor/availability/- Create availability slotGET /api/doctors/doctor/<id>/slots/- Get available slots for a doctor
- Session-based authentication for simplicity and security
- Role-based access control using
is_staffflag - Separate apps for modularity (accounts, doctors, patients, appointments)
- PostgreSQL for robust relational data management
- Context API for global authentication state
- React Router for client-side routing
- Bootstrap for rapid UI development with custom CSS overlays
- Axios for API communication
- Conditional rendering for role-based UI
- Register as a patient
- Login to access patient dashboard
- Browse available doctors
- View doctor availability slots
- Book appointments
- Register as a doctor
- Complete doctor profile (specialization, fees, etc.)
- Set availability slots
- View and manage appointments
- Update profile as needed
- CSRF protection enabled
- CORS configured for localhost development
- Password validation on registration
- Session-based authentication
- Protected routes requiring authentication
Create a .env file for production deployment:
# Backend
SECRET_KEY=your-secret-key
DEBUG=False
DATABASE_URL=postgres://user:password@host:port/dbname
ALLOWED_HOSTS=your-domain.com
# Frontend
VITE_API_URL=https://api.your-domain.compython manage.py runserver # Start development server
python manage.py makemigrations # Create migrations
python manage.py migrate # Apply migrations
python manage.py createsuperuser # Create admin user
python manage.py test # Run testsnpm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint- Doctor profile creation redirect needs backend integration
- Appointment booking functionality is frontend-only (backend pending)
- File upload for doctor images requires media file configuration
- Complete appointment booking backend
- Email notifications for appointments
- Payment integration for consultation fees
- Patient medical history
- Doctor ratings and reviews
- Search and filter functionality
- Admin dashboard
- PDF prescription generation
- Video consultation feature
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Developed by a passionate team of developers, designers, and healthcare enthusiasts.
For support, email info@hmshospitals.com or join our Slack channel.
Note: This is a development version. For production deployment, ensure proper security configurations, environment variables, and hosting setup.