How sitabja-web/hospital-management-system-v1 works
HMS is a role-based hospital operations application: users sign in or register, then manage patients, doctors and departments, appointments, clinical records and prescriptions, billing, and administrative oversight. The React client presents those workflows through role-aware pages and forms; its API library communicates with an Express API, whose routes and authorization middleware dispatch to controllers and PostgreSQL-backed models. The README documents the broader product capabilities; sampled source confirms representative frontend routing, authentication, API setup, and backend controller/model responsibilities, but not every domain route or controller call.
Main entry points: index.js API routes · App.tsx App shell · models PostgreSQL domain models · api.ts API client
Components 26
React client
- App shell
client/src/App.tsx - Login and signup
client/src/pages/Login.tsx - Session context
client/src/contexts/AuthContext.tsx - API client
client/src/lib/api.ts - Dashboard
client/src/pages/Dashboard.tsx - Patient management
client/src/pages/Patients.tsx - Doctors and availability
client/src/pages/Doctors.tsx - Appointment scheduling
client/src/pages/Appointments.tsx - Records and prescriptions
client/src/pages/MedicalRecords.tsx - Billing
client/src/pages/Billing.tsx - Settings and oversight
client/src/pages/Settings.tsx
API and access
- API routes
server/src/routes/index.js - JWT and role checks
server/src/middleware/auth.js - Authentication workflow
server/src/controllers/authController.js - Express application
server/src/app.js
Clinical operations
- Patient workflows
server/src/controllers/patientController.js - Appointment workflows
server/src/controllers/appointmentController.js - Clinical record workflows
server/src/controllers/medicalRecordController.js - Doctors and departments
server/src/controllers/doctorController.js - Invoice workflows
server/src/controllers/billingController.js
Administration and data
- Staff and administration
server/src/controllers/adminController.js - Dashboard and system
server/src/controllers/systemController.js - PostgreSQL domain models
server/src/models - Audit log model
server/src/models/auditModel.js - PostgreSQL
server/src/db/client.js
Other components
- Hospital users
Connections 41
- Hospital users → Login and signup: sign in or register
README.md - App shell → Session context: provides session
client/src/App.tsx - App shell → Login and signup: shows when signed out
client/src/App.tsx - App shell → Dashboard: routes by role
client/src/App.tsx - App shell → Patient management: routes by role
client/src/App.tsx - App shell → Doctors and availability: routes by role
client/src/App.tsx - App shell → Appointment scheduling: routes by role
client/src/App.tsx - App shell → Records and prescriptions: routes by role
client/src/App.tsx - App shell → Billing: routes by role
client/src/App.tsx - App shell → Settings and oversight: routes by role
client/src/App.tsx - Login and signup → Session context: submits credentials
client/src/pages/Login.tsx - Session context → API client: calls authentication API
client/src/contexts/AuthContext.tsx - Patient management → API client: requests patient data
- Doctors and availability → API client: requests doctor data
- Appointment scheduling → API client: requests appointments
- Records and prescriptions → API client: requests records
- Billing → API client: requests invoices
- Settings and oversight → API client: requests admin data
client/src/pages/Settings.tsx - API client → Express application: sends API requests
README.md - Express application → API routes: mounts API routes
server/src/app.js - API routes → JWT and role checks: applies authorization
- API routes → Authentication workflow: dispatches auth requests
- API routes → Patient workflows: dispatches patient requests
- API routes → Appointment workflows: dispatches appointments
- API routes → Clinical record workflows: dispatches record requests
- API routes → Doctors and departments: dispatches directory requests
- API routes → Invoice workflows: dispatches billing requests
- API routes → Staff and administration: dispatches admin requests
- API routes → Dashboard and system: dispatches system requests
- Authentication workflow → PostgreSQL domain models: reads and updates accounts
server/src/controllers/authController.js - Authentication workflow → Audit log model: records auth events
server/src/controllers/authController.js - Patient workflows → PostgreSQL domain models: coordinates patient data
server/src/controllers/patientController.js - Appointment workflows → PostgreSQL domain models: coordinates appointments
server/src/controllers/appointmentController.js - Clinical record workflows → PostgreSQL domain models: coordinates clinical records
- Doctors and departments → PostgreSQL domain models: coordinates directory data
- Invoice workflows → PostgreSQL domain models: coordinates invoices
server/src/controllers/billingController.js - Staff and administration → PostgreSQL domain models: manages staff and departments
server/src/controllers/adminController.js - Staff and administration → Audit log model: records admin actions
server/src/controllers/adminController.js - Dashboard and system → PostgreSQL domain models: reads system summaries
- PostgreSQL domain models → PostgreSQL: queries PostgreSQL
README.md - Audit log model → PostgreSQL: writes and reads logs
server/src/models/auditModel.js