# only9464/eweb architecture

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

- Interactive diagram: https://gitdiagram.com/only9464/eweb
- Repository: https://github.com/only9464/eweb

## Overview

##### Project type and purpose
- This is a WeChat Mini-Program (single-page application style) that provides a comprehensive set of utilities: payments (wallet, scan, QR, bank cards), account management, utility recharges, coupons, facial recognition (aiface), etc.
- No server-side code lives here; instead it relies on external APIs (bank/pay gateways, cloudbase functions, third-party modules) and local logic packaged as JS/WASM modules.

##### File structure
- Top-level config & entry points:
- app.js, app.json, app.wxss — the program’s bootstrap and global styles
- project.config.json, .cloudbase/… — deployment / cloud environment definitions
- Pages (pages/…) & sub-pages: each feature lives under pages/[featureName] with .js/.json/.wxml/.wxss
- Reusable UI Components (components/…)
- Third-party integrations (thirdpart/…, miniprogram_npm/…)
- Utility libraries (utils/…) for requests, formatting, encryption, throttling, etc.
- Static assets & styling under style/images

##### README
- No content; architecture must be deduced from file layout and naming conventions.

##### Final recommendations
- Calls with protocol (HTTPS, WebSocket) and modules used (utils/request.js, sm4, WASM).
- Review with stakeholders to ensure it aligns with actual API endpoints and deployment setup in .cloudbase.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer (Pages & Components)"
        direction TB
        subgraph "Client Shell" 
            direction TB
            ClientShellJS["app.js"]:::ui
            ClientShellJSON["app.json"]:::ui
            ClientShellWXSS["app.wxss"]:::ui
        end
        UIPages["Pages (features)"]:::ui
        SharedComponents["Shared Components"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic (utils, i18n)" 
        direction TB
        Request["request.js"]:::business
        SM4Util["sm4.js"]:::business
        Barcode["barcode.js"]:::business
        UtilCore["util.js"]:::business
        FormatWXS["format.wxs"]:::business
        Throttle["throttle.js"]:::business
        Layout["layout.js"]:::business
        Structure["structure.js"]:::business
        BankLib["bank.js"]:::business
        BarcodeUse["barcodeUse.js"]:::business
        subgraph "Internationalization"
            direction TB
            I18nLocales["locales.js"]:::business
            I18nWXS["locales.wxs"]:::business
            I18nNPM["@miniprogram-i18n"]:::business
        end
    end

    %% Integration Layer
    subgraph "Integration (HTTP Client, Encryption, WASM)"
        direction TB
        HTTPClient["utils/request.js"]:::integration
        EncryptionSM4["utils/sm4.js"]:::integration
        EncryptionSM4NPM["miniprogram_npm/sm4js"]:::integration
        WASMJS["pkg/unicore_wasm.js"]:::integration
        WASMBG["pkg/unicore_wasm_bg.wasm"]:::integration
    end

    %% Third-Party & Config
    subgraph "Third-Party & Config"
        direction TB
        AifaceModule["thirdpart/aiface"]:::integration
        AifacePage["pages/aiface.js"]:::integration
        CloudbaseDebug[".cloudbase/container/debug.json"]:::integration
        CloudbaseDir[".cloudbase/"]:::integration
        BabelHelpers["@babel/runtime/helpers"]:::integration
    end

    %% External Services
    subgraph "External Services"
        direction TB
        PaymentGateway["Payment Gateway API"]:::external
        CloudFunctions["Cloudbase Functions"]:::external
        AifaceService["Aiface Recognition Service"]:::external
        UtilityServices["Utility Services API"]:::external
    end

    %% Connections
    ClientShellJS -->|bootstrap| UIPages
    ClientShellJS -->|bootstrap| SharedComponents
    UIPages -->|emits events| Request
    SharedComponents -->|used by| Request
    Request -->|calls HTTPS| HTTPClient
    Request -->|calls HTTPS| CloudFunctions
    Request -->|calls HTTPS| UtilityServices
    SM4Util -->|encrypts| HTTPClient
    EncryptionSM4 -->|encrypts| HTTPClient
    HTTPClient -->|fetch| PaymentGateway
    HTTPClient -->|fetch| CloudFunctions
    BarcodeUse -->|uses| Barcode
    WASMJS -->|executes| WASMBG
    WASMJS -->|called by| Request
    I18nLocales -->|wraps| UIPages
    I18nNPM -->|wraps| UIPages
    AifaceModule -->|integrates| AifacePage
    AifacePage -->|calls| AifaceService
    CloudbaseDebug -->|configures| CloudFunctions
    CloudbaseDir -->|defines| CloudFunctions

    %% Cross-layer arrows
    Request -->|invokes| EncryptionSM4
    Request -->|invokes| WASMJS

    %% Click Events
    click ClientShellJS "https://github.com/only9464/eweb/blob/main/app.js"
    click ClientShellJSON "https://github.com/only9464/eweb/blob/main/app.json"
    click ClientShellWXSS "https://github.com/only9464/eweb/blob/main/app.wxss"
    click UIPages "https://github.com/only9464/eweb/tree/main/pages/"
    click SharedComponents "https://github.com/only9464/eweb/tree/main/components/"
    click Request "https://github.com/only9464/eweb/blob/main/utils/request.js"
    click SM4Util "https://github.com/only9464/eweb/blob/main/utils/sm4.js"
    click Barcode "https://github.com/only9464/eweb/blob/main/utils/barcode.js"
    click UtilCore "https://github.com/only9464/eweb/blob/main/utils/util.js"
    click FormatWXS "https://github.com/only9464/eweb/blob/main/utils/format.wxs"
    click Throttle "https://github.com/only9464/eweb/blob/main/utils/throttle.js"
    click Layout "https://github.com/only9464/eweb/blob/main/utils/layout.js"
    click Structure "https://github.com/only9464/eweb/blob/main/utils/structure.js"
    click BankLib "https://github.com/only9464/eweb/blob/main/utils/bank.js"
    click BarcodeUse "https://github.com/only9464/eweb/blob/main/utils/barcodeUse.js"
    click I18nLocales "https://github.com/only9464/eweb/blob/main/i18n/locales.js"
    click I18nWXS "https://github.com/only9464/eweb/blob/main/i18n/locales.wxs"
    click I18nNPM "https://github.com/only9464/eweb/tree/main/miniprogram_npm/@miniprogram-i18n/"
    click EncryptionSM4 "https://github.com/only9464/eweb/blob/main/utils/sm4.js"
    click EncryptionSM4NPM "https://github.com/only9464/eweb/blob/main/miniprogram_npm/sm4js/index.js"
    click WASMJS "https://github.com/only9464/eweb/blob/main/pkg/unicore_wasm.js"
    click WASMBG "https://github.com/only9464/eweb/blob/main/pkg/unicore_wasm_bg.wasm"
    click AifaceModule "https://github.com/only9464/eweb/tree/main/thirdpart/aiface/"
    click AifacePage "https://github.com/only9464/eweb/blob/main/thirdpart/pages/aiface.js"
    click CloudbaseDebug "https://github.com/only9464/eweb/blob/main/.cloudbase/container/debug.json"
    click CloudbaseDir "https://github.com/only9464/eweb/tree/main/.cloudbase/"
    click BabelHelpers "https://github.com/only9464/eweb/tree/main/@babel/runtime/helpers/"

    %% Styles
    classDef ui fill:#bbdefb,stroke:#0d47a1,color:#0d47a1;
    classDef business fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20;
    classDef integration fill:#ffe0b2,stroke:#e65100,color:#e65100;
    classDef external fill:#ffcdd2,stroke:#b71c1c,color:#b71c1c;
```
