# kikysena13/app-bot architecture

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

## Overview

Discord Command Center combines an Expo mobile control panel, an Express API, and Discord bot functionality. The visible API supports OAuth sessions, guild and member data, activity leaderboards, settings, and health checks; the backend also handles Discord events and persists activity. The dashboard’s sampled sign-in screen calls a service module absent from the supplied tree, so no frontend-to-API edge is asserted. Some backend routes and event handlers are only partially excerpted; edges reflect the shown calls or README claims.

Main entry points: [`backend/src/server.ts`](https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts) (Express API), [`frontend/src/app/_layout.tsx`](https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/_layout.tsx) (Expo app), [`frontend/src/components/app-tabs.web.tsx`](https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/app-tabs.web.tsx) (Web tab navigation), [`backend`](https://github.com/kikysena13/app-bot/tree/main/backend) (MySQL data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile dashboard"]
  node_mobile["Expo app<br/>[_layout.tsx]"]
  node_signin["Sign-in screen<br/>[index.tsx]"]
  node_dashboard["Dashboard route<br/>[dashboard.tsx]"]
  node_explore["Explore route<br/>[explore.tsx]"]
end

subgraph group_api["API and sessions"]
  node_api["Express API<br/>[server.ts]"]
  node_auth["OAuth sessions<br/>[server.ts]"]
  node_guilddata["Guild and member routes<br/>[server.ts]"]
  node_activity["Activity and settings<br/>[server.ts]"]
  node_health["Health endpoint<br/>[server.ts]"]
  node_store[("MySQL data")]
end

subgraph group_discord["Discord operations"]
  node_gateway["Discord gateway client<br/>[server.ts]"]
  node_bot["Standalone bot<br/>[index.js]"]
end

subgraph group_presentation["Shared presentation"]
  node_themedtext["Themed text<br/>[themed-text.tsx]"]
  node_themedview["Themed view<br/>[themed-view.tsx]"]
  node_theme["Theme settings<br/>[theme.ts]"]
  node_tabweb["Web tab navigation<br/>[app-tabs.web.tsx]"]
  node_external["External link<br/>[external-link.tsx]"]
end

node_moderator(("Server moderator"))
node_discordapi["Discord services"]

node_moderator -->|"opens"| node_mobile
node_mobile -.->|"routes to"| node_signin
node_mobile -.->|"routes to"| node_dashboard
node_mobile -.->|"routes to"| node_explore
node_moderator -->|"checks health"| node_api
node_api -->|"serves"| node_health
node_api -->|"routes"| node_auth
node_auth -->|"exchanges OAuth"| node_discordapi
node_api -->|"routes"| node_guilddata
node_guilddata -->|"fetches guild data"| node_discordapi
node_api -->|"routes"| node_activity
node_guilddata -->|"persists members"| node_store
node_activity -->|"reads and writes"| node_store
node_gateway -->|"connects"| node_discordapi
node_gateway -->|"records activity"| node_store
node_bot -->|"logs in"| node_discordapi
node_signin -.->|"checks session"| node_auth
node_tabweb -->|"renders"| node_themedtext
node_tabweb -->|"renders"| node_themedview
node_tabweb -->|"renders"| node_external
node_themedtext -->|"uses"| node_theme
node_themedview -->|"uses"| node_theme

click node_mobile "https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/_layout.tsx"
click node_signin "https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/index.tsx"
click node_dashboard "https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/dashboard.tsx"
click node_explore "https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/explore.tsx"
click node_api "https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts"
click node_auth "https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts"
click node_guilddata "https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts"
click node_activity "https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts"
click node_health "https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts"
click node_store "https://github.com/kikysena13/app-bot/tree/main/backend"
click node_gateway "https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts"
click node_bot "https://github.com/kikysena13/app-bot/blob/main/index.js"
click node_themedtext "https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/themed-text.tsx"
click node_themedview "https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/themed-view.tsx"
click node_theme "https://github.com/kikysena13/app-bot/blob/main/frontend/src/constants/theme.ts"
click node_tabweb "https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/app-tabs.web.tsx"
click node_external "https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/external-link.tsx"

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_mobile,node_signin,node_dashboard,node_explore toneBlue
class node_api,node_auth,node_guilddata,node_activity,node_health,node_store toneAmber
class node_gateway,node_bot,node_moderator toneMint
class node_themedtext,node_themedview,node_theme,node_tabweb,node_external toneRose
class node_discordapi toneIndigo
```

## Components

### Mobile dashboard

- [Expo app](https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/_layout.tsx): `frontend/src/app/_layout.tsx`
- [Sign-in screen](https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/index.tsx): `frontend/src/app/index.tsx`
- [Dashboard route](https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/dashboard.tsx): `frontend/src/app/dashboard.tsx`
- [Explore route](https://github.com/kikysena13/app-bot/blob/main/frontend/src/app/explore.tsx): `frontend/src/app/explore.tsx`

### API and sessions

- [Express API](https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [OAuth sessions](https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Guild and member routes](https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Activity and settings](https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Health endpoint](https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [MySQL data](https://github.com/kikysena13/app-bot/tree/main/backend): `backend`

### Discord operations

- [Discord gateway client](https://github.com/kikysena13/app-bot/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Standalone bot](https://github.com/kikysena13/app-bot/blob/main/index.js): `index.js`

### Shared presentation

- [Themed text](https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/themed-text.tsx): `frontend/src/components/themed-text.tsx`
- [Themed view](https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/themed-view.tsx): `frontend/src/components/themed-view.tsx`
- [Theme settings](https://github.com/kikysena13/app-bot/blob/main/frontend/src/constants/theme.ts): `frontend/src/constants/theme.ts`
- [Web tab navigation](https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/app-tabs.web.tsx): `frontend/src/components/app-tabs.web.tsx`
- [External link](https://github.com/kikysena13/app-bot/blob/main/frontend/src/components/external-link.tsx): `frontend/src/components/external-link.tsx`

### Other components

- **Server moderator**
- **Discord services**

## Connections

- Server moderator → Expo app: opens (evidence: `README.md`)
- Expo app → Sign-in screen: routes to
- Expo app → Dashboard route: routes to
- Expo app → Explore route: routes to
- Server moderator → Express API: checks health (evidence: `README.md`)
- Express API → Health endpoint: serves (evidence: `backend/src/server.ts`)
- Express API → OAuth sessions: routes (evidence: `backend/src/server.ts`)
- OAuth sessions → Discord services: exchanges OAuth (evidence: `backend/src/server.ts`)
- Express API → Guild and member routes: routes (evidence: `backend/src/server.ts`)
- Guild and member routes → Discord services: fetches guild data (evidence: `backend/src/server.ts`)
- Express API → Activity and settings: routes (evidence: `backend/src/server.ts`)
- Guild and member routes → MySQL data: persists members (evidence: `backend/src/server.ts`)
- Activity and settings → MySQL data: reads and writes (evidence: `backend/src/server.ts`)
- Discord gateway client → Discord services: connects (evidence: `README.md`)
- Discord gateway client → MySQL data: records activity (evidence: `backend/src/server.ts`)
- Standalone bot → Discord services: logs in (evidence: `index.js`)
- Sign-in screen → OAuth sessions: checks session
- Web tab navigation → Themed text: renders (evidence: `frontend/src/components/app-tabs.web.tsx`)
- Web tab navigation → Themed view: renders (evidence: `frontend/src/components/app-tabs.web.tsx`)
- Web tab navigation → External link: renders (evidence: `frontend/src/components/app-tabs.web.tsx`)
- Themed text → Theme settings: uses (evidence: `frontend/src/components/themed-text.tsx`)
- Themed view → Theme settings: uses (evidence: `frontend/src/components/themed-view.tsx`)
