How pmarques-med/saudinob_progweb works
This is a clinical patient-monitoring API: users authenticate, then patients and authorized doctors access patient profiles, measurements, CARAT evaluations, and alerts. Low CARAT scores can create doctor alerts; vital readings are available through the API and a live WebSocket stream. The graph separates HTTP routing, authorization/controllers, domain services, and SQLite persistence. Backend source excerpts support the shown request flow; unsampled modules are included where the source index establishes their role, with no guessed links to the unprovided frontend.
Main entry points: app.js Express app · database.js SQLite database · server.js HTTP and WS server · auth.js JWT middleware
Components 20
HTTP API
- Express app
backend/src/app.js - Auth routes
backend/src/routes/authRoutes.js - Patient routes
backend/src/routes/patientRoutes.js - Doctor routes
backend/src/routes/doctorRoutes.js - Alert routes
backend/src/routes/alertRoutes.js - Error handler
backend/src/middleware/errorHandler.js
Identity and Access
- Login controller
backend/src/controllers/authController.js - Login service
backend/src/services/authService.js - JWT middleware
backend/src/middleware/auth.js
Clinical Records
- Patient controller
backend/src/controllers/patientController.js - Patient records
backend/src/services/patientService.js - Doctor controller
backend/src/controllers/doctorController.js - Doctor records
backend/src/services/doctorService.js - Alert controller
backend/src/controllers/alertController.js - Alert service
backend/src/services/alertService.js
Persistence and Runtime
- HTTP and WS server
backend/src/server.js - Database initialization
backend/src/db/init.js - SQLite database
backend/src/db/database.js
Other components
- API user
- Vitals client
Connections 27
- API user → Express app: sends HTTP requests
backend/src/app.js - Express app → Auth routes: mounts auth
backend/src/app.js - Express app → Patient routes: mounts patients
backend/src/app.js - Express app → Doctor routes: mounts doctors
backend/src/app.js - Express app → Alert routes: mounts alerts
backend/src/app.js - Express app → Error handler: forwards errors
backend/src/app.js - Auth routes → Login controller: routes login
backend/src/routes/authRoutes.js - Patient routes → JWT middleware: requires authentication
backend/src/routes/patientRoutes.js - Patient routes → Patient controller: routes patient requests
backend/src/routes/patientRoutes.js - Doctor routes → JWT middleware: requires authentication
backend/src/routes/doctorRoutes.js - Doctor routes → Doctor controller: routes doctor requests
backend/src/routes/doctorRoutes.js - Alert routes → JWT middleware: requires authentication
backend/src/routes/alertRoutes.js - Alert routes → Alert controller: routes alert updates
backend/src/routes/alertRoutes.js - Login controller → Login service: checks credentials
backend/src/controllers/authController.js - Login service → SQLite database: reads user records
backend/src/services/authService.js - JWT middleware → API user: verifies bearer token
backend/src/middleware/auth.js - Patient controller → Patient records: checks access and requests data
backend/src/controllers/patientController.js - Patient records → SQLite database: reads and writes clinical data
backend/src/services/patientService.js - Doctor controller → Doctor records: requests doctor data
backend/src/controllers/doctorController.js - Doctor records → SQLite database: queries doctor records
backend/src/services/doctorService.js - Alert controller → Alert service: requests alert update
backend/src/controllers/alertController.js - Alert service → SQLite database: updates alert records
backend/src/services/alertService.js - HTTP and WS server → Express app: serves HTTP app
backend/src/server.js - HTTP and WS server → Database initialization: initializes database
backend/src/server.js - Database initialization → SQLite database: creates schema
backend/src/db/init.js - Vitals client → HTTP and WS server: opens vitals socket
backend/src/server.js - HTTP and WS server → Vitals client: streams simulated vitals
backend/src/server.js