How duchai1703/bookingcare-backend works
BookingCare is a medical-appointment backend. Its central patient journey is to find a doctor and an available schedule, book an appointment, and complete payment; after the visit, the doctor manages the encounter and the patient can leave a review. The tree also shows clinic and specialty administration, doctor onboarding and financial operations, policy management, and AI assistance. Sampled controller/service code confirms parts of booking, encounter, review, payment, policy, and AI behavior; other subsystem links are limited to their named modules because their implementation was not sampled.
Main entry points: web.js API routes · index.js Application database · authService.js Authentication · paymentController.js Payment processing
Components 28
API entry
- HTTP server
src/server.js - API routes
src/routes/web.js - Authentication
src/services/authService.js - User endpoints
src/controllers/userController.js
Care booking
- Catalog endpoints
src/controllers/catalogController.js - Catalog search
src/services/catalogService.js - Patient endpoints
src/controllers/patientController.js - Patient bookings
src/services/patientService.js - Doctor endpoints
src/controllers/doctorController.js - Doctor workflow
src/services/doctorService.js - Review endpoints
src/controllers/reviewController.js - Review service
src/services/reviewService.js
Clinic operations
- Clinic management
src/services/clinicManageService.js - Specialty management
src/services/specialtyManageService.js - Doctor onboarding
src/services/doctorOnboardingService.js - Statistics
src/services/statisticService.js
Payments and policy
- Payment processing
src/controllers/paymentController.js - Policy endpoints
src/controllers/policyController.js - Policy engine
src/services/policyEngineService.js
AI assistance
- AI streaming
src/controllers/aiController.js - AI function handlers
src/services/aiFunctionHandlers.js
Other components
- Patient
- Doctor
- Administrator
- Application database
src/models/index.js - VNPay
- Gemini API
- Email service
src/services/emailService.js
Connections 34
- HTTP server → API routes: mounts routes
- Patient → API routes: sends requests
- Doctor → API routes: sends requests
- Administrator → API routes: sends requests
- API routes → Catalog endpoints: dispatches
- API routes → Patient endpoints: dispatches
- API routes → Doctor endpoints: dispatches
- API routes → Review endpoints: dispatches
- API routes → Payment processing: dispatches
- API routes → Policy endpoints: dispatches
- API routes → AI streaming: dispatches
- API routes → User endpoints: dispatches
- User endpoints → Authentication: calls
- Authentication → Application database: reads and writes
- Authentication → Email service: sends messages
- Catalog endpoints → Catalog search: calls
- Catalog search → Application database: queries
- Patient endpoints → Patient bookings: calls
- Patient bookings → Application database: reads and writes
- Doctor endpoints → Doctor workflow: calls
- Doctor workflow → Application database: reads and writes
- Review endpoints → Review service: calls
- Review service → Application database: validates and stores
- Payment processing → Application database: reads and updates
- Payment processing → VNPay: creates and verifies payments
- Policy endpoints → Policy engine: calls
- Policy engine → Application database: resolves and stores policies
- Clinic management → Application database: manages clinic data
- Specialty management → Application database: manages specialty data
- Doctor onboarding → Application database: stores requests
- Statistics → Application database: queries metrics
- AI streaming → AI function handlers: dispatches functions
- AI streaming → Gemini API: streams model requests
- AI function handlers → Application database: queries booking data