# tarbot-oss/tarveri-bot architecture

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

- Interactive diagram: https://gitdiagram.com/tarbot-oss/tarveri-bot
- Repository: https://github.com/tarbot-oss/tarveri-bot

## Overview

TARVeri is a Discord bot for student and guest verification. Its main user journey runs from Discord commands or interactive views through student-ID verification and optional email OTP, then role assignment and persisted identity state; guest referrals instead proceed through ticket review. The repository also documents campus cards, random tags, administration, lifecycle expiry, and operational monitoring. Edges are limited to relationships shown in excerpts, the source index, or README; several subsystem internals were not sampled.

Main entry points: [`tarveri/bot.py`](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/bot.py) (Bot assembly), [`tarveri/cogs/verification_cog.py`](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/verification_cog.py) (Student commands), [`tarveri/services/verification_service.py`](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/verification_service.py) (Identity lifecycle), [`tarveri/cogs/guest_cog.py`](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/guest_cog.py) (Guest commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot["Bot assembly<br/>[bot.py]"]
  node_config["Settings and ID parsing<br/>[config.py]"]
end

subgraph group_discord["Discord workflows"]
  node_verification_cog["Student commands"]
  node_verification_views["Verification views"]
  node_guest_cog["Guest commands<br/>[guest_cog.py]"]
  node_guest_views["Guest views<br/>[guest_views.py]"]
  node_admin_cog["Admin commands<br/>[admin_cog.py]"]
  node_admin_dashboard["Admin dashboard<br/>[admin_dashboard.py]"]
  node_card_cog["Campus card commands<br/>[card_cog.py]"]
  node_random_tag_cog["Random tag commands<br/>[random_tag_cog.py]"]
end

subgraph group_domain["Verification services"]
  node_verification_service["Identity lifecycle"]
  node_rate_limiter["Rate limiter<br/>[rate_limiter.py]"]
  node_email_service["OTP email<br/>[email_service.py]"]
  node_guest_service["Referral tickets<br/>[guest_service.py]"]
  node_card_service["Card rendering<br/>[card_service.py]"]
  node_random_tag_service["Random tag service"]
  node_dead_letter["Email retry queue"]
end

subgraph group_persistence["Persistence"]
  node_database[("SQLite database<br/>[database.py]")]
  node_repositories["Domain repositories"]
end

subgraph group_operations["Operations"]
  node_watchdog["Graduation watchdog"]
  node_uptime["Uptime monitor<br/>[uptime_service.py]"]
  node_outage["Outage monitor<br/>[outage_service.py]"]
  node_update_checker["Update checker<br/>[update_checker.py]"]
  node_log_service["Audit logging<br/>[log_service.py]"]
end

node_operator(("Discord user"))
node_discord_api(("Discord platform"))
node_smtp{{"SMTP relays"}}

node_operator -->|"interacts with"| node_discord_api
node_discord_api -->|"dispatches commands"| node_verification_cog
node_discord_api -->|"dispatches commands"| node_guest_cog
node_discord_api -->|"dispatches commands"| node_admin_cog
node_bot -->|"registers"| node_verification_cog
node_bot -->|"registers"| node_guest_cog
node_bot -->|"registers"| node_admin_cog
node_bot -->|"registers"| node_card_cog
node_bot -->|"registers"| node_random_tag_cog
node_verification_cog -->|"requests verification"| node_verification_service
node_verification_cog -->|"checks attempts"| node_rate_limiter
node_verification_cog -->|"presents"| node_verification_views
node_verification_service -->|"initiates OTP"| node_email_service
node_email_service -->|"sends OTP"| node_smtp
node_email_service -->|"queues failed mail"| node_dead_letter
node_guest_cog -->|"runs referral workflow"| node_guest_service
node_guest_cog -->|"presents"| node_guest_views
node_guest_service -->|"checks referrers"| node_verification_service
node_admin_cog -->|"opens"| node_admin_dashboard
node_card_cog -->|"requests card"| node_card_service
node_random_tag_cog -->|"requests tags"| node_random_tag_service
node_verification_service -->|"reads and writes"| node_database
node_guest_service -->|"reads and writes tickets"| node_database
node_database -->|"uses repositories"| node_repositories
node_bot -->|"starts"| node_watchdog
node_bot -->|"starts"| node_uptime
node_bot -->|"starts"| node_outage
node_watchdog -->|"resolves expiry"| node_verification_service
node_admin_dashboard -->|"shows metrics"| node_uptime
node_bot -.->|"configures"| node_update_checker
node_log_service -->|"writes audit events"| node_database

click node_bot "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/bot.py"
click node_config "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/config.py"
click node_verification_cog "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/verification_cog.py"
click node_verification_views "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/views/verification_views.py"
click node_guest_cog "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/guest_cog.py"
click node_guest_views "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/views/guest_views.py"
click node_admin_cog "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/admin_cog.py"
click node_admin_dashboard "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/admin_dashboard.py"
click node_card_cog "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/card_cog.py"
click node_random_tag_cog "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/random_tag_cog.py"
click node_verification_service "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/verification_service.py"
click node_rate_limiter "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/rate_limiter.py"
click node_email_service "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/email_service.py"
click node_guest_service "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/guest_service.py"
click node_card_service "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/card_service.py"
click node_random_tag_service "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/random_tag_service.py"
click node_dead_letter "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/dead_letter_service.py"
click node_watchdog "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/graduation_watchdog_service.py"
click node_uptime "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/uptime_service.py"
click node_outage "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/outage_service.py"
click node_update_checker "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/update_checker.py"
click node_log_service "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/log_service.py"
click node_database "https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/database.py"
click node_repositories "https://github.com/tarbot-oss/tarveri-bot/tree/main/tarveri/db"

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_bot,node_config,node_operator toneBlue
class node_verification_cog,node_verification_views,node_guest_cog,node_guest_views,node_admin_cog,node_admin_dashboard,node_card_cog,node_random_tag_cog toneAmber
class node_verification_service,node_rate_limiter,node_email_service,node_guest_service,node_card_service,node_random_tag_service,node_dead_letter toneMint
class node_database,node_repositories toneRose
class node_watchdog,node_uptime,node_outage,node_update_checker,node_log_service,node_discord_api,node_smtp toneIndigo
```

## Components

### Bot runtime

- [Bot assembly](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/bot.py): `tarveri/bot.py`
- [Settings and ID parsing](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/config.py): `tarveri/config.py`

### Discord workflows

- [Student commands](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/verification_cog.py): `tarveri/cogs/verification_cog.py`
- [Verification views](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/views/verification_views.py): `tarveri/views/verification_views.py`
- [Guest commands](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/guest_cog.py): `tarveri/cogs/guest_cog.py`
- [Guest views](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/views/guest_views.py): `tarveri/views/guest_views.py`
- [Admin commands](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/admin_cog.py): `tarveri/cogs/admin_cog.py`
- [Admin dashboard](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/admin_dashboard.py): `tarveri/cogs/admin_dashboard.py`
- [Campus card commands](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/card_cog.py): `tarveri/cogs/card_cog.py`
- [Random tag commands](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/cogs/random_tag_cog.py): `tarveri/cogs/random_tag_cog.py`

### Verification services

- [Identity lifecycle](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/verification_service.py): `tarveri/services/verification_service.py`
- [Rate limiter](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/rate_limiter.py): `tarveri/rate_limiter.py`
- [OTP email](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/email_service.py): `tarveri/services/email_service.py`
- [Referral tickets](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/guest_service.py): `tarveri/services/guest_service.py`
- [Card rendering](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/card_service.py): `tarveri/services/card_service.py`
- [Random tag service](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/random_tag_service.py): `tarveri/services/random_tag_service.py`
- [Email retry queue](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/dead_letter_service.py): `tarveri/services/dead_letter_service.py`

### Persistence

- [SQLite database](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/database.py): `tarveri/database.py`
- [Domain repositories](https://github.com/tarbot-oss/tarveri-bot/tree/main/tarveri/db): `tarveri/db`

### Operations

- [Graduation watchdog](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/graduation_watchdog_service.py): `tarveri/services/graduation_watchdog_service.py`
- [Uptime monitor](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/uptime_service.py): `tarveri/services/uptime_service.py`
- [Outage monitor](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/outage_service.py): `tarveri/services/outage_service.py`
- [Update checker](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/update_checker.py): `tarveri/services/update_checker.py`
- [Audit logging](https://github.com/tarbot-oss/tarveri-bot/blob/main/tarveri/services/log_service.py): `tarveri/services/log_service.py`

### Other components

- **Discord user**
- **Discord platform**
- **SMTP relays**

## Connections

- Discord user → Discord platform: interacts with
- Discord platform → Student commands: dispatches commands
- Discord platform → Guest commands: dispatches commands
- Discord platform → Admin commands: dispatches commands
- Bot assembly → Student commands: registers (evidence: `tarveri/bot.py`)
- Bot assembly → Guest commands: registers (evidence: `tarveri/bot.py`)
- Bot assembly → Admin commands: registers (evidence: `tarveri/bot.py`)
- Bot assembly → Campus card commands: registers (evidence: `tarveri/bot.py`)
- Bot assembly → Random tag commands: registers (evidence: `tarveri/bot.py`)
- Student commands → Identity lifecycle: requests verification (evidence: `tarveri/cogs/verification_cog.py`)
- Student commands → Rate limiter: checks attempts (evidence: `tarveri/cogs/verification_cog.py`)
- Student commands → Verification views: presents (evidence: `tarveri/cogs/verification_cog.py`)
- Identity lifecycle → OTP email: initiates OTP
- OTP email → SMTP relays: sends OTP
- OTP email → Email retry queue: queues failed mail (evidence: `tarveri/services/dead_letter_service.py`)
- Guest commands → Referral tickets: runs referral workflow (evidence: `tarveri/cogs/guest_cog.py`)
- Guest commands → Guest views: presents (evidence: `tarveri/cogs/guest_cog.py`)
- Referral tickets → Identity lifecycle: checks referrers
- Admin commands → Admin dashboard: opens (evidence: `tarveri/cogs/admin_cog.py`)
- Campus card commands → Card rendering: requests card (evidence: `tarveri/cogs/card_cog.py`)
- Random tag commands → Random tag service: requests tags (evidence: `tarveri/cogs/random_tag_cog.py`)
- Identity lifecycle → SQLite database: reads and writes (evidence: `tarveri/services/verification_service.py`)
- Referral tickets → SQLite database: reads and writes tickets (evidence: `tarveri/services/guest_service.py`)
- SQLite database → Domain repositories: uses repositories (evidence: `tarveri/database.py`)
- Bot assembly → Graduation watchdog: starts (evidence: `tarveri/bot.py`)
- Bot assembly → Uptime monitor: starts (evidence: `tarveri/bot.py`)
- Bot assembly → Outage monitor: starts (evidence: `tarveri/bot.py`)
- Graduation watchdog → Identity lifecycle: resolves expiry (evidence: `tarveri/services/graduation_watchdog_service.py`)
- Admin dashboard → Uptime monitor: shows metrics (evidence: `tarveri/cogs/admin_dashboard.py`)
- Bot assembly → Update checker: configures (evidence: `tarveri/bot.py`)
- Audit logging → SQLite database: writes audit events
