# imsyy/dailyhotapi architecture

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

- Interactive diagram: https://gitdiagram.com/imsyy/dailyhotapi
- Repository: https://github.com/imsyy/dailyhotapi

## Overview

DailyHotApi is a Hono service that aggregates trending lists from many sites and exposes them as JSON or RSS. The request path is app middleware and routing, dynamic source-specific handlers, then normalized responses; the registry applies limits and RSS formatting before returning results. Shared internals provide HTTP fetching, cache, time conversion, and authentication helpers. The README documents a broad catalog of feeds and deployment modes. Unsampled handlers are represented collectively; edges are limited to relationships shown in excerpts, the source index, or README.

Main entry points: [`src/app.tsx`](https://github.com/imsyy/dailyhotapi/blob/master/src/app.tsx) (Hono app), [`src/routes`](https://github.com/imsyy/dailyhotapi/tree/master/src/routes) (Site handlers), [`src/utils/getData.ts`](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getData.ts) (HTTP fetch/cache), [`src/registry.ts`](https://github.com/imsyy/dailyhotapi/blob/master/src/registry.ts) (Route registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP service"]
  node_app["Hono app<br/>[app.tsx]"]
  node_registry["Route registry<br/>[registry.ts]"]
  node_robots["Robots response<br/>[robots.txt.ts]"]
  node_home_view["Home view<br/>[Home.tsx]"]
  node_error_view["Error view<br/>[Error.tsx]"]
  node_notfound_view["Not-found view<br/>[NotFound.tsx]"]
  node_layout_view["Shared layout<br/>[Layout.tsx]"]
end

subgraph group_sources["Trend sources"]
  node_source_handlers["Site handlers"]
  node_github_trending["GitHub trending<br/>[github.ts]"]
end

subgraph group_shared["Shared internals"]
  node_config["Runtime config<br/>[config.ts]"]
  node_http_fetch["HTTP fetch/cache<br/>[getData.ts]"]
  node_cache[("Cache backends<br/>[cache.ts]")]
  node_bili_auth["Bilibili WBI auth<br/>[bilibili.ts]"]
  node_token_helpers["Token helpers"]
  node_time_utils["Time conversion<br/>[getTime.ts]"]
  node_number_utils["Number parsing<br/>[getNum.ts]"]
  node_logger["Logger<br/>[logger.ts]"]
end

subgraph group_presentation["Response formats"]
  node_rss_builder["RSS builder<br/>[getRSS.ts]"]
  node_rss_parser["RSS parser<br/>[parseRSS.ts]"]
end

node_client(("API client"))
node_upstream_sites{{"Source websites"}}

node_client -->|"requests"| node_app
node_app -->|"mounts routes"| node_registry
node_app -->|"serves robots"| node_robots
node_app -->|"renders home"| node_home_view
node_app -->|"renders 404"| node_notfound_view
node_app -->|"renders errors"| node_error_view
node_registry -->|"dispatches"| node_source_handlers
node_registry -->|"builds RSS"| node_rss_builder
node_source_handlers -->|"fetches data"| node_http_fetch
node_http_fetch -->|"requests"| node_upstream_sites
node_http_fetch -->|"reads/writes"| node_cache
node_github_trending -->|"reads/writes"| node_cache
node_github_trending -->|"scrapes GitHub"| node_upstream_sites
node_source_handlers -->|"converts times"| node_time_utils
node_source_handlers -->|"parses counts"| node_number_utils
node_source_handlers -->|"uses tokens"| node_token_helpers
node_bili_auth -->|"gets WBI keys"| node_http_fetch
node_bili_auth -->|"caches keys"| node_cache
node_registry -->|"checks RSS mode"| node_config
node_app -->|"reads settings"| node_config
node_http_fetch -->|"logs requests"| node_logger
node_cache -->|"logs cache"| node_logger
node_app -->|"logs errors"| node_logger
node_rss_parser -->|"logs parse errors"| node_logger

click node_app "https://github.com/imsyy/dailyhotapi/blob/master/src/app.tsx"
click node_registry "https://github.com/imsyy/dailyhotapi/blob/master/src/registry.ts"
click node_config "https://github.com/imsyy/dailyhotapi/blob/master/src/config.ts"
click node_source_handlers "https://github.com/imsyy/dailyhotapi/tree/master/src/routes"
click node_github_trending "https://github.com/imsyy/dailyhotapi/blob/master/src/routes/github.ts"
click node_http_fetch "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getData.ts"
click node_cache "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/cache.ts"
click node_bili_auth "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getToken/bilibili.ts"
click node_token_helpers "https://github.com/imsyy/dailyhotapi/tree/master/src/utils/getToken"
click node_time_utils "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getTime.ts"
click node_number_utils "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getNum.ts"
click node_logger "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/logger.ts"
click node_rss_builder "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getRSS.ts"
click node_rss_parser "https://github.com/imsyy/dailyhotapi/blob/master/src/utils/parseRSS.ts"
click node_robots "https://github.com/imsyy/dailyhotapi/blob/master/src/robots.txt.ts"
click node_home_view "https://github.com/imsyy/dailyhotapi/blob/master/src/views/Home.tsx"
click node_error_view "https://github.com/imsyy/dailyhotapi/blob/master/src/views/Error.tsx"
click node_notfound_view "https://github.com/imsyy/dailyhotapi/blob/master/src/views/NotFound.tsx"
click node_layout_view "https://github.com/imsyy/dailyhotapi/blob/master/src/views/Layout.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_app,node_registry,node_robots,node_home_view,node_error_view,node_notfound_view,node_layout_view,node_client toneBlue
class node_source_handlers,node_github_trending toneAmber
class node_config,node_http_fetch,node_cache,node_bili_auth,node_token_helpers,node_time_utils,node_number_utils,node_logger toneMint
class node_rss_builder,node_rss_parser toneRose
class node_upstream_sites toneIndigo
```

## Components

### HTTP service

- [Hono app](https://github.com/imsyy/dailyhotapi/blob/master/src/app.tsx): `src/app.tsx`
- [Route registry](https://github.com/imsyy/dailyhotapi/blob/master/src/registry.ts): `src/registry.ts`
- [Robots response](https://github.com/imsyy/dailyhotapi/blob/master/src/robots.txt.ts): `src/robots.txt.ts`
- [Home view](https://github.com/imsyy/dailyhotapi/blob/master/src/views/Home.tsx): `src/views/Home.tsx`
- [Error view](https://github.com/imsyy/dailyhotapi/blob/master/src/views/Error.tsx): `src/views/Error.tsx`
- [Not-found view](https://github.com/imsyy/dailyhotapi/blob/master/src/views/NotFound.tsx): `src/views/NotFound.tsx`
- [Shared layout](https://github.com/imsyy/dailyhotapi/blob/master/src/views/Layout.tsx): `src/views/Layout.tsx`

### Trend sources

- [Site handlers](https://github.com/imsyy/dailyhotapi/tree/master/src/routes): `src/routes`
- [GitHub trending](https://github.com/imsyy/dailyhotapi/blob/master/src/routes/github.ts): `src/routes/github.ts`

### Shared internals

- [Runtime config](https://github.com/imsyy/dailyhotapi/blob/master/src/config.ts): `src/config.ts`
- [HTTP fetch/cache](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getData.ts): `src/utils/getData.ts`
- [Cache backends](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/cache.ts): `src/utils/cache.ts`
- [Bilibili WBI auth](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getToken/bilibili.ts): `src/utils/getToken/bilibili.ts`
- [Token helpers](https://github.com/imsyy/dailyhotapi/tree/master/src/utils/getToken): `src/utils/getToken`
- [Time conversion](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getTime.ts): `src/utils/getTime.ts`
- [Number parsing](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getNum.ts): `src/utils/getNum.ts`
- [Logger](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/logger.ts): `src/utils/logger.ts`

### Response formats

- [RSS builder](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/getRSS.ts): `src/utils/getRSS.ts`
- [RSS parser](https://github.com/imsyy/dailyhotapi/blob/master/src/utils/parseRSS.ts): `src/utils/parseRSS.ts`

### Other components

- **API client**
- **Source websites**

## Connections

- API client → Hono app: requests (evidence: `src/app.tsx`)
- Hono app → Route registry: mounts routes (evidence: `src/app.tsx`)
- Hono app → Robots response: serves robots (evidence: `src/app.tsx`)
- Hono app → Home view: renders home (evidence: `src/app.tsx`)
- Hono app → Not-found view: renders 404 (evidence: `src/app.tsx`)
- Hono app → Error view: renders errors (evidence: `src/app.tsx`)
- Route registry → Site handlers: dispatches (evidence: `src/registry.ts`)
- Route registry → RSS builder: builds RSS (evidence: `src/registry.ts`)
- Site handlers → HTTP fetch/cache: fetches data (evidence: `src/routes/bilibili.ts`)
- HTTP fetch/cache → Source websites: requests (evidence: `src/utils/getData.ts`)
- HTTP fetch/cache → Cache backends: reads/writes (evidence: `src/utils/getData.ts`)
- GitHub trending → Cache backends: reads/writes (evidence: `src/routes/github.ts`)
- GitHub trending → Source websites: scrapes GitHub (evidence: `src/routes/github.ts`)
- Site handlers → Time conversion: converts times (evidence: `src/routes/bilibili.ts`)
- Site handlers → Number parsing: parses counts (evidence: `src/routes/sina.ts`)
- Site handlers → Token helpers: uses tokens (evidence: `src/routes/bilibili.ts`)
- Bilibili WBI auth → HTTP fetch/cache: gets WBI keys (evidence: `src/utils/getToken/bilibili.ts`)
- Bilibili WBI auth → Cache backends: caches keys (evidence: `src/utils/getToken/bilibili.ts`)
- Route registry → Runtime config: checks RSS mode (evidence: `src/registry.ts`)
- Hono app → Runtime config: reads settings (evidence: `src/app.tsx`)
- HTTP fetch/cache → Logger: logs requests (evidence: `src/utils/getData.ts`)
- Cache backends → Logger: logs cache (evidence: `src/utils/cache.ts`)
- Hono app → Logger: logs errors (evidence: `src/app.tsx`)
- RSS parser → Logger: logs parse errors (evidence: `src/utils/parseRSS.ts`)
