# asitshastri/vinicure architecture

> Architecture diagram of the GitHub repository asitshastri/vinicure, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/asitshastri/vinicure
- Repository: https://github.com/asitshastri/vinicure

## Overview

ViniCure is an Indian telemedicine platform. Patients discover doctors, book and pay for appointments, then join video consultations; doctors manage schedules and patients and issue prescriptions, while administrators and support staff operate the service. The Next.js app serves the role-specific website and API, with business modules handling identity, scheduling, payments, consultations, and patient data. A PostgreSQL-backed worker handles asynchronous jobs such as invoices, scans, and reminders. The map emphasizes documented product stages; some subsystem links are based on README descriptions because their implementation was not sampled.

Main entry points: [`src/lib/api/with-api.ts`](https://github.com/asitshastri/vinicure/blob/main/src/lib/api/with-api.ts) (API boundary), [`src/app`](https://github.com/asitshastri/vinicure/tree/main/src/app) (Role-based website), [`src/worker/handlers.ts`](https://github.com/asitshastri/vinicure/blob/main/src/worker/handlers.ts) (Background jobs), [`src/modules/scheduling`](https://github.com/asitshastri/vinicure/tree/main/src/modules/scheduling) (Scheduling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_web["Role-based website"]
  node_booking["Booking experience"]
  node_directory["Doctor directory"]
  node_doctorportal["Doctor portal"]
  node_patientportal["Patient portal"]
  node_adminportal["Admin portal"]
  node_supportportal["Support portal"]
end

subgraph group_care["Care workflow"]
  node_scheduling["Scheduling"]
  node_payments["Payments and payouts"]
  node_consultations["Video consultations"]
  node_prescriptions["Prescription console"]
  node_patients["Patient health data"]
  node_directoryservice["Doctor applications<br/>[service.ts]"]
end

subgraph group_operations["Operations"]
  node_compliance["Privacy requests"]
end

subgraph group_platform["Platform services"]
  node_api["API boundary<br/>[with-api.ts]"]
  node_identity["Identity and access"]
  node_storage["Secure file storage<br/>[storage.ts]"]
  node_queue["Job queue<br/>[queue.ts]"]
  node_worker["Background jobs<br/>[handlers.ts]"]
  node_postgres[("PostgreSQL<br/>[pool.ts]")]
end

node_patient(("Patient"))
node_doctor(("Doctor"))
node_staff(("Admin / support"))
node_paymentprovider["Payment provider"]
node_videoprovider["Video provider"]

node_patient -->|"uses"| node_web
node_doctor -->|"uses"| node_web
node_staff -->|"uses"| node_web
node_web -->|"offers discovery"| node_directory
node_web -->|"starts booking"| node_booking
node_web -->|"serves"| node_doctorportal
node_web -->|"serves"| node_patientportal
node_web -->|"serves"| node_adminportal
node_web -->|"serves"| node_supportportal
node_booking -.->|"requests"| node_api
node_directory -.->|"requests"| node_api
node_doctorportal -.->|"requests"| node_api
node_patientportal -.->|"requests"| node_api
node_adminportal -.->|"requests"| node_api
node_supportportal -.->|"requests"| node_api
node_api -->|"checks access"| node_identity
node_api -->|"routes appointments"| node_scheduling
node_api -->|"routes webhook"| node_payments
node_api -->|"routes patient data"| node_patients
node_api -->|"routes requests"| node_compliance
node_api -->|"routes favorites"| node_directoryservice
node_booking -.->|"selects appointment"| node_scheduling
node_booking -.->|"pays appointment"| node_payments
node_payments -.->|"verifies charges"| node_paymentprovider
node_scheduling -.->|"enables visit"| node_consultations
node_consultations -.->|"connects video"| node_videoprovider
node_consultations -.->|"supports prescribing"| node_prescriptions
node_doctorportal -.->|"uses console"| node_prescriptions
node_patientportal -.->|"manages health data"| node_patients
node_directoryservice -->|"stores documents"| node_storage
node_directoryservice -.->|"queues work"| node_queue
node_payments -.->|"persists payments"| node_postgres
node_scheduling -.->|"persists appointments"| node_postgres
node_patients -.->|"persists records"| node_postgres
node_queue -->|"dispatches jobs"| node_worker
node_worker -->|"runs job queries"| node_postgres
node_worker -->|"renders invoices"| node_payments
node_worker -->|"releases holds"| node_scheduling
node_worker -->|"processes recordings"| node_consultations

click node_web "https://github.com/asitshastri/vinicure/tree/main/src/app"
click node_booking "https://github.com/asitshastri/vinicure/tree/main/src/components/booking"
click node_directory "https://github.com/asitshastri/vinicure/tree/main/src/components/doctors"
click node_doctorportal "https://github.com/asitshastri/vinicure/tree/main/src/app/(doctor)/doctor"
click node_patientportal "https://github.com/asitshastri/vinicure/tree/main/src/app/(patient)/patient"
click node_adminportal "https://github.com/asitshastri/vinicure/tree/main/src/app/(admin)/admin"
click node_supportportal "https://github.com/asitshastri/vinicure/tree/main/src/app/(support)/staff"
click node_api "https://github.com/asitshastri/vinicure/blob/main/src/lib/api/with-api.ts"
click node_identity "https://github.com/asitshastri/vinicure/tree/main/src/modules/identity"
click node_scheduling "https://github.com/asitshastri/vinicure/tree/main/src/modules/scheduling"
click node_payments "https://github.com/asitshastri/vinicure/tree/main/src/modules/payments"
click node_consultations "https://github.com/asitshastri/vinicure/tree/main/src/modules/consultations"
click node_prescriptions "https://github.com/asitshastri/vinicure/tree/main/src/components/console"
click node_patients "https://github.com/asitshastri/vinicure/tree/main/src/modules/patients"
click node_compliance "https://github.com/asitshastri/vinicure/tree/main/src/modules/compliance"
click node_directoryservice "https://github.com/asitshastri/vinicure/blob/main/src/modules/directory/service.ts"
click node_storage "https://github.com/asitshastri/vinicure/blob/main/src/lib/storage/storage.ts"
click node_queue "https://github.com/asitshastri/vinicure/blob/main/src/lib/queue/queue.ts"
click node_worker "https://github.com/asitshastri/vinicure/blob/main/src/worker/handlers.ts"
click node_postgres "https://github.com/asitshastri/vinicure/blob/main/src/lib/db/pool.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_booking,node_directory,node_doctorportal,node_patientportal,node_adminportal,node_supportportal toneBlue
class node_scheduling,node_payments,node_consultations,node_prescriptions,node_patients,node_directoryservice toneAmber
class node_compliance toneMint
class node_api,node_identity,node_storage,node_queue,node_worker,node_postgres toneRose
class node_patient,node_doctor,node_staff,node_paymentprovider,node_videoprovider toneIndigo
```

## Components

### Web experience

- [Role-based website](https://github.com/asitshastri/vinicure/tree/main/src/app): `src/app`
- [Booking experience](https://github.com/asitshastri/vinicure/tree/main/src/components/booking): `src/components/booking`
- [Doctor directory](https://github.com/asitshastri/vinicure/tree/main/src/components/doctors): `src/components/doctors`
- [Doctor portal](https://github.com/asitshastri/vinicure/tree/main/src/app/(doctor)/doctor): `src/app/(doctor)/doctor`
- [Patient portal](https://github.com/asitshastri/vinicure/tree/main/src/app/(patient)/patient): `src/app/(patient)/patient`
- [Admin portal](https://github.com/asitshastri/vinicure/tree/main/src/app/(admin)/admin): `src/app/(admin)/admin`
- [Support portal](https://github.com/asitshastri/vinicure/tree/main/src/app/(support)/staff): `src/app/(support)/staff`

### Care workflow

- [Scheduling](https://github.com/asitshastri/vinicure/tree/main/src/modules/scheduling): `src/modules/scheduling`
- [Payments and payouts](https://github.com/asitshastri/vinicure/tree/main/src/modules/payments): `src/modules/payments`
- [Video consultations](https://github.com/asitshastri/vinicure/tree/main/src/modules/consultations): `src/modules/consultations`
- [Prescription console](https://github.com/asitshastri/vinicure/tree/main/src/components/console): `src/components/console`
- [Patient health data](https://github.com/asitshastri/vinicure/tree/main/src/modules/patients): `src/modules/patients`
- [Doctor applications](https://github.com/asitshastri/vinicure/blob/main/src/modules/directory/service.ts): `src/modules/directory/service.ts`

### Operations

- [Privacy requests](https://github.com/asitshastri/vinicure/tree/main/src/modules/compliance): `src/modules/compliance`

### Platform services

- [API boundary](https://github.com/asitshastri/vinicure/blob/main/src/lib/api/with-api.ts): `src/lib/api/with-api.ts`
- [Identity and access](https://github.com/asitshastri/vinicure/tree/main/src/modules/identity): `src/modules/identity`
- [Secure file storage](https://github.com/asitshastri/vinicure/blob/main/src/lib/storage/storage.ts): `src/lib/storage/storage.ts`
- [Job queue](https://github.com/asitshastri/vinicure/blob/main/src/lib/queue/queue.ts): `src/lib/queue/queue.ts`
- [Background jobs](https://github.com/asitshastri/vinicure/blob/main/src/worker/handlers.ts): `src/worker/handlers.ts`
- [PostgreSQL](https://github.com/asitshastri/vinicure/blob/main/src/lib/db/pool.ts): `src/lib/db/pool.ts`

### Other components

- **Patient**
- **Doctor**
- **Admin / support**
- **Payment provider**
- **Video provider**

## Connections

- Patient → Role-based website: uses (evidence: `README.md`)
- Doctor → Role-based website: uses (evidence: `README.md`)
- Admin / support → Role-based website: uses (evidence: `README.md`)
- Role-based website → Doctor directory: offers discovery (evidence: `README.md`)
- Role-based website → Booking experience: starts booking (evidence: `README.md`)
- Role-based website → Doctor portal: serves (evidence: `README.md`)
- Role-based website → Patient portal: serves (evidence: `README.md`)
- Role-based website → Admin portal: serves (evidence: `README.md`)
- Role-based website → Support portal: serves (evidence: `README.md`)
- Booking experience → API boundary: requests
- Doctor directory → API boundary: requests
- Doctor portal → API boundary: requests
- Patient portal → API boundary: requests
- Admin portal → API boundary: requests
- Support portal → API boundary: requests
- API boundary → Identity and access: checks access (evidence: `src/lib/api/with-api.ts`)
- API boundary → Scheduling: routes appointments (evidence: `src/app/api/v1/appointments/route.ts`)
- API boundary → Payments and payouts: routes webhook (evidence: `src/app/api/webhooks/razorpay/route.ts`)
- API boundary → Patient health data: routes patient data (evidence: `src/app/api/v1/patients/route.ts`)
- API boundary → Privacy requests: routes requests (evidence: `src/app/api/v1/data-requests/route.ts`)
- API boundary → Doctor applications: routes favorites
- Booking experience → Scheduling: selects appointment
- Booking experience → Payments and payouts: pays appointment
- Payments and payouts → Payment provider: verifies charges
- Scheduling → Video consultations: enables visit
- Video consultations → Video provider: connects video
- Video consultations → Prescription console: supports prescribing (evidence: `README.md`)
- Doctor portal → Prescription console: uses console (evidence: `README.md`)
- Patient portal → Patient health data: manages health data (evidence: `README.md`)
- Doctor applications → Secure file storage: stores documents (evidence: `src/modules/directory/service.ts`)
- Doctor applications → Job queue: queues work (evidence: `src/modules/directory/service.ts`)
- Payments and payouts → PostgreSQL: persists payments
- Scheduling → PostgreSQL: persists appointments
- Patient health data → PostgreSQL: persists records
- Job queue → Background jobs: dispatches jobs (evidence: `worker/main.mts`)
- Background jobs → PostgreSQL: runs job queries (evidence: `src/worker/handlers.ts`)
- Background jobs → Payments and payouts: renders invoices (evidence: `src/worker/handlers.ts`)
- Background jobs → Scheduling: releases holds (evidence: `src/worker/handlers.ts`)
- Background jobs → Video consultations: processes recordings (evidence: `src/worker/handlers.ts`)
