# lilydjwg/morerssplz architecture

> Architecture diagram of the GitHub repository lilydjwg/morerssplz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lilydjwg/morerssplz
- Repository: https://github.com/lilydjwg/morerssplz

## Overview

##### Main Components

a. Web Server Layer
- Main request handler (from base.py)
- Static file serving component (for index.html)

b. Feed Processors Layer
- Zhihu (专栏 & 动态)
- V2EX
- Telegram
- Gogs
- Matters
- Jike
- Each processor should be represented as a module with clear input/output flows

c. External Services Layer
- External APIs being accessed:
- Zhihu API
- V2EX API
- Telegram API
- Other source APIs

d. Caching Layer
- Caching mechanism (indicated by cache_hit/cache_miss metrics)
- Queue management system (referenced by queue_full metric)

e. Monitoring/Metrics Layer
- StatsD integration
- Timing and count metrics collection points

##### Component Relationships

**[Client Requests] → [Tornado Web Server]**
- ↓
**[Static Content] ← [Request Handler] → [StatsD Monitoring]**
- ↓
- [Feed Processors]
- ↙  ↓  ↘
- [Zhihu] [V2EX] [Telegram] ...
- ↓      ↓        ↓
- [Cache Layer]
- ↓      ↓        ↓
**[External APIs/Services Layer]**

##### Additional Notes

- Version requirements (Python 3.5+, Tornado 5+)
- External dependencies (PyRSS2Gen, lxml, pycurl)
- Optional proxy support interface point

##### Key Metrics to Highlight

- morerss.zhihu.fetch (timing)
- morerss.handler.Handler.Code (timing)
- morerss.zhihu.queue_full (count)
- morerss.zhihu.cache_hit/miss (count)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CL[Client Requests]
    end

    subgraph "Web Server Layer"
        WS["Tornado Web Server"]:::server
        RH["Request Handler"]:::handler
        SF["Static File Server"]:::server
    end

    subgraph "Feed Processors Layer"
        ZH["Zhihu Processor"]:::processor
        ZHS["Zhihu Stream"]:::processor
        ZHL["Zhihu Library"]:::processor
        SZH["Static Zhihu"]:::processor
        V2["V2EX Processor"]:::processor
        TG["Telegram Processor"]:::processor
        GG["Gogs Processor"]:::processor
        MT["Matters Processor"]:::processor
        JK["Jike Processor"]:::processor
    end

    subgraph "External Services"
        ZHA["Zhihu API"]:::api
        V2A["V2EX API"]:::api
        TGA["Telegram API"]:::api
        GGA["Gogs API"]:::api
        MTA["Matters API"]:::api
        JKA["Jike API"]:::api
    end

    subgraph "Monitoring Layer"
        SD["StatsD"]:::monitoring
        MT1["Handler Timing"]:::metric
        MT2["Fetch Timing"]:::metric
        MT3["Cache Hit/Miss"]:::metric
        MT4["Queue Status"]:::metric
    end

    CL --> WS
    WS --> RH
    RH --> SF
    RH --> ZH & ZHS & ZHL & SZH & V2 & TG & GG & MT & JK

    ZH --> ZHA
    ZHS --> ZHA
    ZHL --> ZHA
    V2 --> V2A
    TG --> TGA
    GG --> GGA
    MT --> MTA
    JK --> JKA

    RH -.-> SD
    ZH & ZHS & V2 & TG & GG & MT & JK -.-> SD
    SD --> MT1 & MT2 & MT3 & MT4

    %% Click events for file mapping
    click WS "https://github.com/lilydjwg/morerssplz/blob/master/main.py"
    click RH "https://github.com/lilydjwg/morerssplz/blob/master/morerss/base.py"
    click SF "https://github.com/lilydjwg/morerssplz/blob/master/static/index.html"
    click ZH "https://github.com/lilydjwg/morerssplz/blob/master/morerss/zhihu.py"
    click ZHS "https://github.com/lilydjwg/morerssplz/blob/master/morerss/zhihu_stream.py"
    click ZHL "https://github.com/lilydjwg/morerssplz/blob/master/morerss/zhihulib.py"
    click SZH "https://github.com/lilydjwg/morerssplz/blob/master/morerss/static_zhihu.py"
    click V2 "https://github.com/lilydjwg/morerssplz/blob/master/morerss/v2ex.py"
    click TG "https://github.com/lilydjwg/morerssplz/blob/master/morerss/telegram.py"
    click GG "https://github.com/lilydjwg/morerssplz/blob/master/morerss/gogs.py"
    click MT "https://github.com/lilydjwg/morerssplz/blob/master/morerss/matters.py"
    click JK "https://github.com/lilydjwg/morerssplz/blob/master/morerss/jike.py"

    %% Styles
    classDef server fill:#2374e1
    classDef handler fill:#4287f5
    classDef processor fill:#37c937
    classDef api fill:#f7d794
    classDef monitoring fill:#9b59b6
    classDef metric fill:#8e44ad

    %% Legend
    subgraph Legend
        L1["Web Server Components"]:::server
        L2["Feed Processors"]:::processor
        L3["External APIs"]:::api
        L4["Monitoring"]:::monitoring
        L5["Metrics"]:::metric
    end
```
