# fayzeen/exolt architecture

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

- Interactive diagram: https://gitdiagram.com/fayzeen/exolt
- Repository: https://github.com/fayzeen/exolt

## Overview

EXOLT is an in-progress Discord bot that reads a Gmail inbox over IMAP and posts email notifications to a configured Discord channel. Its main runtime fetches recent mail at startup, watches for new mail, applies the active filter, formats matching messages, and sends them to Discord. A separate OAuth web flow exchanges authorization codes and stores tokens used by the IMAP client. The README also lists configurable channels, notification customization, language, and multi-user support as planned; those are not represented as implemented components. Relationships reflect the excerpts, source index, and README; unsampled route and watcher details are not inferred beyond indexed references.

Main entry points: [`src/index.ts`](https://github.com/fayzeen/exolt/blob/main/src/index.ts) (Bot runtime), [`src/imap/imapClient.ts`](https://github.com/fayzeen/exolt/blob/main/src/imap/imapClient.ts) (IMAP client), [`src/imap/fetcher.ts`](https://github.com/fayzeen/exolt/blob/main/src/imap/fetcher.ts) (Recent mail fetch), [`src/web/server.ts`](https://github.com/fayzeen/exolt/blob/main/src/web/server.ts) (Web server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Discord bot"]
  node_runtime["Bot runtime<br/>[index.ts]"]
  node_config["Bot settings<br/>[config.ts]"]
  node_config_menu["Config menu<br/>[mainMenus.ts]"]
  node_email_card["Email formatter<br/>[emailDisplay.ts]"]
end

subgraph group_mail["Mail ingestion"]
  node_recent_fetch["Recent mail fetch<br/>[fetcher.ts]"]
  node_mail_watcher["New mail watcher<br/>[watcher.ts]"]
  node_imap_client["IMAP client<br/>[imapClient.ts]"]
  node_mailparser["MailParser"]
end

subgraph group_auth["Authentication"]
  node_token_store[("Token file<br/>[token.ts]")]
  node_oauth_bootstrap["OAuth bootstrap<br/>[authenticate.ts]"]
end

subgraph group_web["OAuth web flow"]
  node_web_server["Web server<br/>[server.ts]"]
  node_oauth_routes["OAuth routes<br/>[oauth.ts]"]
  node_page_routes["Page routes<br/>[pages.ts]"]
  node_oauth_callback["OAuth callback<br/>[oauthController.ts]"]
  node_oauth_helper["OAuth helper<br/>[oauthHelper.ts]"]
end

node_operator(("Bot operator"))
node_discord(("Discord"))
node_gmail(("Gmail"))

node_operator -.->|"starts"| node_runtime
node_runtime -->|"fetches recent"| node_recent_fetch
node_runtime -->|"starts watching"| node_mail_watcher
node_recent_fetch -->|"creates client"| node_imap_client
node_mail_watcher -->|"uses client"| node_imap_client
node_imap_client -->|"gets credentials"| node_token_store
node_recent_fetch -->|"parses messages"| node_mailparser
node_runtime -->|"checks filter"| node_config
node_runtime -->|"formats email"| node_email_card
node_runtime -->|"builds menu"| node_config_menu
node_config_menu -->|"reads settings"| node_config
node_runtime -->|"sends notifications"| node_discord
node_gmail -->|"provides inbox"| node_imap_client
node_operator -.->|"starts authentication"| node_oauth_bootstrap
node_oauth_bootstrap -->|"starts server"| node_web_server
node_web_server -->|"mounts routes"| node_oauth_routes
node_web_server -->|"mounts routes"| node_page_routes
node_oauth_routes -->|"routes callback"| node_oauth_callback
node_oauth_callback -->|"exchanges code"| node_oauth_helper
node_oauth_helper -->|"writes tokens"| node_token_store
node_token_store -->|"refreshes credentials"| node_gmail
node_page_routes -->|"gets OAuth URL"| node_oauth_helper

click node_runtime "https://github.com/fayzeen/exolt/blob/main/src/index.ts"
click node_config "https://github.com/fayzeen/exolt/blob/main/src/commands/config/config.ts"
click node_config_menu "https://github.com/fayzeen/exolt/blob/main/src/commands/config/builder/mainMenus.ts"
click node_email_card "https://github.com/fayzeen/exolt/blob/main/src/mail/emailDisplay.ts"
click node_recent_fetch "https://github.com/fayzeen/exolt/blob/main/src/imap/fetcher.ts"
click node_mail_watcher "https://github.com/fayzeen/exolt/blob/main/src/imap/watcher.ts"
click node_imap_client "https://github.com/fayzeen/exolt/blob/main/src/imap/imapClient.ts"
click node_token_store "https://github.com/fayzeen/exolt/blob/main/src/auth/token.ts"
click node_oauth_bootstrap "https://github.com/fayzeen/exolt/blob/main/src/auth/authenticate.ts"
click node_web_server "https://github.com/fayzeen/exolt/blob/main/src/web/server.ts"
click node_oauth_routes "https://github.com/fayzeen/exolt/blob/main/src/web/routes/oauth.ts"
click node_page_routes "https://github.com/fayzeen/exolt/blob/main/src/web/routes/pages.ts"
click node_oauth_callback "https://github.com/fayzeen/exolt/blob/main/src/web/controllers/oauthController.ts"
click node_oauth_helper "https://github.com/fayzeen/exolt/blob/main/src/web/utils/oauthHelper.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_runtime,node_config,node_config_menu,node_email_card toneBlue
class node_recent_fetch,node_mail_watcher,node_imap_client,node_mailparser toneAmber
class node_token_store,node_oauth_bootstrap toneMint
class node_web_server,node_oauth_routes,node_page_routes,node_oauth_callback,node_oauth_helper toneRose
class node_operator,node_discord,node_gmail toneIndigo
```

## Components

### Discord bot

- [Bot runtime](https://github.com/fayzeen/exolt/blob/main/src/index.ts): `src/index.ts`
- [Bot settings](https://github.com/fayzeen/exolt/blob/main/src/commands/config/config.ts): `src/commands/config/config.ts`
- [Config menu](https://github.com/fayzeen/exolt/blob/main/src/commands/config/builder/mainMenus.ts): `src/commands/config/builder/mainMenus.ts`
- [Email formatter](https://github.com/fayzeen/exolt/blob/main/src/mail/emailDisplay.ts): `src/mail/emailDisplay.ts`

### Mail ingestion

- [Recent mail fetch](https://github.com/fayzeen/exolt/blob/main/src/imap/fetcher.ts): `src/imap/fetcher.ts`
- [New mail watcher](https://github.com/fayzeen/exolt/blob/main/src/imap/watcher.ts): `src/imap/watcher.ts`
- [IMAP client](https://github.com/fayzeen/exolt/blob/main/src/imap/imapClient.ts): `src/imap/imapClient.ts`
- **MailParser**

### Authentication

- [Token file](https://github.com/fayzeen/exolt/blob/main/src/auth/token.ts): `src/auth/token.ts`
- [OAuth bootstrap](https://github.com/fayzeen/exolt/blob/main/src/auth/authenticate.ts): `src/auth/authenticate.ts`

### OAuth web flow

- [Web server](https://github.com/fayzeen/exolt/blob/main/src/web/server.ts): `src/web/server.ts`
- [OAuth routes](https://github.com/fayzeen/exolt/blob/main/src/web/routes/oauth.ts): `src/web/routes/oauth.ts`
- [Page routes](https://github.com/fayzeen/exolt/blob/main/src/web/routes/pages.ts): `src/web/routes/pages.ts`
- [OAuth callback](https://github.com/fayzeen/exolt/blob/main/src/web/controllers/oauthController.ts): `src/web/controllers/oauthController.ts`
- [OAuth helper](https://github.com/fayzeen/exolt/blob/main/src/web/utils/oauthHelper.ts): `src/web/utils/oauthHelper.ts`

### Other components

- **Bot operator**
- **Discord**
- **Gmail**

## Connections

- Bot operator → Bot runtime: starts
- Bot runtime → Recent mail fetch: fetches recent (evidence: `src/index.ts`)
- Bot runtime → New mail watcher: starts watching (evidence: `src/index.ts`)
- Recent mail fetch → IMAP client: creates client (evidence: `src/imap/fetcher.ts`)
- New mail watcher → IMAP client: uses client (evidence: `src/imap/watcher.ts`)
- IMAP client → Token file: gets credentials (evidence: `src/imap/imapClient.ts`)
- Recent mail fetch → MailParser: parses messages (evidence: `src/imap/fetcher.ts`)
- Bot runtime → Bot settings: checks filter (evidence: `src/index.ts`)
- Bot runtime → Email formatter: formats email (evidence: `src/index.ts`)
- Bot runtime → Config menu: builds menu (evidence: `src/index.ts`)
- Config menu → Bot settings: reads settings (evidence: `src/commands/config/builder/mainMenus.ts`)
- Bot runtime → Discord: sends notifications (evidence: `src/index.ts`)
- Gmail → IMAP client: provides inbox (evidence: `README.md`)
- Bot operator → OAuth bootstrap: starts authentication
- OAuth bootstrap → Web server: starts server (evidence: `src/auth/authenticate.ts`)
- Web server → OAuth routes: mounts routes (evidence: `src/web/server.ts`)
- Web server → Page routes: mounts routes (evidence: `src/web/server.ts`)
- OAuth routes → OAuth callback: routes callback (evidence: `src/web/routes/oauth.ts`)
- OAuth callback → OAuth helper: exchanges code (evidence: `src/web/controllers/oauthController.ts`)
- OAuth helper → Token file: writes tokens (evidence: `src/web/utils/oauthHelper.ts`)
- Token file → Gmail: refreshes credentials (evidence: `src/auth/token.ts`)
- Page routes → OAuth helper: gets OAuth URL (evidence: `src/web/routes/pages.ts`)
