How thisisbsl/hospital-management-system works
MediFlow is a role-based hospital management portal for patients, doctors, and administrators. Users authenticate and enter role-specific dashboards; the backend exposes appointment booking and management, doctor lookup, medical records, and dashboard statistics. A typical care workflow is appointment scheduling, doctor consultation and record creation, then access to medical history and role-specific summaries. The backend separates HTTP routes, controllers, database operations, and MongoDB models. Dashboard API wiring is not shown in the sampled frontend excerpts, so those links are omitted.
Main entry points: dbService.js Data operations · server.js API server · Auth.jsx Sign-in and registration · authMiddleware.js Token and role checks
Components 22
Portal UI
- Role-based app
frontend/src/App.jsx - Sign-in and registration
frontend/src/pages/Auth.jsx - Auth state
frontend/src/context/AuthContext.jsx - Role dashboards
frontend/src/pages
HTTP API
- API server
backend/server.js - Authentication routes
backend/routes/authRoutes.js - Appointment routes
backend/routes/appointmentRoutes.js - Medical record routes
backend/routes/recordRoutes.js - Statistics routes
backend/routes/statRoutes.js - Token and role checks
backend/middleware/authMiddleware.js
Care workflows
- Account handling
backend/controllers/authController.js - Appointment handling
backend/controllers/appointmentController.js - Clinical records
backend/controllers/recordController.js - Dashboard metrics
backend/controllers/statController.js
Persistence
- Data operations
backend/services/dbService.js - User model
backend/models/User.js - Appointment model
backend/models/Appointment.js - Medical record model
backend/models/MedicalRecord.js - MongoDB
Other components
- Patient
- Doctor
- Administrator
Connections 28
- Patient → Sign-in and registration: signs in
- Doctor → Sign-in and registration: signs in
- Administrator → Sign-in and registration: signs in
- Sign-in and registration → Auth state: calls login
- Auth state → Role-based app: provides identity
- Role-based app → Role dashboards: renders by role
- API server → Authentication routes: mounts routes
- API server → Appointment routes: mounts routes
- API server → Medical record routes: mounts routes
- API server → Statistics routes: mounts routes
- Authentication routes → Account handling: dispatches
- Authentication routes → Token and role checks: protects profile
- Appointment routes → Token and role checks: protects routes
- Appointment routes → Appointment handling: dispatches
- Medical record routes → Token and role checks: protects routes
- Medical record routes → Clinical records: dispatches
- Statistics routes → Token and role checks: protects routes
- Statistics routes → Dashboard metrics: dispatches
- Account handling → Data operations: queries users
- Appointment handling → Data operations: manages appointments
- Clinical records → Data operations: manages records
- Dashboard metrics → Data operations: loads metrics
- Data operations → User model: reads and writes
- Data operations → Appointment model: reads and writes
- Data operations → Medical record model: reads and writes
- User model → MongoDB: persists
- Appointment model → MongoDB: persists
- Medical record model → MongoDB: persists