How tanjim079/medicalsystembackend works
This is a RUET medical backend: an Express API for authentication and clinical and administrative workflows, backed by Supabase. Requests enter through the app and route registry, then domain routes dispatch to handlers that read or update records. Authentication middleware verifies requests through the auth service; patient-record authorization supports access checks in clinical handlers. The tree and source index document additional billing, directory, laboratory, prescription, certificate, medicine, and user routes, though several implementations were not excerpted. Edges reflect shown imports, calls, or documented route wiring; unsampled behavior is not inferred.
Main entry points: supabase.js Supabase clients · index.js Route registry · patientController.js Patient records · appointmentController.js Appointments
Components 22
API and routing
- Express app
src/app.js - Route registry
src/routes/index.js - Auth endpoints
src/routes/authRoutes.js - Patient endpoints
src/routes/patientRoutes.js - Appointment endpoints
src/routes/appointmentRoutes.js
Identity and access
- Auth handlers
src/controllers/authController.js - Request authentication
src/middleware/authMiddleware.js - Token and roles
src/services/authService.js
Clinical workflows
- Patient records
src/controllers/patientController.js - Appointments
src/controllers/appointmentController.js - Record authorization
src/services/recordAuthorization.js - Prescriptions
src/controllers/prescriptionController.js - Laboratory
src/controllers/laboratoryController.js - Certificates
src/controllers/certificateController.js
Operations
- Medicines
src/controllers/medicineController.js - Billing endpoints
src/routes/billingRoutes.js - Directory
src/controllers/directoryController.js - User administration
src/controllers/userController.js
Runtime and data
- Supabase clients
src/config/supabase.js - Supabase platform
- Environment config
src/config/env.js
Other components
- API client
Connections 25
- API client → Express app: sends requests
src/app.js - Express app → Route registry: mounts API
src/app.js - Route registry → Auth endpoints: mounts routes
src/routes/index.js - Route registry → Patient endpoints: mounts routes
src/routes/index.js - Route registry → Appointment endpoints: mounts routes
src/routes/index.js - Auth endpoints → Auth handlers: dispatches to
src/routes/authRoutes.js - Patient endpoints → Patient records: dispatches to
src/routes/patientRoutes.js - Appointment endpoints → Appointments: dispatches to
src/routes/appointmentRoutes.js - Auth handlers → Supabase clients: uses auth
src/controllers/authController.js - Request authentication → Token and roles: verifies identity
src/middleware/authMiddleware.js - Token and roles → Supabase clients: checks tokens and roles
src/services/authService.js - Patient records → Record authorization: checks record access
src/controllers/patientController.js - Appointments → Record authorization: resolves patient IDs
src/controllers/appointmentController.js - Patient records → Supabase clients: queries records
src/controllers/patientController.js - Appointments → Supabase clients: reads and writes
src/controllers/appointmentController.js - Record authorization → Supabase clients: resolves identifiers
src/services/recordAuthorization.js - Prescriptions → Supabase clients: uses database
src/controllers/prescriptionController.js - Laboratory → Supabase clients: uses database
src/controllers/laboratoryController.js - Certificates → Supabase clients: uses database
src/controllers/certificateController.js - Medicines → Supabase clients: uses database
src/controllers/medicineController.js - Directory → Supabase clients: uses database
src/controllers/directoryController.js - User administration → Supabase clients: uses database
src/controllers/userController.js - Supabase clients → Supabase platform: connects clients
src/config/supabase.js - Supabase clients → Environment config: reads settings
src/config/supabase.js - Billing endpoints → Supabase clients: uses database
src/routes/billingRoutes.js