# shykrachet/alren-discord architecture

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

- Interactive diagram: https://gitdiagram.com/shykrachet/alren-discord
- Repository: https://github.com/shykrachet/alren-discord

## Overview

Alren is a Discord bot whose main workflow routes slash or legacy commands to private chat, osu! account verification, beatmap discovery, or server configuration; scheduled jobs also publish beatmap and community updates. Verification exchanges osu! OAuth data for a linked account and Discord role, while the beatmap and community services produce channel-ready updates. SQLite stores server settings and verification state. The README documents major capabilities that are only partly visible in the sampled source; edges for those documented relationships cite it rather than implying unsampled implementation details.

Main entry points: [`index.js`](https://github.com/shykrachet/alren-discord/blob/latest-version/index.js) (Bot runtime), [`src/osu-verification.js`](https://github.com/shykrachet/alren-discord/blob/latest-version/src/osu-verification.js) (Account verification), [`src/osu-maps.js`](https://github.com/shykrachet/alren-discord/blob/latest-version/src/osu-maps.js) (Beatmap discovery), [`src/slash-commands.js`](https://github.com/shykrachet/alren-discord/blob/latest-version/src/slash-commands.js) (Slash commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot_runtime["Bot runtime<br/>[index.js]"]
end

subgraph group_interaction["Discord interactions"]
  node_slash_commands["Slash commands<br/>[slash-commands.js]"]
  node_message_handler["Legacy commands<br/>[message-handler.js]"]
end

subgraph group_osu["osu! services"]
  node_verification["Account verification"]
  node_beatmap_service["Beatmap discovery<br/>[osu-maps.js]"]
end

subgraph group_community["Community alerts"]
  node_community_service["Community monitoring"]
  node_alerts_api["Alerts endpoint"]
end

subgraph group_shared["Shared services"]
  node_chat_service["Private AI chat<br/>[chat.js]"]
  node_persona["Chat persona<br/>[persona.js]"]
  node_mode_icons["Mode icons<br/>[mode-icons.js]"]
  node_configuration["Runtime configuration<br/>[config.js]"]
  node_store[("SQLite storage<br/>[sqlite-store.js]")]
end

node_discord_users(("Discord users"))
node_discord(("Discord platform"))
node_osu_api(("osu! API"))
node_ai_provider(("AI provider"))
node_community_apis(("BN / Guild APIs"))

node_discord_users -->|"issue commands"| node_discord
node_discord -->|"deliver events"| node_bot_runtime
node_bot_runtime -->|"dispatch interactions"| node_slash_commands
node_bot_runtime -->|"dispatch messages"| node_message_handler
node_slash_commands -->|"start verification"| node_verification
node_slash_commands -->|"request maps"| node_beatmap_service
node_slash_commands -->|"start chat"| node_chat_service
node_message_handler -->|"request replies"| node_chat_service
node_message_handler -->|"request maps"| node_beatmap_service
node_message_handler -->|"start verification"| node_verification
node_chat_service -->|"request completion"| node_ai_provider
node_chat_service -->|"use instructions"| node_persona
node_bot_runtime -->|"initialize service"| node_chat_service
node_bot_runtime -->|"initialize service"| node_verification
node_bot_runtime -->|"start feed"| node_beatmap_service
node_bot_runtime -->|"start polling"| node_community_service
node_verification -->|"exchange OAuth"| node_osu_api
node_verification -->|"read and write state"| node_store
node_verification -->|"assign role"| node_discord
node_beatmap_service -->|"search beatmaps"| node_osu_api
node_beatmap_service -->|"read settings"| node_store
node_bot_runtime -->|"post map feeds"| node_discord
node_community_service -->|"fetch updates"| node_community_apis
node_community_service -->|"send alerts"| node_discord
node_community_service -.->|"load alert settings"| node_store
node_community_service -->|"serve cached data"| node_alerts_api
node_bot_runtime -->|"sync icons"| node_mode_icons
node_beatmap_service -->|"format modes"| node_mode_icons
node_bot_runtime -->|"create database"| node_store
node_bot_runtime -->|"load settings"| node_configuration
node_slash_commands -.->|"configure servers"| node_store
node_discord_users -->|"request status"| node_alerts_api

click node_bot_runtime "https://github.com/shykrachet/alren-discord/blob/latest-version/index.js"
click node_slash_commands "https://github.com/shykrachet/alren-discord/blob/latest-version/src/slash-commands.js"
click node_message_handler "https://github.com/shykrachet/alren-discord/blob/latest-version/src/message-handler.js"
click node_verification "https://github.com/shykrachet/alren-discord/blob/latest-version/src/osu-verification.js"
click node_beatmap_service "https://github.com/shykrachet/alren-discord/blob/latest-version/src/osu-maps.js"
click node_community_service "https://github.com/shykrachet/alren-discord/blob/latest-version/src/community-alerts.js"
click node_alerts_api "https://github.com/shykrachet/alren-discord/blob/latest-version/src/community-alerts.js"
click node_chat_service "https://github.com/shykrachet/alren-discord/blob/latest-version/src/chat.js"
click node_persona "https://github.com/shykrachet/alren-discord/blob/latest-version/src/persona.js"
click node_mode_icons "https://github.com/shykrachet/alren-discord/blob/latest-version/src/mode-icons.js"
click node_configuration "https://github.com/shykrachet/alren-discord/blob/latest-version/src/config.js"
click node_store "https://github.com/shykrachet/alren-discord/blob/latest-version/src/sqlite-store.js"

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_runtime,node_discord_users toneBlue
class node_slash_commands,node_message_handler toneAmber
class node_verification,node_beatmap_service,node_osu_api,node_community_apis toneMint
class node_community_service,node_alerts_api toneRose
class node_chat_service,node_persona,node_mode_icons,node_configuration,node_store,node_discord,node_ai_provider toneIndigo
```

## Components

### Bot runtime

- [Bot runtime](https://github.com/shykrachet/alren-discord/blob/latest-version/index.js): `index.js`

### Discord interactions

- [Slash commands](https://github.com/shykrachet/alren-discord/blob/latest-version/src/slash-commands.js): `src/slash-commands.js`
- [Legacy commands](https://github.com/shykrachet/alren-discord/blob/latest-version/src/message-handler.js): `src/message-handler.js`

### osu! services

- [Account verification](https://github.com/shykrachet/alren-discord/blob/latest-version/src/osu-verification.js): `src/osu-verification.js`
- [Beatmap discovery](https://github.com/shykrachet/alren-discord/blob/latest-version/src/osu-maps.js): `src/osu-maps.js`

### Community alerts

- [Community monitoring](https://github.com/shykrachet/alren-discord/blob/latest-version/src/community-alerts.js): `src/community-alerts.js`
- [Alerts endpoint](https://github.com/shykrachet/alren-discord/blob/latest-version/src/community-alerts.js): `src/community-alerts.js`

### Shared services

- [Private AI chat](https://github.com/shykrachet/alren-discord/blob/latest-version/src/chat.js): `src/chat.js`
- [Chat persona](https://github.com/shykrachet/alren-discord/blob/latest-version/src/persona.js): `src/persona.js`
- [Mode icons](https://github.com/shykrachet/alren-discord/blob/latest-version/src/mode-icons.js): `src/mode-icons.js`
- [Runtime configuration](https://github.com/shykrachet/alren-discord/blob/latest-version/src/config.js): `src/config.js`
- [SQLite storage](https://github.com/shykrachet/alren-discord/blob/latest-version/src/sqlite-store.js): `src/sqlite-store.js`

### Other components

- **Discord users**
- **Discord platform**
- **osu! API**
- **AI provider**
- **BN / Guild APIs**

## Connections

- Discord users → Discord platform: issue commands (evidence: `README.md`)
- Discord platform → Bot runtime: deliver events (evidence: `index.js`)
- Bot runtime → Slash commands: dispatch interactions (evidence: `index.js`)
- Bot runtime → Legacy commands: dispatch messages (evidence: `index.js`)
- Slash commands → Account verification: start verification (evidence: `src/slash-commands.js`)
- Slash commands → Beatmap discovery: request maps (evidence: `src/slash-commands.js`)
- Slash commands → Private AI chat: start chat (evidence: `README.md`)
- Legacy commands → Private AI chat: request replies (evidence: `src/message-handler.js`)
- Legacy commands → Beatmap discovery: request maps (evidence: `src/message-handler.js`)
- Legacy commands → Account verification: start verification (evidence: `README.md`)
- Private AI chat → AI provider: request completion (evidence: `src/chat.js`)
- Private AI chat → Chat persona: use instructions (evidence: `src/chat.js`)
- Bot runtime → Private AI chat: initialize service (evidence: `index.js`)
- Bot runtime → Account verification: initialize service (evidence: `index.js`)
- Bot runtime → Beatmap discovery: start feed (evidence: `index.js`)
- Bot runtime → Community monitoring: start polling (evidence: `index.js`)
- Account verification → osu! API: exchange OAuth (evidence: `src/osu-verification.js`)
- Account verification → SQLite storage: read and write state (evidence: `src/osu-verification.js`)
- Account verification → Discord platform: assign role (evidence: `README.md`)
- Beatmap discovery → osu! API: search beatmaps (evidence: `src/osu-maps.js`)
- Beatmap discovery → SQLite storage: read settings (evidence: `src/osu-maps.js`)
- Bot runtime → Discord platform: post map feeds (evidence: `index.js`)
- Community monitoring → BN / Guild APIs: fetch updates (evidence: `src/community-alerts.js`)
- Community monitoring → Discord platform: send alerts
- Community monitoring → SQLite storage: load alert settings
- Community monitoring → Alerts endpoint: serve cached data (evidence: `src/community-alerts.js`)
- Bot runtime → Mode icons: sync icons (evidence: `index.js`)
- Beatmap discovery → Mode icons: format modes (evidence: `src/osu-maps.js`)
- Bot runtime → SQLite storage: create database (evidence: `index.js`)
- Bot runtime → Runtime configuration: load settings (evidence: `index.js`)
- Slash commands → SQLite storage: configure servers
- Discord users → Alerts endpoint: request status (evidence: `README.md`)
