# rachelos/we-mp-rss architecture

> Architecture diagram of the GitHub repository rachelos/we-mp-rss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rachelos/we-mp-rss
- Repository: https://github.com/rachelos/we-mp-rss

## Overview

##### Project Type and Purpose
- Full-stack web application with front-end (Vue 3 + Vite) and back-end (Python + FastAPI), packaged via Docker.
- Purpose: scrape WeChat Official Account content, generate RSS feeds, expose APIs, provide a web UI for managing subscriptions, tasks, exports, and notifications.

##### File Structure
- Top level:
- Dockerfiles / compose: container definitions and orchestration.
- config.example.yaml / config.yaml: runtime and DB configuration.
- main.py / web.py: entry points for backend service.
- apis/: FastAPI route handlers.
- core/: business logic (scraping, parsing, models, scheduling).
- driver/: pluggable scraping drivers interfacing with WeChat.
- jobs/: scheduled tasks modules.
- static/ + web_ui/: frontend assets and source code.
- Patterns:
- Front-end / back-end separation.
- Core modules separated into models, queue, tasks, notifications, YAML-backed store.
- Driver plugin pattern for different scraping methods.
- Notifications under core/notice and via webhooks.
- Scheduler via core/thread and jobs/*.

##### Confirm Architecture from README
- “Front-end and back-end separation”
- Backend: FastAPI; Frontend: Vue 3 + Vite.
- Database: SQLite (default) or MySQL.
- Scheduled tasks for scraping and content updates.
- Notification channels (WeChat, DingTalk, Feishu, custom).
- Export features (md/docx/pdf/json).

##### Main Components & Interactions
a. Components to include:
- Browser / Client Application (Vue UI)
- Front-end Server (static assets served, if separate)
- API Gateway (FastAPI / Uvicorn)
- Business Logic Layer:
- apis/ (route handlers)
- core/ (services: scraping, parsing, RSS generation, export)
- driver/ (WeChat drivers)
- jobs/ (scheduled job definitions)
- Scheduler / Thread Pool (core/thread)
- Database (SQLite/MySQL)
- Cache / File Storage (./data/cache, ./data/db.db)
- External Services:
- WeChat Official Account endpoints
- RSS clients / subscribers
- Notification Webhooks (DingTalk, Feishu, WeChat, custom)
- Docker Host / Orchestration (docker-compose)
b. Relationships:
- UI ↔ API Gateway via HTTP/REST.
- API Gateway invokes Business Logic modules.
- Business Logic reads/writes to Database and Cache.
- Scheduler triggers jobs which call drivers and core services.
- Drivers interact with External WeChat services.
- Generated RSS feeds are stored and served via API endpoints.
- Notification modules push to external webhook URLs.
c. Architectural Patterns:
- Layered architecture: Presentation → API → Service → Data.
- Plugin pattern for scraping drivers and notification channels.
- Asynchronous/ threaded scheduling for periodic jobs.
- Front-end/back-end separation.
- Configuration via YAML / environment variables.
d. Key Technologies:
- Python 3.13 (FastAPI, SQLAlchemy or similar ORM, Pydantic)
- Vue 3 + Vite (TypeScript)
- Docker / docker-compose
- SQLite / MySQL
- Celery-style scheduler implemented in core/thread

##### Detail
- Core modules: apis/, core/models, core/rss, core/task, core/notice, driver/.
- Config layer feeding into API and Services.
- Docker network or compose services as a boundary.
- Periodic vs. on-demand flows (cron vs. user API calls).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    Browser["Browser / Client Application"]:::frontend
    FrontendServer["Front-end Server (static assets)"]:::frontend
    Browser --> FrontendServer

    %% Backend Layer
    ApiGateway["API Gateway (FastAPI)"]:::backend
    FrontendServer --> ApiGateway
    ApiLayer["API Layer (apis/)"]:::backend
    ApiGateway --> ApiLayer
    ServiceCore["Service Layer (core/)"]:::backend
    ApiLayer --> ServiceCore
    RssModule["RSS Module (core/rss.py)"]:::backend
    ServiceCore --> RssModule
    TaskModule["Task Module (core/task/)"]:::backend
    ServiceCore --> TaskModule
    DriverPlugins["Driver Plugins (driver/)"]:::backend
    ServiceCore --> DriverPlugins
    NoticeModule["Notification Modules (core/notice/)"]:::backend
    ServiceCore --> NoticeModule
    WebhookModule["Webhook Modules (core/webhook/)"]:::backend
    ServiceCore --> WebhookModule
    ExportApi["Export API (apis/export.py)"]:::backend
    ApiGateway --> ExportApi
    ExportTools["Export Tools (tools/mdtools/)"]:::backend
    ExportApi --> ExportTools

    %% Scheduler
    Scheduler["Scheduler / Thread Pool (core/thread.py)"]:::backend
    Jobs["Jobs (jobs/)"]:::backend
    Scheduler --> Jobs
    Jobs --> DriverPlugins
    Jobs --> ServiceCore

    %% Data Layer
    DBConnection["Database (core/db.py, core/database.py)"]:::datastore
    CacheFile["Cache / File Storage (core/common/file_tools.py, data/cache/)"]:::datastore
    ServiceCore --> DBConnection
    ServiceCore --> CacheFile

    %% External Systems
    WeChat["WeChat Official Accounts"]:::external
    RSSClients["RSS Clients / Subscribers"]:::external
    Webhooks["Notification Webhooks"]:::external
    DriverPlugins --> WeChat
    RssModule --> RSSClients
    NoticeModule --> Webhooks
    WebhookModule --> Webhooks

    %% Deployment
    DockerCompose["Docker Compose (compose/*.yaml)"]:::deployment
    Dockerfile["Dockerfile"]:::deployment
    DockerCompose --> ApiGateway
    DockerCompose --> FrontendServer
    DockerCompose --> DBConnection
    DockerCompose --> Scheduler

    %% Click Events
    click Browser "https://github.com/rachelos/we-mp-rss/tree/main/web_ui/src"
    click FrontendServer "https://github.com/rachelos/we-mp-rss/tree/main/static/"
    click FrontendServer "https://github.com/rachelos/we-mp-rss/blob/main/web_ui/dist/index.html"
    click ApiGateway "https://github.com/rachelos/we-mp-rss/blob/main/main.py"
    click ApiGateway "https://github.com/rachelos/we-mp-rss/blob/main/web.py"
    click ApiLayer "https://github.com/rachelos/we-mp-rss/tree/main/apis/"
    click ServiceCore "https://github.com/rachelos/we-mp-rss/tree/main/core/"
    click RssModule "https://github.com/rachelos/we-mp-rss/blob/main/core/rss.py"
    click TaskModule "https://github.com/rachelos/we-mp-rss/tree/main/core/task/"
    click DriverPlugins "https://github.com/rachelos/we-mp-rss/tree/main/driver/"
    click NoticeModule "https://github.com/rachelos/we-mp-rss/tree/main/core/notice/"
    click WebhookModule "https://github.com/rachelos/we-mp-rss/tree/main/core/webhook/"
    click ExportApi "https://github.com/rachelos/we-mp-rss/blob/main/apis/export.py"
    click ExportTools "https://github.com/rachelos/we-mp-rss/blob/main/tools/mdtools/export.py"
    click MD2Doc "https://github.com/rachelos/we-mp-rss/blob/main/tools/mdtools/md2doc.py"
    click Scheduler "https://github.com/rachelos/we-mp-rss/blob/main/core/thread.py"
    click Jobs "https://github.com/rachelos/we-mp-rss/tree/main/jobs/"
    click DBConnection "https://github.com/rachelos/we-mp-rss/blob/main/core/db.py"
    click DBConnection "https://github.com/rachelos/we-mp-rss/blob/main/core/database.py"
    click ConfigExample "https://github.com/rachelos/we-mp-rss/blob/main/config.example.yaml"
    click Config "https://github.com/rachelos/we-mp-rss/blob/main/config.yaml"
    click CacheFile "https://github.com/rachelos/we-mp-rss/blob/main/core/common/file_tools.py"
    click CacheDir "https://github.com/rachelos/we-mp-rss/tree/main/data/cache/"
    click DockerCompose "https://github.com/rachelos/we-mp-rss/blob/main/compose/docker-compose.yaml"
    click DockerCompose "https://github.com/rachelos/we-mp-rss/blob/main/compose/docker-compose-sqlite.yaml"
    click Dockerfile "https://github.com/rachelos/we-mp-rss/tree/main/Dockerfile"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#0366d6,color:#000;
    classDef backend fill:#c8e6c9,stroke:#2e7d32,color:#000;
    classDef datastore fill:#ffe0b2,stroke:#ef6c00,color:#000;
    classDef external fill:#e0e0e0,stroke:#616161,color:#000;
    classDef deployment fill:#d1c4e9,stroke:#6a1b9a,color:#000;
```
