How apollo-level2-web-dev/l2b7-project-ph-healthcare-backend works
PH Healthcare System is an Express REST backend for patient registration and healthcare workflows. Its request path is client → Express routing → feature handler/service → database or integration → JSON response. The README says authentication is the only working feature today and describes appointments, schedules, payments, and other capabilities as planned; the tree and sampled sources nevertheless contain modules for them, so those appear as code subsystems, not claims of production readiness. Source excerpts establish selected calls; unsampled modules are represented cautiously, with evidence limits reflected in the edges.
Main entry points: app.ts Express API · prisma.ts PostgreSQL Access · chat.service.ts Healthcare Chat · server.ts Server Startup
Components 25
API Platform
- Express API
src/app.ts - Server Startup
src/server.ts - Error Handling
src/app/middleware/globalErrorHandler.ts
Identity
- Authentication
src/app/module/auth/auth.service.ts - Auth Handlers
src/app/module/auth/auth.controller.ts - Auth Routes
src/app/module/auth/auth.route.ts - JWT Role Guard
src/app/middleware/checkAuth.ts
Care Workflows
- Appointments
src/app/module/appointment/appointment.service.ts - Appointment Handlers
src/app/module/appointment/appointment.controller.ts - Doctor Management
src/app/module/doctor/doctor.service.ts - Schedules
src/app/module/schedule/schedule.service.ts - Payments
src/app/module/payment/payment.service.ts - Prescriptions
src/app/module/prescription/prescription.service.ts - User Management
src/app/module/user/user.service.ts
Supporting Features
- Analytics
src/app/module/analytics/analytics.service.ts - Healthcare Chat
src/app/module/chat/chat.service.ts - Doctor Indexing
src/app/module/chat/chat.indexer.ts
Infrastructure
- PostgreSQL Access
src/app/lib/prisma.ts - Redis Cache
src/app/lib/redis.ts - bKash Payments
src/app/lib/bkash.ts - Email Service
src/app/lib/nodemailer.ts - Cloudinary Uploads
src/app/lib/cloudinary.ts - LLM Client
src/app/lib/llm.ts - Vector Store
src/app/lib/vectorStore.ts
Other components
- API Client
Connections 41
- API Client → Express API: sends requests
src/app.ts - Express API → Auth Routes: routes to
src/app.ts - Express API → Appointment Handlers: routes to
src/app.ts - Express API → Doctor Management: routes to
src/app.ts - Express API → Schedules: routes to
src/app.ts - Express API → Payments: routes to
src/app.ts - Express API → Prescriptions: routes to
src/app.ts - Express API → User Management: routes to
src/app.ts - Express API → Analytics: routes to
src/app.ts - Express API → Healthcare Chat: routes to
src/app.ts - Express API → Error Handling: handles errors
src/app.ts - Auth Routes → Auth Handlers: dispatches
src/app/module/auth/auth.route.ts - Auth Routes → JWT Role Guard: uses guard
src/app/module/auth/auth.route.ts - Auth Handlers → Authentication: calls
src/app/module/auth/auth.controller.ts - Authentication → PostgreSQL Access: reads and writes
src/app/module/auth/auth.service.ts - Authentication → Redis Cache: reads and writes
src/app/module/auth/auth.service.ts - Authentication → Email Service: sends mail
src/app/module/auth/auth.service.ts - JWT Role Guard → PostgreSQL Access: checks user
src/app/middleware/checkAuth.ts - Appointment Handlers → Appointments: calls
src/app/module/appointment/appointment.controller.ts - Appointments → PostgreSQL Access: reads and writes
src/app/module/appointment/appointment.service.ts - Appointments → bKash Payments: gets token
src/app/module/appointment/appointment.service.ts - Appointments → Email Service: sends mail
src/app/module/appointment/appointment.service.ts - Doctor Management → PostgreSQL Access: reads and writes
src/app/module/doctor/doctor.service.ts - Doctor Management → Cloudinary Uploads: uploads files
src/app/module/doctor/doctor.service.ts - Doctor Management → Doctor Indexing: updates embedding
src/app/module/doctor/doctor.service.ts - Schedules → PostgreSQL Access: reads and writes
src/app/module/schedule/schedule.service.ts - Payments → PostgreSQL Access: reads and writes
src/app/module/payment/payment.service.ts - Prescriptions → PostgreSQL Access: reads and writes
src/app/module/prescription/prescription.service.ts - Prescriptions → Cloudinary Uploads: uploads files
src/app/module/prescription/prescription.service.ts - User Management → PostgreSQL Access: reads and writes
src/app/module/user/user.service.ts - Analytics → PostgreSQL Access: queries
src/app/module/analytics/analytics.service.ts - Healthcare Chat → LLM Client: calls model
src/app/module/chat/chat.service.ts - Healthcare Chat → Vector Store: searches vectors
src/app/module/chat/chat.service.ts - Healthcare Chat → Redis Cache: uses cache
src/app/module/chat/chat.service.ts - Healthcare Chat → PostgreSQL Access: reads data
src/app/module/chat/chat.service.ts - Doctor Indexing → PostgreSQL Access: reads doctors
src/app/module/chat/chat.indexer.ts - Doctor Indexing → Vector Store: writes vectors
src/app/module/chat/chat.indexer.ts - Server Startup → Express API: starts listening
src/server.ts - Server Startup → PostgreSQL Access: connects
src/server.ts - Server Startup → Redis Cache: connects
src/server.ts - Server Startup → Doctor Indexing: reindexes doctors
src/server.ts