# quanq026/akaine architecture

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

- Interactive diagram: https://gitdiagram.com/quanq026/akaine
- Repository: https://github.com/quanq026/akaine

## Overview

Akaine is a self-hostable Arcaea private-server platform paired with version-specific Android patches and an ADB semantic CLI. The player workflow is client authentication, game/API requests, account and gameplay processing, then persistence or content delivery; administrators manage accounts and content through the web interface, while Link Play has a separate realtime service. The repository also includes Android package verification. Unsampled server feature modules are retained at their exact directories based on the README, but their internal call paths are not inferred.

Main entry points: [`server/main.py`](https://github.com/quanq026/akaine/blob/main/server/main.py) (HTTP application), [`akaine_cli/transport.py`](https://github.com/quanq026/akaine/blob/main/akaine_cli/transport.py) (CLI transport), [`server/core/sql.py`](https://github.com/quanq026/akaine/blob/main/server/core/sql.py) (SQLite access), [`patches/arcaea-7.3.1-arm64/cli/cli_runtime73.cpp`](https://github.com/quanq026/akaine/blob/main/patches/arcaea-7.3.1-arm64/cli/cli_runtime73.cpp) (CLI runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Game server"]
  node_server_app["HTTP application<br/>[main.py]"]
  node_api["Game API"]
  node_game_routes["Game routes"]
  node_auth["Session auth<br/>[auth.py]"]
  node_user_domain["Accounts and gameplay<br/>[user.py]"]
  node_score["Scores and potential<br/>[score.py]"]
  node_content["Bundles and downloads<br/>[bundle.py]"]
  node_pack_contract["Client compatibility<br/>[client_compat.py]"]
  node_dynamic_packs["Dynamic pack catalogue<br/>[client_packs.py]"]
  node_database[("SQLite access<br/>[sql.py]")]
  node_admin_web["Admin web<br/>[index.py]"]
end

subgraph group_services["Server services"]
  node_linkplay["Link Play transport<br/>[main.py]"]
  node_discord["Discord bot<br/>[discord_bot.py]"]
  node_asset_worker["Protected assets<br/>[worker.mjs]"]
end

subgraph group_client["Client tools"]
  node_apk_verify["APK verification<br/>[android.py]"]
  node_cli_transport["CLI transport<br/>[transport.py]"]
  node_cli_protocol["CLI protocol<br/>[protocol.py]"]
end

subgraph group_patches["Android patches"]
  node_cli_bridge["Native CLI bridge<br/>[cli_bridge.h]"]
  node_cli_runtime["CLI runtime<br/>[cli_runtime73.cpp]"]
  node_native_charts["Native chart support<br/>[akfc_loader.cpp]"]
  node_patch_tree["Client feature patches<br/>[native]"]
end

node_player(("Player client"))
node_admin(("Administrator"))

node_player -->|"sends requests"| node_server_app
node_server_app -->|"registers routes"| node_api
node_server_app -->|"registers routes"| node_game_routes
node_player -->|"authenticates"| node_auth
node_auth -->|"authenticates user"| node_user_domain
node_user_domain -->|"reads and writes"| node_database
node_score -.->|"persists scores"| node_database
node_server_app -->|"serves downloads"| node_content
node_content -.->|"checks compatibility"| node_pack_contract
node_dynamic_packs -->|"checks version"| node_pack_contract
node_admin -->|"manages server"| node_admin_web
node_admin_web -->|"queries records"| node_database
node_player -->|"joins sessions"| node_linkplay
node_player -->|"uses bot features"| node_discord
node_player -.->|"requests protected assets"| node_asset_worker
node_player -->|"issues ADB commands"| node_cli_transport
node_cli_transport -->|"validates messages"| node_cli_protocol
node_cli_transport -.->|"communicates with"| node_cli_bridge
node_cli_runtime -->|"uses bridge"| node_cli_bridge
node_cli_runtime -.->|"implements features"| node_patch_tree
node_player -->|"plays fan charts"| node_native_charts
node_apk_verify -.->|"prepares client input"| node_patch_tree

click node_server_app "https://github.com/quanq026/akaine/blob/main/server/main.py"
click node_api "https://github.com/quanq026/akaine/tree/main/server/api"
click node_game_routes "https://github.com/quanq026/akaine/tree/main/server/server"
click node_auth "https://github.com/quanq026/akaine/blob/main/server/server/auth.py"
click node_user_domain "https://github.com/quanq026/akaine/blob/main/server/core/user.py"
click node_score "https://github.com/quanq026/akaine/blob/main/server/core/score.py"
click node_content "https://github.com/quanq026/akaine/blob/main/server/core/bundle.py"
click node_pack_contract "https://github.com/quanq026/akaine/blob/main/server/core/client_compat.py"
click node_dynamic_packs "https://github.com/quanq026/akaine/blob/main/server/core/client_packs.py"
click node_database "https://github.com/quanq026/akaine/blob/main/server/core/sql.py"
click node_admin_web "https://github.com/quanq026/akaine/blob/main/server/web/index.py"
click node_linkplay "https://github.com/quanq026/akaine/blob/main/server/linkplay_server/main.py"
click node_discord "https://github.com/quanq026/akaine/blob/main/server/tools/discord_bot.py"
click node_asset_worker "https://github.com/quanq026/akaine/blob/main/cloudflare/protected-assets/worker.mjs"
click node_apk_verify "https://github.com/quanq026/akaine/blob/main/akaine_build/android.py"
click node_cli_transport "https://github.com/quanq026/akaine/blob/main/akaine_cli/transport.py"
click node_cli_protocol "https://github.com/quanq026/akaine/blob/main/akaine_cli/protocol.py"
click node_cli_bridge "https://github.com/quanq026/akaine/blob/main/patches/shared/runtime/semantic/native/cli_bridge.h"
click node_cli_runtime "https://github.com/quanq026/akaine/blob/main/patches/arcaea-7.3.1-arm64/cli/cli_runtime73.cpp"
click node_native_charts "https://github.com/quanq026/akaine/blob/main/patches/shared/native/akfc_loader.cpp"
click node_patch_tree "https://github.com/quanq026/akaine/tree/main/patches/arcaea-7.3.1-arm64/native"

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_server_app,node_api,node_game_routes,node_auth,node_user_domain,node_score,node_content,node_pack_contract,node_dynamic_packs,node_database,node_admin_web,node_player toneBlue
class node_linkplay,node_discord,node_asset_worker toneAmber
class node_apk_verify,node_cli_transport,node_cli_protocol toneMint
class node_cli_bridge,node_cli_runtime,node_native_charts,node_patch_tree toneRose
class node_admin toneIndigo
```

## Components

### Game server

- [HTTP application](https://github.com/quanq026/akaine/blob/main/server/main.py): `server/main.py`
- [Game API](https://github.com/quanq026/akaine/tree/main/server/api): `server/api`
- [Game routes](https://github.com/quanq026/akaine/tree/main/server/server): `server/server`
- [Session auth](https://github.com/quanq026/akaine/blob/main/server/server/auth.py): `server/server/auth.py`
- [Accounts and gameplay](https://github.com/quanq026/akaine/blob/main/server/core/user.py): `server/core/user.py`
- [Scores and potential](https://github.com/quanq026/akaine/blob/main/server/core/score.py): `server/core/score.py`
- [Bundles and downloads](https://github.com/quanq026/akaine/blob/main/server/core/bundle.py): `server/core/bundle.py`
- [Client compatibility](https://github.com/quanq026/akaine/blob/main/server/core/client_compat.py): `server/core/client_compat.py`
- [Dynamic pack catalogue](https://github.com/quanq026/akaine/blob/main/server/core/client_packs.py): `server/core/client_packs.py`
- [SQLite access](https://github.com/quanq026/akaine/blob/main/server/core/sql.py): `server/core/sql.py`
- [Admin web](https://github.com/quanq026/akaine/blob/main/server/web/index.py): `server/web/index.py`

### Server services

- [Link Play transport](https://github.com/quanq026/akaine/blob/main/server/linkplay_server/main.py): `server/linkplay_server/main.py`
- [Discord bot](https://github.com/quanq026/akaine/blob/main/server/tools/discord_bot.py): `server/tools/discord_bot.py`
- [Protected assets](https://github.com/quanq026/akaine/blob/main/cloudflare/protected-assets/worker.mjs): `cloudflare/protected-assets/worker.mjs`

### Client tools

- [APK verification](https://github.com/quanq026/akaine/blob/main/akaine_build/android.py): `akaine_build/android.py`
- [CLI transport](https://github.com/quanq026/akaine/blob/main/akaine_cli/transport.py): `akaine_cli/transport.py`
- [CLI protocol](https://github.com/quanq026/akaine/blob/main/akaine_cli/protocol.py): `akaine_cli/protocol.py`

### Android patches

- [Native CLI bridge](https://github.com/quanq026/akaine/blob/main/patches/shared/runtime/semantic/native/cli_bridge.h): `patches/shared/runtime/semantic/native/cli_bridge.h`
- [CLI runtime](https://github.com/quanq026/akaine/blob/main/patches/arcaea-7.3.1-arm64/cli/cli_runtime73.cpp): `patches/arcaea-7.3.1-arm64/cli/cli_runtime73.cpp`
- [Native chart support](https://github.com/quanq026/akaine/blob/main/patches/shared/native/akfc_loader.cpp): `patches/shared/native/akfc_loader.cpp`
- [Client feature patches](https://github.com/quanq026/akaine/tree/main/patches/arcaea-7.3.1-arm64/native): `patches/arcaea-7.3.1-arm64/native`

### Other components

- **Player client**
- **Administrator**

## Connections

- Player client → HTTP application: sends requests
- HTTP application → Game API: registers routes (evidence: `server/main.py`)
- HTTP application → Game routes: registers routes (evidence: `server/main.py`)
- Player client → Session auth: authenticates
- Session auth → Accounts and gameplay: authenticates user (evidence: `server/server/auth.py`)
- Accounts and gameplay → SQLite access: reads and writes (evidence: `server/core/user.py`)
- Scores and potential → SQLite access: persists scores
- HTTP application → Bundles and downloads: serves downloads (evidence: `server/main.py`)
- Bundles and downloads → Client compatibility: checks compatibility
- Dynamic pack catalogue → Client compatibility: checks version (evidence: `server/core/client_packs.py`)
- Administrator → Admin web: manages server
- Admin web → SQLite access: queries records (evidence: `server/web/index.py`)
- Player client → Link Play transport: joins sessions
- Player client → Discord bot: uses bot features
- Player client → Protected assets: requests protected assets
- Player client → CLI transport: issues ADB commands
- CLI transport → CLI protocol: validates messages (evidence: `akaine_cli/transport.py`)
- CLI transport → Native CLI bridge: communicates with
- CLI runtime → Native CLI bridge: uses bridge (evidence: `patches/arcaea-7.3.1-arm64/cli/cli_runtime73.cpp`)
- CLI runtime → Client feature patches: implements features
- Player client → Native chart support: plays fan charts
- APK verification → Client feature patches: prepares client input
