# samrat-anand/medivault architecture

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

- Interactive diagram: https://gitdiagram.com/samrat-anand/medivault
- Repository: https://github.com/samrat-anand/medivault

## Overview

MediVault AI is currently an authentication and patient-profile application with health checks and frontend shells for future medical-record, timeline, appointment, and reminder features. The implemented user workflow is registration or login, cookie-based session establishment, protected access, and viewing or editing a profile. README-described future capabilities are shown as placeholders, not implemented processing stages. Relationships are limited to source-index references and README statements; several UI-to-service links are therefore omitted.

Main entry points: [`backend/app/api/dependencies.py`](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/dependencies.py) (Session dependencies), [`backend/app/services/auth_service.py`](https://github.com/samrat-anand/medivault/blob/main/backend/app/services/auth_service.py) (Authentication service), [`backend/app/api/routes/auth.py`](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/routes/auth.py) (Authentication routes), [`backend/app/api/router.py`](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/router.py) (Versioned API router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Patient interface"]
  node_app["Application routes<br/>[App.tsx]"]
  node_auth_ui["Login and register<br/>[LoginPage.tsx]"]
  node_profile_ui["Patient profile page<br/>[ProfilePage.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_future_modules["Records and reminders shells"]
  node_auth_context["Session context<br/>[AuthContext.tsx]"]
  node_api_client["API client<br/>[apiClient.ts]"]
  node_auth_client["Auth client<br/>[authService.ts]"]
  node_profile_client["Profile client<br/>[profileService.ts]"]
  node_health_status["Backend status widget<br/>[BackendStatus.tsx]"]
  node_health_client["Health client<br/>[healthService.ts]"]
end

subgraph group_api["API boundary"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_api_router["Versioned API router<br/>[router.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_profile_routes["Profile routes<br/>[profile.py]"]
  node_health_routes["Health routes<br/>[health.py]"]
end

subgraph group_identity["Identity and profiles"]
  node_dependencies["Session dependencies<br/>[dependencies.py]"]
  node_auth_service["Authentication service<br/>[auth_service.py]"]
  node_profile_service["Profile service<br/>[profile_service.py]"]
  node_security["Token and password security<br/>[security.py]"]
  node_user_model["User account<br/>[user.py]"]
  node_profile_model["Patient profile<br/>[patient_profile.py]"]
  node_revoked_model["Revoked tokens<br/>[revoked_token.py]"]
end

subgraph group_platform["Runtime and health"]
  node_database[("PostgreSQL")]
  node_db_session["Database sessions<br/>[session.py]"]
  node_settings["Application settings<br/>[config.py]"]
  node_health_service["Health and root responses<br/>[health_service.py]"]
end

node_patient(("Patient"))

node_patient -->|"uses"| node_app
node_backend -->|"mounts"| node_api_router
node_api_router -->|"registers"| node_auth_routes
node_api_router -->|"registers"| node_profile_routes
node_api_router -->|"registers"| node_health_routes
node_auth_routes -->|"calls"| node_auth_service
node_auth_routes -->|"uses"| node_dependencies
node_auth_service -->|"hashes and verifies"| node_security
node_auth_service -->|"queries and creates"| node_user_model
node_auth_service -->|"creates"| node_profile_model
node_auth_service -->|"records revocation"| node_revoked_model
node_auth_routes -->|"creates tokens"| node_security
node_dependencies -->|"validates tokens"| node_security
node_dependencies -->|"checks revocation"| node_auth_service
node_dependencies -->|"loads user"| node_user_model
node_profile_routes -->|"requires session"| node_dependencies
node_profile_routes -->|"calls"| node_profile_service
node_profile_service -->|"reads and updates"| node_profile_model
node_profile_service -->|"reads and updates"| node_user_model
node_backend -->|"configures"| node_settings
node_backend -->|"handles health"| node_health_service
node_health_routes -->|"calls"| node_health_service
node_health_service -->|"reads settings"| node_settings
node_auth_routes -->|"requests session"| node_db_session
node_profile_routes -->|"requests session"| node_db_session
node_dependencies -->|"requests session"| node_db_session
node_db_session -.->|"connects"| node_database
node_patient -->|"registers or logs in"| node_auth_ui
node_patient -->|"edits profile"| node_profile_ui
node_patient -->|"opens placeholders"| node_future_modules
node_patient -.->|"checks status"| node_health_status
node_health_status -.->|"requests health"| node_health_client
node_health_client -.->|"calls API"| node_health_routes

click node_app "https://github.com/samrat-anand/medivault/blob/main/frontend/src/App.tsx"
click node_auth_ui "https://github.com/samrat-anand/medivault/blob/main/frontend/src/pages/LoginPage.tsx"
click node_profile_ui "https://github.com/samrat-anand/medivault/blob/main/frontend/src/pages/ProfilePage.tsx"
click node_dashboard "https://github.com/samrat-anand/medivault/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_future_modules "https://github.com/samrat-anand/medivault/blob/main/frontend/src/components/PlaceholderModule.tsx"
click node_auth_context "https://github.com/samrat-anand/medivault/blob/main/frontend/src/context/AuthContext.tsx"
click node_api_client "https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/apiClient.ts"
click node_auth_client "https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/authService.ts"
click node_profile_client "https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/profileService.ts"
click node_backend "https://github.com/samrat-anand/medivault/blob/main/backend/app/main.py"
click node_api_router "https://github.com/samrat-anand/medivault/blob/main/backend/app/api/router.py"
click node_auth_routes "https://github.com/samrat-anand/medivault/blob/main/backend/app/api/routes/auth.py"
click node_profile_routes "https://github.com/samrat-anand/medivault/blob/main/backend/app/api/routes/profile.py"
click node_health_routes "https://github.com/samrat-anand/medivault/blob/main/backend/app/api/routes/health.py"
click node_dependencies "https://github.com/samrat-anand/medivault/blob/main/backend/app/api/dependencies.py"
click node_auth_service "https://github.com/samrat-anand/medivault/blob/main/backend/app/services/auth_service.py"
click node_profile_service "https://github.com/samrat-anand/medivault/blob/main/backend/app/services/profile_service.py"
click node_security "https://github.com/samrat-anand/medivault/blob/main/backend/app/core/security.py"
click node_user_model "https://github.com/samrat-anand/medivault/blob/main/backend/app/models/user.py"
click node_profile_model "https://github.com/samrat-anand/medivault/blob/main/backend/app/models/patient_profile.py"
click node_revoked_model "https://github.com/samrat-anand/medivault/blob/main/backend/app/models/revoked_token.py"
click node_db_session "https://github.com/samrat-anand/medivault/blob/main/backend/app/db/session.py"
click node_settings "https://github.com/samrat-anand/medivault/blob/main/backend/app/core/config.py"
click node_health_service "https://github.com/samrat-anand/medivault/blob/main/backend/app/services/health_service.py"
click node_health_status "https://github.com/samrat-anand/medivault/blob/main/frontend/src/components/BackendStatus.tsx"
click node_health_client "https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/healthService.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_app,node_auth_ui,node_profile_ui,node_dashboard,node_future_modules,node_auth_context,node_api_client,node_auth_client,node_profile_client,node_health_status,node_health_client toneBlue
class node_backend,node_api_router,node_auth_routes,node_profile_routes,node_health_routes toneAmber
class node_dependencies,node_auth_service,node_profile_service,node_security,node_user_model,node_profile_model,node_revoked_model toneMint
class node_database,node_db_session,node_settings,node_health_service toneRose
class node_patient toneIndigo
```

## Components

### Patient interface

- [Application routes](https://github.com/samrat-anand/medivault/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login and register](https://github.com/samrat-anand/medivault/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Patient profile page](https://github.com/samrat-anand/medivault/blob/main/frontend/src/pages/ProfilePage.tsx): `frontend/src/pages/ProfilePage.tsx`
- [Dashboard](https://github.com/samrat-anand/medivault/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Records and reminders shells](https://github.com/samrat-anand/medivault/blob/main/frontend/src/components/PlaceholderModule.tsx): `frontend/src/components/PlaceholderModule.tsx`
- [Session context](https://github.com/samrat-anand/medivault/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [API client](https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/apiClient.ts): `frontend/src/services/apiClient.ts`
- [Auth client](https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/authService.ts): `frontend/src/services/authService.ts`
- [Profile client](https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/profileService.ts): `frontend/src/services/profileService.ts`
- [Backend status widget](https://github.com/samrat-anand/medivault/blob/main/frontend/src/components/BackendStatus.tsx): `frontend/src/components/BackendStatus.tsx`
- [Health client](https://github.com/samrat-anand/medivault/blob/main/frontend/src/services/healthService.ts): `frontend/src/services/healthService.ts`

### API boundary

- [FastAPI application](https://github.com/samrat-anand/medivault/blob/main/backend/app/main.py): `backend/app/main.py`
- [Versioned API router](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Authentication routes](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Profile routes](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/routes/profile.py): `backend/app/api/routes/profile.py`
- [Health routes](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/routes/health.py): `backend/app/api/routes/health.py`

### Identity and profiles

- [Session dependencies](https://github.com/samrat-anand/medivault/blob/main/backend/app/api/dependencies.py): `backend/app/api/dependencies.py`
- [Authentication service](https://github.com/samrat-anand/medivault/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Profile service](https://github.com/samrat-anand/medivault/blob/main/backend/app/services/profile_service.py): `backend/app/services/profile_service.py`
- [Token and password security](https://github.com/samrat-anand/medivault/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [User account](https://github.com/samrat-anand/medivault/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Patient profile](https://github.com/samrat-anand/medivault/blob/main/backend/app/models/patient_profile.py): `backend/app/models/patient_profile.py`
- [Revoked tokens](https://github.com/samrat-anand/medivault/blob/main/backend/app/models/revoked_token.py): `backend/app/models/revoked_token.py`

### Runtime and health

- **PostgreSQL**
- [Database sessions](https://github.com/samrat-anand/medivault/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Application settings](https://github.com/samrat-anand/medivault/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Health and root responses](https://github.com/samrat-anand/medivault/blob/main/backend/app/services/health_service.py): `backend/app/services/health_service.py`

### Other components

- **Patient**

## Connections

- Patient → Application routes: uses (evidence: `README.md`)
- FastAPI application → Versioned API router: mounts (evidence: `backend/app/main.py`)
- Versioned API router → Authentication routes: registers (evidence: `backend/app/api/router.py`)
- Versioned API router → Profile routes: registers (evidence: `backend/app/api/router.py`)
- Versioned API router → Health routes: registers (evidence: `backend/app/api/router.py`)
- Authentication routes → Authentication service: calls (evidence: `backend/app/api/routes/auth.py`)
- Authentication routes → Session dependencies: uses (evidence: `backend/app/api/routes/auth.py`)
- Authentication service → Token and password security: hashes and verifies (evidence: `backend/app/services/auth_service.py`)
- Authentication service → User account: queries and creates (evidence: `backend/app/services/auth_service.py`)
- Authentication service → Patient profile: creates (evidence: `backend/app/services/auth_service.py`)
- Authentication service → Revoked tokens: records revocation (evidence: `backend/app/services/auth_service.py`)
- Authentication routes → Token and password security: creates tokens (evidence: `backend/app/api/routes/auth.py`)
- Session dependencies → Token and password security: validates tokens (evidence: `backend/app/api/dependencies.py`)
- Session dependencies → Authentication service: checks revocation (evidence: `backend/app/api/dependencies.py`)
- Session dependencies → User account: loads user (evidence: `backend/app/api/dependencies.py`)
- Profile routes → Session dependencies: requires session (evidence: `backend/app/api/routes/profile.py`)
- Profile routes → Profile service: calls (evidence: `backend/app/api/routes/profile.py`)
- Profile service → Patient profile: reads and updates (evidence: `backend/app/services/profile_service.py`)
- Profile service → User account: reads and updates (evidence: `backend/app/services/profile_service.py`)
- FastAPI application → Application settings: configures (evidence: `backend/app/main.py`)
- FastAPI application → Health and root responses: handles health (evidence: `backend/app/main.py`)
- Health routes → Health and root responses: calls (evidence: `backend/app/api/routes/health.py`)
- Health and root responses → Application settings: reads settings (evidence: `backend/app/services/health_service.py`)
- Authentication routes → Database sessions: requests session (evidence: `backend/app/api/routes/auth.py`)
- Profile routes → Database sessions: requests session (evidence: `backend/app/api/routes/profile.py`)
- Session dependencies → Database sessions: requests session (evidence: `backend/app/api/dependencies.py`)
- Database sessions → PostgreSQL: connects (evidence: `backend/app/db/session.py`)
- Patient → Login and register: registers or logs in (evidence: `README.md`)
- Patient → Patient profile page: edits profile (evidence: `README.md`)
- Patient → Records and reminders shells: opens placeholders (evidence: `README.md`)
- Patient → Backend status widget: checks status
- Backend status widget → Health client: requests health
- Health client → Health routes: calls API
