# gaussticdev/gramly architecture

> Architecture diagram of the GitHub repository gaussticdev/gramly, 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/gaussticdev/gramly
- Repository: https://github.com/gaussticdev/gramly

## Overview

Gramly is a lightweight Python framework for building Telegram bots. A developer uses decorators on plain functions to define bot behavior; the framework includes command and callback routing, update guards, Telegram-related data models, and helpers for rich content and keyboards. The repository is a small package with most runtime responsibilities in one large module. The excerpts show guard and callback dispatch behavior, but do not establish the full update-receiving or Telegram API transport workflow.

Main entry points: [`gramly/gramly.py`](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py) (Bot framework), [`gramly/__init__.py`](https://github.com/gaussticdev/gramly/blob/main/gramly/__init__.py) (Public exports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Package API"]
  node_exports["Public exports<br/>[__init__.py]"]
end

subgraph group_runtime["Bot Runtime"]
  node_framework["Bot framework<br/>[gramly.py]"]
  node_command_routes["Command routes<br/>[gramly.py]"]
  node_callback_routes["Callback routes<br/>[gramly.py]"]
  node_update_guards["Update guards<br/>[gramly.py]"]
  node_telegram_models["Telegram models<br/>[gramly.py]"]
  node_callback_data["Callback data<br/>[gramly.py]"]
end

subgraph group_content["Bot Content"]
  node_keyboard_helpers["Keyboard helpers<br/>[gramly.py]"]
  node_rich_content["Rich content<br/>[gramly.py]"]
end

node_developer(("Bot developer"))

node_developer -->|"uses"| node_exports
node_exports -->|"exports"| node_framework
node_developer -->|"defines handlers"| node_command_routes
node_framework -->|"runs guards"| node_update_guards
node_framework -->|"dispatches callbacks"| node_callback_routes
node_callback_routes -->|"matches actions"| node_callback_data

click node_exports "https://github.com/gaussticdev/gramly/blob/main/gramly/__init__.py"
click node_framework "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py"
click node_command_routes "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py"
click node_callback_routes "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py"
click node_update_guards "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py"
click node_telegram_models "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py"
click node_callback_data "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py"
click node_keyboard_helpers "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py"
click node_rich_content "https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.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_exports toneBlue
class node_framework,node_command_routes,node_callback_routes,node_update_guards,node_telegram_models,node_callback_data toneAmber
class node_keyboard_helpers,node_rich_content toneMint
class node_developer toneIndigo
```

## Components

### Package API

- [Public exports](https://github.com/gaussticdev/gramly/blob/main/gramly/__init__.py): `gramly/__init__.py`

### Bot Runtime

- [Bot framework](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`
- [Command routes](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`
- [Callback routes](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`
- [Update guards](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`
- [Telegram models](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`
- [Callback data](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`

### Bot Content

- [Keyboard helpers](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`
- [Rich content](https://github.com/gaussticdev/gramly/blob/main/gramly/gramly.py): `gramly/gramly.py`

### Other components

- **Bot developer**

## Connections

- Bot developer → Public exports: uses (evidence: `README.md`)
- Public exports → Bot framework: exports (evidence: `gramly/__init__.py`)
- Bot developer → Command routes: defines handlers (evidence: `README.md`)
- Bot framework → Update guards: runs guards (evidence: `gramly/gramly.py`)
- Bot framework → Callback routes: dispatches callbacks (evidence: `gramly/gramly.py`)
- Callback routes → Callback data: matches actions (evidence: `gramly/gramly.py`)
