# aanandmodi/aria architecture

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

- Interactive diagram: https://gitdiagram.com/aanandmodi/aria
- Repository: https://github.com/aanandmodi/aria

## Overview

ARIA is a self-hosted assistant that consolidates messages and digital-life commands in Telegram. Its primary flow accepts a Telegram update, queues it for asynchronous processing, interprets the request, and dispatches handlers that respond through Telegram or connected services. Inbound communications are classified and surfaced as notifications; persistent state and scheduled briefings support the broader product. The map combines sampled code, SOURCE INDEX references, and README-documented capabilities; several integration and handler internals were not sampled.

Main entry points: [`api/handlers/reply_handler.py`](https://github.com/aanandmodi/aria/blob/main/api/handlers/reply_handler.py) (Reply handler), [`api/workers/inbound.py`](https://github.com/aanandmodi/aria/blob/main/api/workers/inbound.py) (Inbound processor), [`api/workers/telegram_processor.py`](https://github.com/aanandmodi/aria/blob/main/api/workers/telegram_processor.py) (Update processor), [`api/workers/briefing.py`](https://github.com/aanandmodi/aria/blob/main/api/workers/briefing.py) (Morning briefing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and channels"]
  node_telegram(("Telegram bot"))
  node_inbound(("Message channels"))
  node_telegram_route["Telegram webhook<br/>[telegram.py]"]
end

subgraph group_runtime["Assistant runtime"]
  node_inbound_worker["Inbound processor<br/>[inbound.py]"]
  node_telegram_worker["Update processor"]
  node_router["Command router<br/>[router.py]"]
  node_reply["Reply handler<br/>[reply_handler.py]"]
  node_inbox_agent["Inbox agent<br/>[inbox_agent.py]"]
end

subgraph group_intelligence["AI and workflows"]
  node_llm["Groq language model<br/>[client.py]"]
  node_intent["Intent parsing<br/>[intent.py]"]
  node_classification["Message classification<br/>[classify.py]"]
  node_transcription["Voice transcription<br/>[transcribe.py]"]
  node_briefing["Morning briefing<br/>[briefing.py]"]
end

subgraph group_integrations["Connected services"]
  node_telegram_service["Telegram delivery"]
  node_gmail["Gmail service<br/>[gmail_service.py]"]
  node_whatsapp["WhatsApp service"]
  node_github["GitHub service<br/>[github_service.py]"]
  node_other_services["Other integrations"]
end

subgraph group_state["State and infrastructure"]
  node_queue["Redis job queue<br/>[queue.py]"]
  node_database[("PostgreSQL data<br/>[models.py]")]
  node_session["Database sessions<br/>[session.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_user(("User"))

node_user -->|"sends commands"| node_telegram
node_telegram -->|"posts updates"| node_telegram_route
node_telegram_route -->|"enqueues update"| node_queue
node_queue -->|"dispatches jobs"| node_telegram_worker
node_telegram_worker -->|"routes commands"| node_router
node_telegram_worker -->|"handles replies"| node_reply
node_router -->|"parses intent"| node_intent
node_intent -->|"requests completion"| node_llm
node_router -->|"dispatches replies"| node_reply
node_inbound -->|"delivers messages"| node_inbound_worker
node_inbound_worker -->|"scores messages"| node_classification
node_inbound_worker -->|"transcribes voice"| node_transcription
node_inbound_worker -->|"sends alerts"| node_telegram_service
node_inbound_worker -->|"persists messages"| node_database
node_inbox_agent -->|"reads messages"| node_gmail
node_inbox_agent -->|"reads messages"| node_whatsapp
node_reply -->|"sends email"| node_gmail
node_reply -->|"sends reply"| node_whatsapp
node_reply -->|"notifies user"| node_telegram_service
node_reply -->|"uses GitHub actions"| node_github
node_telegram_worker -->|"invokes briefing"| node_briefing
node_briefing -->|"delivers digest"| node_telegram_service
node_briefing -->|"gathers digest data"| node_other_services
node_classification -.->|"scores with model"| node_llm
node_transcription -.->|"uses Whisper"| node_llm
node_other_services -.->|"stores application data"| node_database
node_telegram_route -->|"checks access"| node_config
node_session -->|"opens sessions"| node_database
node_telegram_worker -->|"uses database sessions"| node_session
node_briefing -->|"opens database session"| node_session

click node_telegram_route "https://github.com/aanandmodi/aria/blob/main/api/routes/telegram.py"
click node_inbound_worker "https://github.com/aanandmodi/aria/blob/main/api/workers/inbound.py"
click node_telegram_worker "https://github.com/aanandmodi/aria/blob/main/api/workers/telegram_processor.py"
click node_router "https://github.com/aanandmodi/aria/blob/main/api/handlers/router.py"
click node_reply "https://github.com/aanandmodi/aria/blob/main/api/handlers/reply_handler.py"
click node_inbox_agent "https://github.com/aanandmodi/aria/blob/main/api/agents/inbox_agent.py"
click node_llm "https://github.com/aanandmodi/aria/blob/main/api/llm/client.py"
click node_intent "https://github.com/aanandmodi/aria/blob/main/api/llm/intent.py"
click node_classification "https://github.com/aanandmodi/aria/blob/main/api/llm/classify.py"
click node_transcription "https://github.com/aanandmodi/aria/blob/main/api/llm/transcribe.py"
click node_briefing "https://github.com/aanandmodi/aria/blob/main/api/workers/briefing.py"
click node_telegram_service "https://github.com/aanandmodi/aria/blob/main/api/services/telegram_service.py"
click node_gmail "https://github.com/aanandmodi/aria/blob/main/api/services/gmail_service.py"
click node_whatsapp "https://github.com/aanandmodi/aria/blob/main/api/services/whatsapp_service.py"
click node_github "https://github.com/aanandmodi/aria/blob/main/api/services/github_service.py"
click node_other_services "https://github.com/aanandmodi/aria/tree/main/api/services"
click node_queue "https://github.com/aanandmodi/aria/blob/main/api/core/queue.py"
click node_database "https://github.com/aanandmodi/aria/blob/main/api/db/models.py"
click node_session "https://github.com/aanandmodi/aria/blob/main/api/db/session.py"
click node_config "https://github.com/aanandmodi/aria/blob/main/api/core/config.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_telegram,node_inbound,node_telegram_route,node_user toneBlue
class node_inbound_worker,node_telegram_worker,node_router,node_reply,node_inbox_agent toneAmber
class node_llm,node_intent,node_classification,node_transcription,node_briefing toneMint
class node_telegram_service,node_gmail,node_whatsapp,node_github,node_other_services toneRose
class node_queue,node_database,node_session,node_config toneIndigo
```

## Components

### Entry and channels

- **Telegram bot**
- **Message channels**
- [Telegram webhook](https://github.com/aanandmodi/aria/blob/main/api/routes/telegram.py): `api/routes/telegram.py`

### Assistant runtime

- [Inbound processor](https://github.com/aanandmodi/aria/blob/main/api/workers/inbound.py): `api/workers/inbound.py`
- [Update processor](https://github.com/aanandmodi/aria/blob/main/api/workers/telegram_processor.py): `api/workers/telegram_processor.py`
- [Command router](https://github.com/aanandmodi/aria/blob/main/api/handlers/router.py): `api/handlers/router.py`
- [Reply handler](https://github.com/aanandmodi/aria/blob/main/api/handlers/reply_handler.py): `api/handlers/reply_handler.py`
- [Inbox agent](https://github.com/aanandmodi/aria/blob/main/api/agents/inbox_agent.py): `api/agents/inbox_agent.py`

### AI and workflows

- [Groq language model](https://github.com/aanandmodi/aria/blob/main/api/llm/client.py): `api/llm/client.py`
- [Intent parsing](https://github.com/aanandmodi/aria/blob/main/api/llm/intent.py): `api/llm/intent.py`
- [Message classification](https://github.com/aanandmodi/aria/blob/main/api/llm/classify.py): `api/llm/classify.py`
- [Voice transcription](https://github.com/aanandmodi/aria/blob/main/api/llm/transcribe.py): `api/llm/transcribe.py`
- [Morning briefing](https://github.com/aanandmodi/aria/blob/main/api/workers/briefing.py): `api/workers/briefing.py`

### Connected services

- [Telegram delivery](https://github.com/aanandmodi/aria/blob/main/api/services/telegram_service.py): `api/services/telegram_service.py`
- [Gmail service](https://github.com/aanandmodi/aria/blob/main/api/services/gmail_service.py): `api/services/gmail_service.py`
- [WhatsApp service](https://github.com/aanandmodi/aria/blob/main/api/services/whatsapp_service.py): `api/services/whatsapp_service.py`
- [GitHub service](https://github.com/aanandmodi/aria/blob/main/api/services/github_service.py): `api/services/github_service.py`
- [Other integrations](https://github.com/aanandmodi/aria/tree/main/api/services): `api/services`

### State and infrastructure

- [Redis job queue](https://github.com/aanandmodi/aria/blob/main/api/core/queue.py): `api/core/queue.py`
- [PostgreSQL data](https://github.com/aanandmodi/aria/blob/main/api/db/models.py): `api/db/models.py`
- [Database sessions](https://github.com/aanandmodi/aria/blob/main/api/db/session.py): `api/db/session.py`
- [Runtime configuration](https://github.com/aanandmodi/aria/blob/main/api/core/config.py): `api/core/config.py`

### Other components

- **User**

## Connections

- User → Telegram bot: sends commands (evidence: `README.md`)
- Telegram bot → Telegram webhook: posts updates (evidence: `README.md`)
- Telegram webhook → Redis job queue: enqueues update (evidence: `api/routes/telegram.py`)
- Redis job queue → Update processor: dispatches jobs (evidence: `README.md`)
- Update processor → Command router: routes commands (evidence: `api/workers/telegram_processor.py`)
- Update processor → Reply handler: handles replies (evidence: `api/workers/telegram_processor.py`)
- Command router → Intent parsing: parses intent (evidence: `api/handlers/router.py`)
- Intent parsing → Groq language model: requests completion (evidence: `api/llm/intent.py`)
- Command router → Reply handler: dispatches replies (evidence: `api/handlers/router.py`)
- Message channels → Inbound processor: delivers messages (evidence: `README.md`)
- Inbound processor → Message classification: scores messages (evidence: `api/workers/inbound.py`)
- Inbound processor → Voice transcription: transcribes voice (evidence: `api/workers/inbound.py`)
- Inbound processor → Telegram delivery: sends alerts (evidence: `api/workers/inbound.py`)
- Inbound processor → PostgreSQL data: persists messages (evidence: `api/workers/inbound.py`)
- Inbox agent → Gmail service: reads messages (evidence: `api/agents/inbox_agent.py`)
- Inbox agent → WhatsApp service: reads messages (evidence: `api/agents/inbox_agent.py`)
- Reply handler → Gmail service: sends email (evidence: `api/handlers/reply_handler.py`)
- Reply handler → WhatsApp service: sends reply (evidence: `api/handlers/reply_handler.py`)
- Reply handler → Telegram delivery: notifies user (evidence: `api/handlers/reply_handler.py`)
- Reply handler → GitHub service: uses GitHub actions (evidence: `api/handlers/reply_handler.py`)
- Update processor → Morning briefing: invokes briefing (evidence: `api/workers/telegram_processor.py`)
- Morning briefing → Telegram delivery: delivers digest (evidence: `api/workers/briefing.py`)
- Morning briefing → Other integrations: gathers digest data (evidence: `api/workers/briefing.py`)
- Message classification → Groq language model: scores with model (evidence: `README.md`)
- Voice transcription → Groq language model: uses Whisper (evidence: `README.md`)
- Other integrations → PostgreSQL data: stores application data (evidence: `README.md`)
- Telegram webhook → Runtime configuration: checks access (evidence: `api/routes/telegram.py`)
- Database sessions → PostgreSQL data: opens sessions (evidence: `api/db/session.py`)
- Update processor → Database sessions: uses database sessions (evidence: `api/workers/telegram_processor.py`)
- Morning briefing → Database sessions: opens database session (evidence: `api/workers/briefing.py`)
