# greepar/bililive architecture

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

- Interactive diagram: https://gitdiagram.com/greepar/bililive
- Repository: https://github.com/greepar/bililive

## Overview

BiliLive is an Avalonia client for Bilibili live-stream tasks, with account login and scheduled streaming/automation as its central workflow. The tree also shows live-room controls, award and sign services, and alternate-account management. Sampled code confirms QR/cookie login, scheduled-task behavior, live-service API operations, configuration persistence, and theme generation; wiring among unsampled pages and services is omitted where it cannot be established.

Main entry points: [`BiliLive/Views/MainWindow/Pages/AutoService/AutoServiceViewModel.cs`](https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Pages/AutoService/AutoServiceViewModel.cs) (Auto service), [`BiliLive.Core/Services/BiliService/AltService.cs`](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/AltService.cs) (Alternate service), [`BiliLive/App.axaml.cs`](https://github.com/greepar/bililive/blob/master/BiliLive/App.axaml.cs) (Application setup), [`BiliLive.Core/Services/BiliService/LoginService.cs`](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/LoginService.cs) (Login service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop experience"]
  node_main["Main view model<br/>[MainViewModel.cs]"]
  node_home["Home page<br/>[HomeViewModel.cs]"]
  node_accounts["Accounts"]
end

subgraph group_automation["Live automation"]
  node_auto["Auto service"]
  node_altmanager["Alternate login"]
  node_ffmpeg["Stream process<br/>[FfmpegWrapper.cs]"]
end

subgraph group_services["Bilibili services"]
  node_biliinterface["Bilibili interface<br/>[IBiliService.cs]"]
  node_altinterface["Alternate interface<br/>[IAltService.cs]"]
  node_altservice["Alternate service<br/>[AltService.cs]"]
  node_login["Login service<br/>[LoginService.cs]"]
  node_live["Live service<br/>[LiveService.cs]"]
  node_award["Award service<br/>[AwardService.cs]"]
  node_sign["Sign service<br/>[SignService.cs]"]
end

subgraph group_platform["App and theme"]
  node_app["Application setup<br/>[App.axaml.cs]"]
  node_config[("Config manager<br/>[ConfigManager.cs]")]
  node_altsettings["Alternate settings<br/>[AltSettings.cs]"]
  node_theme["Theme manager<br/>[ThemeManager.cs]"]
  node_scheme["M3 color scheme<br/>[M3Scheme.cs]"]
end

node_user(("User"))
node_biliapi{{"Bilibili APIs"}}

node_user -->|"uses"| node_main
node_app -->|"resolves"| node_main
node_app -->|"flushes on exit"| node_config
node_altmanager -->|"requests login"| node_altservice
node_altservice -->|"implements"| node_altinterface
node_altservice -->|"uses login"| node_login
node_login -->|"checks login"| node_biliapi
node_altservice -->|"requests QR"| node_biliapi
node_auto -->|"calls tasks"| node_biliinterface
node_auto -->|"interrupts stream"| node_ffmpeg
node_auto -->|"manages accounts"| node_altsettings
node_auto -->|"persists settings"| node_config
node_live -->|"reads and updates"| node_biliapi
node_award -->|"requests awards"| node_biliapi
node_sign -->|"signs requests"| node_biliapi
node_theme -->|"generates palettes"| node_scheme

click node_app "https://github.com/greepar/bililive/blob/master/BiliLive/App.axaml.cs"
click node_main "https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/MainViewModel.cs"
click node_home "https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Pages/HomePage/HomeViewModel.cs"
click node_accounts "https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Controls/AccountsViewModel.cs"
click node_auto "https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Pages/AutoService/AutoServiceViewModel.cs"
click node_altmanager "https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Pages/AutoService/Components/AltManagerViewModel.cs"
click node_config "https://github.com/greepar/bililive/blob/master/BiliLive/Utils/ConfigManager.cs"
click node_altsettings "https://github.com/greepar/bililive/blob/master/BiliLive/Models/AltSettings.cs"
click node_biliinterface "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Interface/IBiliService.cs"
click node_altinterface "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Interface/IAltService.cs"
click node_altservice "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/AltService.cs"
click node_login "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/LoginService.cs"
click node_live "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/LiveService.cs"
click node_award "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/AwardService.cs"
click node_sign "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/SignService.cs"
click node_ffmpeg "https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/FfmpegWrapper.cs"
click node_theme "https://github.com/greepar/bililive/blob/master/Material3.UI/Theme/ThemeManager.cs"
click node_scheme "https://github.com/greepar/bililive/blob/master/Material3.UI/Theme/Color/M3Scheme.cs"

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_main,node_home,node_accounts,node_user toneBlue
class node_auto,node_altmanager,node_ffmpeg toneAmber
class node_biliinterface,node_altinterface,node_altservice,node_login,node_live,node_award,node_sign,node_biliapi toneMint
class node_app,node_config,node_altsettings,node_theme,node_scheme toneRose
```

## Components

### Desktop experience

- [Main view model](https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/MainViewModel.cs): `BiliLive/Views/MainWindow/MainViewModel.cs`
- [Home page](https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Pages/HomePage/HomeViewModel.cs): `BiliLive/Views/MainWindow/Pages/HomePage/HomeViewModel.cs`
- [Accounts](https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Controls/AccountsViewModel.cs): `BiliLive/Views/MainWindow/Controls/AccountsViewModel.cs`

### Live automation

- [Auto service](https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Pages/AutoService/AutoServiceViewModel.cs): `BiliLive/Views/MainWindow/Pages/AutoService/AutoServiceViewModel.cs`
- [Alternate login](https://github.com/greepar/bililive/blob/master/BiliLive/Views/MainWindow/Pages/AutoService/Components/AltManagerViewModel.cs): `BiliLive/Views/MainWindow/Pages/AutoService/Components/AltManagerViewModel.cs`
- [Stream process](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/FfmpegWrapper.cs): `BiliLive.Core/Services/FfmpegWrapper.cs`

### Bilibili services

- [Bilibili interface](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Interface/IBiliService.cs): `BiliLive.Core/Interface/IBiliService.cs`
- [Alternate interface](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Interface/IAltService.cs): `BiliLive.Core/Interface/IAltService.cs`
- [Alternate service](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/AltService.cs): `BiliLive.Core/Services/BiliService/AltService.cs`
- [Login service](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/LoginService.cs): `BiliLive.Core/Services/BiliService/LoginService.cs`
- [Live service](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/LiveService.cs): `BiliLive.Core/Services/BiliService/LiveService.cs`
- [Award service](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/AwardService.cs): `BiliLive.Core/Services/BiliService/AwardService.cs`
- [Sign service](https://github.com/greepar/bililive/blob/master/BiliLive.Core/Services/BiliService/SignService.cs): `BiliLive.Core/Services/BiliService/SignService.cs`

### App and theme

- [Application setup](https://github.com/greepar/bililive/blob/master/BiliLive/App.axaml.cs): `BiliLive/App.axaml.cs`
- [Config manager](https://github.com/greepar/bililive/blob/master/BiliLive/Utils/ConfigManager.cs): `BiliLive/Utils/ConfigManager.cs`
- [Alternate settings](https://github.com/greepar/bililive/blob/master/BiliLive/Models/AltSettings.cs): `BiliLive/Models/AltSettings.cs`
- [Theme manager](https://github.com/greepar/bililive/blob/master/Material3.UI/Theme/ThemeManager.cs): `Material3.UI/Theme/ThemeManager.cs`
- [M3 color scheme](https://github.com/greepar/bililive/blob/master/Material3.UI/Theme/Color/M3Scheme.cs): `Material3.UI/Theme/Color/M3Scheme.cs`

### Other components

- **User**
- **Bilibili APIs**

## Connections

- User → Main view model: uses
- Application setup → Main view model: resolves
- Application setup → Config manager: flushes on exit
- Alternate login → Alternate service: requests login
- Alternate service → Alternate interface: implements
- Alternate service → Login service: uses login
- Login service → Bilibili APIs: checks login
- Alternate service → Bilibili APIs: requests QR
- Auto service → Bilibili interface: calls tasks
- Auto service → Stream process: interrupts stream
- Auto service → Alternate settings: manages accounts
- Auto service → Config manager: persists settings
- Live service → Bilibili APIs: reads and updates
- Award service → Bilibili APIs: requests awards
- Sign service → Bilibili APIs: signs requests
- Theme manager → M3 color scheme: generates palettes
