# cellixx7/cylbot architecture

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

## Overview

CylBot combines a Discord bot, an HTTP API, and a web dashboard. The principal web workflow is a user opening the site, optionally authenticating with Discord, then using dashboard and ticket features through the bot API; ticket operations interact with Discord and persistence. The repository also includes announcements, community previews, profiles, AI text features, and bot presence integrations. Edges are limited to relationships visible in excerpts, the SOURCE INDEX, or README; several unsampled feature internals are represented at their source-directory level.

Main entry points: [`bot/src/api/server.js`](https://github.com/cellixx7/cylbot/blob/main/bot/src/api/server.js) (HTTP API server), [`web/vite.config.js`](https://github.com/cellixx7/cylbot/blob/main/web/vite.config.js) (Web API proxy), [`bot/src/index.js`](https://github.com/cellixx7/cylbot/blob/main/bot/src/index.js) (Bot runtime and events), [`bot/src/app/createServices.js`](https://github.com/cellixx7/cylbot/blob/main/bot/src/app/createServices.js) (Service composition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Web application<br/>[App.jsx]"]
  node_auth_ui["Web authentication<br/>[useAuth.js]"]
  node_dashboard_ui["Dashboard and pages"]
  node_ticket_ui["Ticket workspace"]
  node_announcements_ui["Announcements workspace"]
  node_web_proxy["Web API proxy<br/>[vite.config.js]"]
end

subgraph group_api["API and identity"]
  node_api_server["HTTP API server<br/>[server.js]"]
  node_auth_routes["OAuth routes<br/>[authRoutes.js]"]
  node_http_auth["Session checks<br/>[auth.js]"]
  node_announcement_routes["Announcement routes"]
  node_community_routes["Community preview"]
end

subgraph group_tickets["Ticket operations"]
  node_ticket_routes["Ticket API routes"]
  node_ticket_services["Ticket services"]
  node_ticket_adapter["Discord ticket adapter"]
  node_ticket_store[("Ticket repositories")]
end

subgraph group_bot["Discord bot"]
  node_bot_runtime["Bot runtime and events<br/>[index.js]"]
  node_presence["Bot presence<br/>[presenceManager.js]"]
end

subgraph group_services["Product services"]
  node_database[("PostgreSQL<br/>[schema.js]")]
  node_service_factory["Service composition<br/>[createServices.js]"]
  node_announcement_service["Announcement service"]
  node_ai_service["AI services"]
end

node_visitor(("Web user"))
node_discord(("Discord"))
node_spotify(("Spotify"))

node_visitor -->|"opens"| node_webapp
node_webapp -->|"checks login"| node_auth_ui
node_auth_ui -->|"requests session"| node_web_proxy
node_webapp -->|"renders pages"| node_dashboard_ui
node_dashboard_ui -.->|"calls API"| node_web_proxy
node_ticket_ui -.->|"calls API"| node_web_proxy
node_announcements_ui -.->|"calls API"| node_web_proxy
node_web_proxy -->|"forwards /api"| node_api_server
node_api_server -->|"dispatches"| node_auth_routes
node_api_server -->|"dispatches"| node_ticket_routes
node_api_server -->|"dispatches"| node_community_routes
node_api_server -.->|"dispatches"| node_announcement_routes
node_auth_routes -->|"checks sessions"| node_http_auth
node_ticket_routes -->|"checks sessions"| node_http_auth
node_ticket_routes -->|"invokes operations"| node_ticket_services
node_ticket_services -.->|"uses Discord"| node_ticket_adapter
node_ticket_services -.->|"persists tickets"| node_ticket_store
node_ticket_store -->|"reads and writes"| node_database
node_service_factory -->|"selects repository"| node_ticket_store
node_service_factory -->|"creates adapter"| node_ticket_adapter
node_service_factory -->|"creates service"| node_announcement_service
node_announcement_routes -->|"handles announcements"| node_announcement_service
node_announcement_service -.->|"uses AI"| node_ai_service
node_bot_runtime -->|"creates services"| node_service_factory
node_bot_runtime -->|"starts API"| node_api_server
node_bot_runtime -->|"connects bot"| node_discord
node_bot_runtime -.->|"configures presence"| node_presence
node_presence -->|"fetches playback"| node_spotify
node_community_routes -->|"fetches channel posts"| node_discord

click node_webapp "https://github.com/cellixx7/cylbot/blob/main/web/src/App.jsx"
click node_auth_ui "https://github.com/cellixx7/cylbot/blob/main/web/src/auth/useAuth.js"
click node_dashboard_ui "https://github.com/cellixx7/cylbot/tree/main/web/src/dashboard"
click node_ticket_ui "https://github.com/cellixx7/cylbot/tree/main/web/src/tickets"
click node_announcements_ui "https://github.com/cellixx7/cylbot/tree/main/web/src/announcements"
click node_web_proxy "https://github.com/cellixx7/cylbot/blob/main/web/vite.config.js"
click node_api_server "https://github.com/cellixx7/cylbot/blob/main/bot/src/api/server.js"
click node_auth_routes "https://github.com/cellixx7/cylbot/blob/main/bot/src/api/routes/authRoutes.js"
click node_http_auth "https://github.com/cellixx7/cylbot/blob/main/bot/src/api/http/auth.js"
click node_announcement_routes "https://github.com/cellixx7/cylbot/blob/main/bot/src/api/routes/announcementRoutes.js"
click node_community_routes "https://github.com/cellixx7/cylbot/blob/main/bot/src/api/routes/communityPreviewRoutes.js"
click node_ticket_routes "https://github.com/cellixx7/cylbot/tree/main/bot/src/Ticket/api"
click node_ticket_services "https://github.com/cellixx7/cylbot/tree/main/bot/src/Ticket/services"
click node_ticket_adapter "https://github.com/cellixx7/cylbot/blob/main/bot/src/Ticket/providers/discordTicketAdapter.js"
click node_ticket_store "https://github.com/cellixx7/cylbot/tree/main/bot/src/Ticket/repositories"
click node_database "https://github.com/cellixx7/cylbot/blob/main/bot/src/database/schema.js"
click node_service_factory "https://github.com/cellixx7/cylbot/blob/main/bot/src/app/createServices.js"
click node_announcement_service "https://github.com/cellixx7/cylbot/blob/main/bot/src/services/announcementService.js"
click node_ai_service "https://github.com/cellixx7/cylbot/blob/main/bot/src/services/openRouterService.js"
click node_bot_runtime "https://github.com/cellixx7/cylbot/blob/main/bot/src/index.js"
click node_presence "https://github.com/cellixx7/cylbot/blob/main/bot/src/services/presenceManager.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_webapp,node_auth_ui,node_dashboard_ui,node_ticket_ui,node_announcements_ui,node_web_proxy,node_visitor toneBlue
class node_api_server,node_auth_routes,node_http_auth,node_announcement_routes,node_community_routes toneAmber
class node_ticket_routes,node_ticket_services,node_ticket_adapter,node_ticket_store toneMint
class node_bot_runtime,node_presence toneRose
class node_database,node_service_factory,node_announcement_service,node_ai_service,node_discord,node_spotify toneIndigo
```

## Components

### Web experience

- [Web application](https://github.com/cellixx7/cylbot/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Web authentication](https://github.com/cellixx7/cylbot/blob/main/web/src/auth/useAuth.js): `web/src/auth/useAuth.js`
- [Dashboard and pages](https://github.com/cellixx7/cylbot/tree/main/web/src/dashboard): `web/src/dashboard`
- [Ticket workspace](https://github.com/cellixx7/cylbot/tree/main/web/src/tickets): `web/src/tickets`
- [Announcements workspace](https://github.com/cellixx7/cylbot/tree/main/web/src/announcements): `web/src/announcements`
- [Web API proxy](https://github.com/cellixx7/cylbot/blob/main/web/vite.config.js): `web/vite.config.js`

### API and identity

- [HTTP API server](https://github.com/cellixx7/cylbot/blob/main/bot/src/api/server.js): `bot/src/api/server.js`
- [OAuth routes](https://github.com/cellixx7/cylbot/blob/main/bot/src/api/routes/authRoutes.js): `bot/src/api/routes/authRoutes.js`
- [Session checks](https://github.com/cellixx7/cylbot/blob/main/bot/src/api/http/auth.js): `bot/src/api/http/auth.js`
- [Announcement routes](https://github.com/cellixx7/cylbot/blob/main/bot/src/api/routes/announcementRoutes.js): `bot/src/api/routes/announcementRoutes.js`
- [Community preview](https://github.com/cellixx7/cylbot/blob/main/bot/src/api/routes/communityPreviewRoutes.js): `bot/src/api/routes/communityPreviewRoutes.js`

### Ticket operations

- [Ticket API routes](https://github.com/cellixx7/cylbot/tree/main/bot/src/Ticket/api): `bot/src/Ticket/api`
- [Ticket services](https://github.com/cellixx7/cylbot/tree/main/bot/src/Ticket/services): `bot/src/Ticket/services`
- [Discord ticket adapter](https://github.com/cellixx7/cylbot/blob/main/bot/src/Ticket/providers/discordTicketAdapter.js): `bot/src/Ticket/providers/discordTicketAdapter.js`
- [Ticket repositories](https://github.com/cellixx7/cylbot/tree/main/bot/src/Ticket/repositories): `bot/src/Ticket/repositories`

### Discord bot

- [Bot runtime and events](https://github.com/cellixx7/cylbot/blob/main/bot/src/index.js): `bot/src/index.js`
- [Bot presence](https://github.com/cellixx7/cylbot/blob/main/bot/src/services/presenceManager.js): `bot/src/services/presenceManager.js`

### Product services

- [PostgreSQL](https://github.com/cellixx7/cylbot/blob/main/bot/src/database/schema.js): `bot/src/database/schema.js`
- [Service composition](https://github.com/cellixx7/cylbot/blob/main/bot/src/app/createServices.js): `bot/src/app/createServices.js`
- [Announcement service](https://github.com/cellixx7/cylbot/blob/main/bot/src/services/announcementService.js): `bot/src/services/announcementService.js`
- [AI services](https://github.com/cellixx7/cylbot/blob/main/bot/src/services/openRouterService.js): `bot/src/services/openRouterService.js`

### Other components

- **Web user**
- **Discord**
- **Spotify**

## Connections

- Web user → Web application: opens (evidence: `README.md`)
- Web application → Web authentication: checks login (evidence: `web/src/App.jsx`)
- Web authentication → Web API proxy: requests session (evidence: `web/src/auth/useAuth.js`)
- Web application → Dashboard and pages: renders pages (evidence: `web/src/App.jsx`)
- Dashboard and pages → Web API proxy: calls API
- Ticket workspace → Web API proxy: calls API
- Announcements workspace → Web API proxy: calls API
- Web API proxy → HTTP API server: forwards /api (evidence: `README.md`)
- HTTP API server → OAuth routes: dispatches (evidence: `bot/src/api/server.js`)
- HTTP API server → Ticket API routes: dispatches (evidence: `bot/src/api/server.js`)
- HTTP API server → Community preview: dispatches (evidence: `bot/src/api/server.js`)
- HTTP API server → Announcement routes: dispatches (evidence: `bot/src/api/server.js`)
- OAuth routes → Session checks: checks sessions (evidence: `bot/src/api/routes/authRoutes.js`)
- Ticket API routes → Session checks: checks sessions (evidence: `bot/src/Ticket/api/ticketMessageRoutes.js`)
- Ticket API routes → Ticket services: invokes operations (evidence: `bot/src/Ticket/api/ticketMessageRoutes.js`)
- Ticket services → Discord ticket adapter: uses Discord
- Ticket services → Ticket repositories: persists tickets
- Ticket repositories → PostgreSQL: reads and writes (evidence: `bot/src/Ticket/repositories/postgresTicketRepository.js`)
- Service composition → Ticket repositories: selects repository (evidence: `bot/src/app/createServices.js`)
- Service composition → Discord ticket adapter: creates adapter (evidence: `bot/src/app/createServices.js`)
- Service composition → Announcement service: creates service (evidence: `bot/src/app/createServices.js`)
- Announcement routes → Announcement service: handles announcements (evidence: `bot/src/api/routes/announcementRoutes.js`)
- Announcement service → AI services: uses AI
- Bot runtime and events → Service composition: creates services (evidence: `bot/src/index.js`)
- Bot runtime and events → HTTP API server: starts API (evidence: `bot/src/index.js`)
- Bot runtime and events → Discord: connects bot (evidence: `README.md`)
- Bot runtime and events → Bot presence: configures presence
- Bot presence → Spotify: fetches playback (evidence: `bot/src/services/presenceManager.js`)
- Community preview → Discord: fetches channel posts (evidence: `bot/src/api/routes/communityPreviewRoutes.js`)
