# brian-munene/mt_hims architecture

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

- Interactive diagram: https://gitdiagram.com/brian-munene/mt_hims
- Repository: https://github.com/brian-munene/mt_hims

## Overview

Avocent is a clinic-care management application with a Next.js dashboard and Django API. Staff authenticate, then work across patient records, bookings and clinical workflows, with laboratory, pharmacy and billing as distinct operational stages. The booking service excerpt specifically supports queue/status handling and consultation creation, then generates invoice lines from consultation, lab and prescription data. The tree also documents administration, compliance, telemedicine, notifications and audit capabilities. The README is empty; unsampled subsystems are shown as capabilities, without asserting internal call paths.

Main entry points: [`avocent-backend/booking/services.py`](https://github.com/brian-munene/mt_hims/blob/main/avocent-backend/booking/services.py) (Booking and queues), [`avocent-frontend/src/app/(dashboard)`](https://github.com/brian-munene/mt_hims/tree/main/avocent-frontend/src/app/(dashboard)) (Clinic dashboard), [`avocent-frontend/src/app/(auth)/login/page.tsx`](https://github.com/brian-munene/mt_hims/blob/main/avocent-frontend/src/app/(auth)/login/page.tsx) (Login flow), [`avocent-frontend/src/app/api/auth`](https://github.com/brian-munene/mt_hims/tree/main/avocent-frontend/src/app/api/auth) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_dashboard["Clinic dashboard"]
  node_auth_ui["Login flow<br/>[page.tsx]"]
  node_web_auth["Auth routes"]
  node_proxy["API proxy<br/>[route.ts]"]
end

subgraph group_identity["Identity and access"]
  node_identity_api["Users and roles"]
end

subgraph group_care["Care operations"]
  node_patients["Patient records"]
  node_booking["Booking and queues<br/>[services.py]"]
  node_encounters["Encounters"]
  node_clinical["Clinical records"]
  node_laboratory["Laboratory"]
  node_pharmacy["Pharmacy"]
  node_telemedicine["Telemedicine"]
end

subgraph group_operations["Clinic operations"]
  node_billing["Billing"]
  node_payments["Payments"]
  node_compliance["Compliance"]
  node_organization["Clinic administration"]
  node_notifications["Notifications"]
  node_audit["Audit trail"]
end

subgraph group_platform["Backend platform"]
  node_django_api["Django API<br/>[urls.py]"]
  node_data_store[("Application database")]
end

node_staff(("Clinic staff"))

node_staff -->|"signs in"| node_auth_ui
node_staff -->|"uses"| node_dashboard
node_auth_ui -->|"submits credentials"| node_web_auth
node_web_auth -->|"authenticates"| node_identity_api
node_dashboard -->|"requests data"| node_proxy
node_proxy -->|"forwards API calls"| node_django_api
node_booking -->|"reads and writes"| node_data_store
node_booking -->|"creates encounter"| node_encounters
node_booking -->|"reads lab items"| node_laboratory
node_booking -->|"reads prescription items"| node_pharmacy
node_booking -->|"creates invoice lines"| node_billing
node_patients -->|"reads and writes"| node_data_store
node_identity_api -->|"reads and writes"| node_data_store
node_telemedicine -->|"stores chat state"| node_data_store
node_audit -->|"records events"| node_data_store

click node_dashboard "https://github.com/brian-munene/mt_hims/tree/main/avocent-frontend/src/app/(dashboard)"
click node_auth_ui "https://github.com/brian-munene/mt_hims/blob/main/avocent-frontend/src/app/(auth)/login/page.tsx"
click node_web_auth "https://github.com/brian-munene/mt_hims/tree/main/avocent-frontend/src/app/api/auth"
click node_proxy "https://github.com/brian-munene/mt_hims/blob/main/avocent-frontend/src/app/api/proxy/%5B...path%5D/route.ts"
click node_django_api "https://github.com/brian-munene/mt_hims/blob/main/avocent-backend/avocent_backend/urls.py"
click node_identity_api "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/users"
click node_patients "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/patients"
click node_booking "https://github.com/brian-munene/mt_hims/blob/main/avocent-backend/booking/services.py"
click node_encounters "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/encounters"
click node_clinical "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/clinical"
click node_laboratory "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/laboratory"
click node_pharmacy "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/pharmacy"
click node_telemedicine "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/telemedicine"
click node_billing "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/billing"
click node_payments "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/payments"
click node_compliance "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/compliance"
click node_organization "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/organization"
click node_notifications "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/notifications"
click node_audit "https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/audit"

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_dashboard,node_auth_ui,node_web_auth,node_proxy toneBlue
class node_identity_api toneAmber
class node_patients,node_booking,node_encounters,node_clinical,node_laboratory,node_pharmacy,node_telemedicine toneMint
class node_billing,node_payments,node_compliance,node_organization,node_notifications,node_audit toneRose
class node_django_api,node_data_store,node_staff toneIndigo
```

## Components

### Web application

- [Clinic dashboard](https://github.com/brian-munene/mt_hims/tree/main/avocent-frontend/src/app/(dashboard)): `avocent-frontend/src/app/(dashboard)`
- [Login flow](https://github.com/brian-munene/mt_hims/blob/main/avocent-frontend/src/app/(auth)/login/page.tsx): `avocent-frontend/src/app/(auth)/login/page.tsx`
- [Auth routes](https://github.com/brian-munene/mt_hims/tree/main/avocent-frontend/src/app/api/auth): `avocent-frontend/src/app/api/auth`
- [API proxy](https://github.com/brian-munene/mt_hims/blob/main/avocent-frontend/src/app/api/proxy/%5B...path%5D/route.ts): `avocent-frontend/src/app/api/proxy/[...path]/route.ts`

### Identity and access

- [Users and roles](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/users): `avocent-backend/users`

### Care operations

- [Patient records](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/patients): `avocent-backend/patients`
- [Booking and queues](https://github.com/brian-munene/mt_hims/blob/main/avocent-backend/booking/services.py): `avocent-backend/booking/services.py`
- [Encounters](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/encounters): `avocent-backend/encounters`
- [Clinical records](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/clinical): `avocent-backend/clinical`
- [Laboratory](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/laboratory): `avocent-backend/laboratory`
- [Pharmacy](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/pharmacy): `avocent-backend/pharmacy`
- [Telemedicine](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/telemedicine): `avocent-backend/telemedicine`

### Clinic operations

- [Billing](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/billing): `avocent-backend/billing`
- [Payments](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/payments): `avocent-backend/payments`
- [Compliance](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/compliance): `avocent-backend/compliance`
- [Clinic administration](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/organization): `avocent-backend/organization`
- [Notifications](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/notifications): `avocent-backend/notifications`
- [Audit trail](https://github.com/brian-munene/mt_hims/tree/main/avocent-backend/audit): `avocent-backend/audit`

### Backend platform

- [Django API](https://github.com/brian-munene/mt_hims/blob/main/avocent-backend/avocent_backend/urls.py): `avocent-backend/avocent_backend/urls.py`
- **Application database**

### Other components

- **Clinic staff**

## Connections

- Clinic staff → Login flow: signs in
- Clinic staff → Clinic dashboard: uses
- Login flow → Auth routes: submits credentials
- Auth routes → Users and roles: authenticates
- Clinic dashboard → API proxy: requests data
- API proxy → Django API: forwards API calls
- Booking and queues → Application database: reads and writes
- Booking and queues → Encounters: creates encounter
- Booking and queues → Laboratory: reads lab items
- Booking and queues → Pharmacy: reads prescription items
- Booking and queues → Billing: creates invoice lines
- Patient records → Application database: reads and writes
- Users and roles → Application database: reads and writes
- Telemedicine → Application database: stores chat state
- Audit trail → Application database: records events
