How medsync1990/medsync works
MedSync is a role-based, multi-branch clinic management system. Its main workflow runs from patient registration and appointment booking through consultation and treatment recording to invoicing, payment, and insurance handling; reporting provides an additional operational and financial view. The React app calls a FastAPI API backed by shared PostgreSQL. The graph preserves the documented domain areas and core frontend pages; unsampled modules are represented at their exact file paths, but their internal calls are not inferred.
Main entry points: main.py FastAPI application · client.ts API client · db.py Connection and RLS context · appointments.py Appointments
Components 22
Web application
- Role-based web app
frontend/src/app/App.tsx - Role routes
frontend/src/app/routes.tsx - Session context
frontend/src/context/AuthContext.tsx - API client
frontend/src/api/client.ts - Patient registration
frontend/src/pages/receptionist/RegisterPatient.tsx - Appointment booking
frontend/src/pages/receptionist/BookAppointment.tsx - Consultation workflow
frontend/src/pages/doctor/Consultation.tsx - Invoice and payment UI
frontend/src/pages/receptionist/CollectPayment.tsx - Reports UI
frontend/src/pages/reports/DoctorRevenue.tsx
API and access control
- FastAPI application
backend/app/main.py - Authentication
backend/app/routers/auth.py - Identity and branch access
backend/app/dependencies.py - Connection and RLS context
backend/app/db.py
Clinic operations
- Patients and allergies
backend/app/routers/patients.py - Appointments
backend/app/routers/appointments.py - Consultations and treatments
backend/app/routers/consultations.py - Branches and staff
backend/app/routers/branches.py
Billing and insights
- Invoices and payments
backend/app/routers/invoices.py - Insurance
backend/app/routers/insurance.py - Reporting and statistics
backend/app/routers/reports.py
Other components
- Clinic staff
- Shared PostgreSQL
Connections 30
- Clinic staff → Role-based web app: uses
README.md - Role-based web app → Role routes: renders
frontend/src/app/App.tsx - Role routes → Session context: checks roles
frontend/src/app/routes.tsx - Role-based web app → Session context: provides session
frontend/src/app/App.tsx - Patient registration → API client: sends requests
- Appointment booking → API client: sends requests
frontend/src/pages/receptionist/BookAppointment.tsx - Consultation workflow → API client: calls API
- Invoice and payment UI → API client: calls API
- Reports UI → API client: calls API
- API client → FastAPI application: HTTP requests
frontend/src/api/client.ts - FastAPI application → Authentication: mounts routes
backend/app/main.py - FastAPI application → Patients and allergies: mounts routes
backend/app/main.py - FastAPI application → Appointments: mounts routes
backend/app/main.py - FastAPI application → Consultations and treatments: mounts routes
backend/app/main.py - FastAPI application → Branches and staff: mounts routes
backend/app/main.py - FastAPI application → Invoices and payments: mounts routes
backend/app/main.py - FastAPI application → Insurance: mounts routes
backend/app/main.py - FastAPI application → Reporting and statistics: mounts routes
backend/app/main.py - Authentication → Identity and branch access: uses identity
backend/app/routers/auth.py - Identity and branch access → Connection and RLS context: gets connections
backend/app/dependencies.py - Patients and allergies → Connection and RLS context: queries data
backend/app/routers/patients.py - Appointments → Connection and RLS context: gets connections
backend/app/routers/appointments.py - Reporting and statistics → Connection and RLS context: gets connections
backend/app/routers/reports.py - FastAPI application → Shared PostgreSQL: opens pools
backend/app/main.py - Connection and RLS context → Shared PostgreSQL: acquires connections
backend/app/db.py - Patients and allergies → Appointments: supports booking flow
- Appointments → Consultations and treatments: precedes care
README.md - Consultations and treatments → Invoices and payments: feeds billing
README.md - Invoices and payments → Insurance: handles claims
README.md - Reporting and statistics → Shared PostgreSQL: queries metrics
README.md