# glitchx-harshit/swasthyasetu architecture

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

- Interactive diagram: https://gitdiagram.com/glitchx-harshit/swasthyasetu
- Repository: https://github.com/glitchx-harshit/swasthyasetu

## Overview

SwasthyaSetu is a healthcare-platform scaffold for frontline health workers and healthcare facilities, with a Flutter mobile client, a Next.js facility dashboard, and a FastAPI service. The visible backend workflow is an HTTP health request routed through the versioned API to a database connectivity check and a typed health response. README capabilities such as offline-first mobile use, facility triage, and Redis are represented cautiously: their implementation is not present in the sampled source, so connections to the backend are unverified.

Main entry points: [`backend/app/main.py`](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/main.py) (FastAPI entry), [`backend/app/api/v1/endpoints/health.py`](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/api/v1/endpoints/health.py) (Health endpoint), [`backend/app/db/session.py`](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/db/session.py) (Database sessions), [`apps/frontline-mobile`](https://github.com/glitchx-harshit/swasthyasetu/tree/main/apps/frontline-mobile) (Offline mobile app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User applications"]
  node_mobile_app["Offline mobile app"]
  node_dashboard_page["Facility dashboard<br/>[page.tsx]"]
  node_dashboard_layout["Dashboard layout<br/>[layout.tsx]"]
  node_dashboard_navigation["Dashboard navigation<br/>[Navigation.tsx]"]
end

subgraph group_api["Backend API"]
  node_api_main["FastAPI entry<br/>[main.py]"]
  node_api_router["Versioned API router<br/>[router.py]"]
  node_health_endpoint["Health endpoint<br/>[health.py]"]
  node_health_response["Health response schema<br/>[health.py]"]
end

subgraph group_platform["Backend foundations"]
  node_api_dependencies["Request dependencies<br/>[deps.py]"]
  node_settings["Application settings<br/>[config.py]"]
  node_logging["Logging setup<br/>[logging.py]"]
  node_db_session["Database sessions<br/>[session.py]"]
  node_orm_base["ORM base<br/>[base.py]"]
end

subgraph group_services["Data services"]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis cache")]
end

node_healthcare_workers(("Frontline workers"))
node_facility_staff(("Facility staff"))

node_dashboard_layout -->|"renders"| node_dashboard_navigation
node_api_main -->|"mounts routes"| node_api_router
node_api_main -->|"reads settings"| node_settings
node_api_main -->|"configures logging"| node_logging
node_api_router -->|"routes to"| node_health_endpoint
node_health_endpoint -->|"injects dependencies"| node_api_dependencies
node_health_endpoint -->|"returns schema"| node_health_response
node_api_dependencies -->|"opens session"| node_db_session
node_db_session -->|"gets connection config"| node_settings
node_db_session -->|"connects to"| node_postgres
node_healthcare_workers -.->|"uses"| node_mobile_app
node_facility_staff -.->|"uses"| node_dashboard_page
node_mobile_app -.->|"may call API"| node_api_main
node_dashboard_page -.->|"may call API"| node_api_main
node_api_main -.->|"optional cache"| node_redis

click node_mobile_app "https://github.com/glitchx-harshit/swasthyasetu/tree/main/apps/frontline-mobile"
click node_dashboard_page "https://github.com/glitchx-harshit/swasthyasetu/blob/main/apps/facility-dashboard/src/app/page.tsx"
click node_dashboard_layout "https://github.com/glitchx-harshit/swasthyasetu/blob/main/apps/facility-dashboard/src/app/layout.tsx"
click node_dashboard_navigation "https://github.com/glitchx-harshit/swasthyasetu/blob/main/apps/facility-dashboard/src/components/Navigation.tsx"
click node_api_main "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/main.py"
click node_api_router "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/api/v1/router.py"
click node_health_endpoint "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/api/v1/endpoints/health.py"
click node_health_response "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/schemas/health.py"
click node_api_dependencies "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/api/deps.py"
click node_settings "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/core/config.py"
click node_logging "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/core/logging.py"
click node_db_session "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/db/session.py"
click node_orm_base "https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/db/base.py"

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_mobile_app,node_dashboard_page,node_dashboard_layout,node_dashboard_navigation toneBlue
class node_api_main,node_api_router,node_health_endpoint,node_health_response toneAmber
class node_api_dependencies,node_settings,node_logging,node_db_session,node_orm_base toneMint
class node_postgres,node_redis,node_healthcare_workers toneRose
class node_facility_staff toneIndigo
```

## Components

### User applications

- [Offline mobile app](https://github.com/glitchx-harshit/swasthyasetu/tree/main/apps/frontline-mobile): `apps/frontline-mobile`
- [Facility dashboard](https://github.com/glitchx-harshit/swasthyasetu/blob/main/apps/facility-dashboard/src/app/page.tsx): `apps/facility-dashboard/src/app/page.tsx`
- [Dashboard layout](https://github.com/glitchx-harshit/swasthyasetu/blob/main/apps/facility-dashboard/src/app/layout.tsx): `apps/facility-dashboard/src/app/layout.tsx`
- [Dashboard navigation](https://github.com/glitchx-harshit/swasthyasetu/blob/main/apps/facility-dashboard/src/components/Navigation.tsx): `apps/facility-dashboard/src/components/Navigation.tsx`

### Backend API

- [FastAPI entry](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/main.py): `backend/app/main.py`
- [Versioned API router](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Health endpoint](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/api/v1/endpoints/health.py): `backend/app/api/v1/endpoints/health.py`
- [Health response schema](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/schemas/health.py): `backend/app/schemas/health.py`

### Backend foundations

- [Request dependencies](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`
- [Application settings](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Logging setup](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/core/logging.py): `backend/app/core/logging.py`
- [Database sessions](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [ORM base](https://github.com/glitchx-harshit/swasthyasetu/blob/main/backend/app/db/base.py): `backend/app/db/base.py`

### Data services

- **PostgreSQL**
- **Redis cache**

### Other components

- **Frontline workers**
- **Facility staff**

## Connections

- Dashboard layout → Dashboard navigation: renders (evidence: `apps/facility-dashboard/src/app/layout.tsx`)
- FastAPI entry → Versioned API router: mounts routes (evidence: `backend/app/main.py`)
- FastAPI entry → Application settings: reads settings (evidence: `backend/app/main.py`)
- FastAPI entry → Logging setup: configures logging (evidence: `backend/app/main.py`)
- Versioned API router → Health endpoint: routes to (evidence: `backend/app/api/v1/router.py`)
- Health endpoint → Request dependencies: injects dependencies (evidence: `backend/app/api/v1/endpoints/health.py`)
- Health endpoint → Health response schema: returns schema (evidence: `backend/app/api/v1/endpoints/health.py`)
- Request dependencies → Database sessions: opens session (evidence: `backend/app/api/deps.py`)
- Database sessions → Application settings: gets connection config (evidence: `backend/app/db/session.py`)
- Database sessions → PostgreSQL: connects to (evidence: `README.md`)
- Frontline workers → Offline mobile app: uses (evidence: `README.md`)
- Facility staff → Facility dashboard: uses (evidence: `README.md`)
- Offline mobile app → FastAPI entry: may call API
- Facility dashboard → FastAPI entry: may call API
- FastAPI entry → Redis cache: optional cache
