# wechat-article/wechat-article-exporter architecture

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

- Interactive diagram: https://gitdiagram.com/wechat-article/wechat-article-exporter
- Repository: https://github.com/wechat-article/wechat-article-exporter

## Overview

This project is a full-stack web application designed for the online, bulk export of WeChat public account articles. Its primary purpose is to enable users to search for WeChat public accounts (via keywords or biz identifiers), retrieve articles (including embedded multimedia and analytics data), and export these articles in HTML (along with associated assets) while accurately replicating the original article appearance.

##### Main components
- Frontend (Client-Side):
- Nuxt/Vue-based application (notice the presence of app.vue, pages/, components/, layouts/, composables/ and store/ directories).
- Style and assets management with assets/ (including CSS and media items) and public/ directories.

- Backend (Server-Side):
- A server directory housing API endpoints (inside server/api) that handle different functionalities such as login, search, fetching article data, and publication details.
- Server-side utility modules in server/utils/, configuration (server/env.d.ts) and type definitions (in types/).
- API endpoints for login (with subdirectories like login/session) and data retrieval routes (e.g., appmsgalbum.get.ts, comment.get.ts).

- API Layer / Middle-Tier:
- The separate apis/ directory hints at client-side utilities or a facade to communicate with backend endpoints.
- Store files (store/api.ts, store/article.ts, etc.) are also used to manage the application's state and API interactions across the frontend.

- Documentation & Deployment Assets:
- The docs/ directory provides further explanations on credentials, database, FAQ and proxy setups, which are also integral to deploying or understanding the environment.
- Assets for deployment and proxy (assets/deploy, assets/private-proxy) indicate some support for private deployment or hosting, reflecting an architecture that may be used in Deno Deploy or Cloudflare Workers.

##### Relationships and interactions
- The frontend and backend are clearly separated: the Nuxt/Vue frontend talks to the backend's API endpoints (HTTP method calls) to retrieve or update data.
- The server acts as a dedicated API provider, with endpoints handling specific functionalities like login sessions, article exports, and search queries.
- State management (store/) in the frontend interacts closely with both local composables and API endpoints offered by the server to maintain a reactive UI.

##### Important architectural patterns and design choices
- Separation of Concerns: The project cleanly divides UI components, business logic, and server-side API processing.
- MVC/MVVM Patterns: The presence of pages, components, and a dedicated store indicates the use of front-end patterns that help manage state and data flow.
- Modularization: Clearly separated directories for utilities (utils/), type definitions (types/), and configuration (config/) help maintain a modular codebase.
- Full-stack coupled with configuration flexibility for private deployments (evidenced by deploy assets and Deno Deploy-related configuration).

## Diagram (Mermaid)

```mermaid
flowchart TD
    External["User Browser"]:::external

    subgraph "Frontend"
        subgraph "Vue/Nuxt Core"
            f1["app.vue"]:::frontend
            f2["pages/dashboard.vue"]:::frontend
            f3["pages/login.vue"]:::frontend
            f4["layouts/default.vue"]:::frontend
        end
        subgraph "UI Components"
            f5["components/ArticleList.vue"]:::frontend
            f6["components/AccountSwitcher.vue"]:::frontend
            f7["components/Header.vue"]:::frontend
        end
        subgraph "State Management & Composables"
            f8["store/api.ts"]:::store
            f9["store/article.ts"]:::store
            f10["composables/useActiveAccount.ts"]:::store
        end
        subgraph "API Client"
            f11["apis/index.ts"]:::api
        end
    end

    subgraph "Backend"
        subgraph "API Endpoints"
            b1["server/api/appmsgalbum.get.ts"]:::backend
            b2["server/api/login/session/[sessionid].post.ts"]:::backend
            b3["server/api/searchbiz.get.ts"]:::backend
            b4["server/api/logout.get.ts"]:::backend
            b5["server/api/appmsgpublish.get.ts"]:::backend
            b6["server/api/comment.get.ts"]:::backend
        end
        subgraph "Utilities & Configuration"
            b7["server/utils/index.ts"]:::backend
            b8["server/utils/kv.ts"]:::backend
            b9["server/env.d.ts"]:::backend
            b10["config/index.ts"]:::backend
            b11["types/album.d.ts"]:::backend
            b12["types/comment.d.ts"]:::backend
            b13["types/types.d.ts"]:::backend
            b14["types/video.d.ts"]:::backend
        end
    end

    subgraph "Documentation & Deployment"
        d1["docs/credentials.md"]:::docs
        d2["docs/database.md"]:::docs
        d3["docs/faq.md"]:::docs
        d4["docs/private-deploy.md"]:::docs
        d5["assets/deploy"]:::docs
        d6["assets/private-proxy"]:::docs
        d7["assets/private-proxy/搭建代理教程-deno-deploy版.mp4"]:::docs
    end

    External -->|"uses"| f1
    f1 -->|"loads"| f2
    f1 -->|"loads"| f3
    f1 -->|"loads"| f4
    f2 -->|"displays"| f5
    f2 -->|"displays"| f6
    f2 -->|"displays"| f7
    f5 -->|"updatesState"| f8
    f6 -->|"updatesState"| f8
    f7 -->|"updatesState"| f8
    f8 -->|"calls"| f11
    f11 -->|"calls"| b1
    f11 -->|"calls"| b2
    f11 -->|"calls"| b3
    f11 -->|"calls"| b4
    f11 -->|"calls"| b5
    f11 -->|"calls"| b6
    b1 -->|"uses"| b7
    b1 -->|"uses"| b9
    b10 -->|"configDocs"| d1

    click f1 "https://github.com/wechat-article/wechat-article-exporter/blob/master/app.vue"
    click f2 "https://github.com/wechat-article/wechat-article-exporter/blob/master/pages/dashboard.vue"
    click f3 "https://github.com/wechat-article/wechat-article-exporter/blob/master/pages/login.vue"
    click f4 "https://github.com/wechat-article/wechat-article-exporter/blob/master/layouts/default.vue"
    click f5 "https://github.com/wechat-article/wechat-article-exporter/blob/master/components/ArticleList.vue"
    click f6 "https://github.com/wechat-article/wechat-article-exporter/blob/master/components/AccountSwitcher.vue"
    click f7 "https://github.com/wechat-article/wechat-article-exporter/blob/master/components/Header.vue"
    click f8 "https://github.com/wechat-article/wechat-article-exporter/blob/master/store/api.ts"
    click f9 "https://github.com/wechat-article/wechat-article-exporter/blob/master/store/article.ts"
    click f10 "https://github.com/wechat-article/wechat-article-exporter/blob/master/composables/useActiveAccount.ts"
    click f11 "https://github.com/wechat-article/wechat-article-exporter/blob/master/apis/index.ts"
    
    click b1 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/api/appmsgalbum.get.ts"
    click b2 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/api/login/session/[sessionid].post.ts"
    click b3 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/api/searchbiz.get.ts"
    click b4 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/api/logout.get.ts"
    click b5 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/api/appmsgpublish.get.ts"
    click b6 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/api/comment.get.ts"
    click b7 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/utils/index.ts"
    click b8 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/utils/kv.ts"
    click b9 "https://github.com/wechat-article/wechat-article-exporter/blob/master/server/env.d.ts"
    click b10 "https://github.com/wechat-article/wechat-article-exporter/blob/master/config/index.ts"
    click b11 "https://github.com/wechat-article/wechat-article-exporter/blob/master/types/album.d.ts"
    click b12 "https://github.com/wechat-article/wechat-article-exporter/blob/master/types/comment.d.ts"
    click b13 "https://github.com/wechat-article/wechat-article-exporter/blob/master/types/types.d.ts"
    click b14 "https://github.com/wechat-article/wechat-article-exporter/blob/master/types/video.d.ts"
    
    click d1 "https://github.com/wechat-article/wechat-article-exporter/blob/master/docs/credentials.md"
    click d2 "https://github.com/wechat-article/wechat-article-exporter/blob/master/docs/database.md"
    click d3 "https://github.com/wechat-article/wechat-article-exporter/blob/master/docs/faq.md"
    click d4 "https://github.com/wechat-article/wechat-article-exporter/blob/master/docs/private-deploy.md"
    click d5 "https://github.com/wechat-article/wechat-article-exporter/tree/master/assets/deploy"
    click d6 "https://github.com/wechat-article/wechat-article-exporter/tree/master/assets/private-proxy"
    click d7 "https://github.com/wechat-article/wechat-article-exporter/blob/master/assets/private-proxy/搭建代理教程-deno-deploy版.mp4"

    classDef external fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef frontend fill:#a1d490,stroke:#333,stroke-width:2px;
    classDef store fill:#d4a5a5,stroke:#333,stroke-width:2px;
    classDef api fill:#f3d250,stroke:#333,stroke-width:2px;
    classDef backend fill:#a9d0f5,stroke:#333,stroke-width:2px;
    classDef docs fill:#d1aaff,stroke:#333,stroke-width:2px;
```
