# get-winfig/winfig-apps architecture

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

- Interactive diagram: https://gitdiagram.com/get-winfig/winfig-apps
- Repository: https://github.com/get-winfig/winfig-apps

## Overview

##### Project Type and Purpose
- This is a “Factory” full-stack tooling repository rather than a traditional frontend/backend app.
- Purpose: Automatically generate and release multiple native desktop applications (Windows, macOS, Linux) from a simple JSON config (`scripts/apps.json`).
- Key technologies:
- Node.js scripts (in `scripts/`) to read and manipulate JSON and assets
- Tauri (Rust) framework in `src-tauri/` for building tiny native apps
- GitHub Actions in `.github/workflows/release.yml` for CI/CD and automated releases

##### High-Level File Structure Analysis
- Top-level:
- `package.json` / `package-lock.json` – Node.js project metadata, scripts, and dependencies
- `src-tauri/` – Tauri (Rust) project with `main.rs`, `build.rs`, and `tauri.conf.json` defining the native wrapper logic and bundling instructions
- `.github/workflows/release.yml` – CI pipeline that triggers builds on push / tag and publishes artifacts to GitHub Releases
- `src/index.html` – basic HTML template loaded by Tauri

##### Key Components
a. Configuration Layer
b. Generator Layer (Node.js Scripts)
- Read `apps.json`
- Inject per-app settings into `src-tauri/tauri.conf.json` or environment variables
c. Build Layer (Tauri/Rust)
- `src-tauri/build.rs`: pre-build hooks (e.g., copy assets)
- `src-tauri/src/main.rs`: application entrypoint that loads the configured URL in a webview
- Tauri CLI & Rust toolchain invoke OS-specific native bundlers to produce `.exe`, `.dmg`, `.deb`
d. CI/CD Layer (GitHub Actions)
- `.github/workflows/release.yml`:
- On push/tag → Installs Node & Rust toolchains
- Runs Node scripts → config + assets generation
- Invokes `npm run build` / `tauri build`
- Collects artifacts and publishes to GitHub Releases
e. Outputs / Release Artifacts
- Native installers for each configured app published as GitHub Release assets

##### Relationships and Data Flow
1. Developer edits `scripts/apps.json`
3. Tauri build process compiles Rust + packages assets → native binaries
4. CI/CD workflow uploads outputs to GitHub Releases

##### Architectural Patterns & Principles
- “Factory” Pattern: Single codebase generates N desktop apps based on runtime configuration
- CI/CD as Code: Entire pipeline defined in GitHub Actions YAML
- Clear Separation of Concerns:
- Configuration (JSON)
- Generation (scripts/)
- Native build (Tauri/Rust)
- Deployment (Actions → Releases)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Local Developer Environment
    subgraph "Local Developer Environment"
        direction TB
        appsJSON["Configuration Store\n(scripts/apps.json)"]:::config
        packageJSON["package.json"]:::code
        packageLock["package-lock.json"]:::code
        subgraph "Generator Layer\n(Node.js Scripts)" 
            direction TB
            IconsJS["Icons.js"]:::code
            ReleaseJS["release.js"]:::code
            IconsDir["Icon Assets Directory\n(scripts/Icons/)"]:::code
        end
        appsJSON -->|read apps.json| IconsJS
        appsJSON -->|read apps.json| ReleaseJS
        packageJSON -->|provides deps & scripts| IconsJS
        packageLock -->|locks deps| IconsJS
    end

    %% Build Layer
    subgraph "Build Layer\n(Tauri/Rust)" 
        direction TB
        Cargo["Cargo.toml"]:::code
        BuildRS["build.rs"]:::code
        MainRS["src/main.rs"]:::code
        TAURIConf["tauri.conf.json"]:::code
        HTML["HTML Template\n(src/index.html)"]:::code
    end
    IconsDir -->|copy assets| BuildRS
    ReleaseJS -->|inject config| TAURIConf
    HTML -->|loaded in webview| MainRS
    Cargo -->|defines Rust project| BuildRS
    BuildRS -->|pre-build hooks| MainRS

    %% CI/CD Pipeline
    subgraph "CI Runner"
        direction TB
        CI["GitHub Actions Pipeline\n(.github/workflows/release.yml)"]:::code
    end
    CI -->|installs Node & Rust| IconsJS
    CI -->|runs scripts| ReleaseJS
    CI -->|npm run build / tauri build| BuildRS
    CI -->|collect artifacts| Artifacts

    %% Artifacts and Releases
    Artifacts["Native Installers\n(.exe, .dmg, .deb)"]:::artifacts
    GitHub["GitHub Releases"]:::external

    Artifacts -->|publish release assets| GitHub

    %% Flow from Local to CI
    subgraph "Workflow"
        direction TB
        appsJSON -->|commit & push| CI
    end

    %% Click Events
    click appsJSON "https://github.com/get-winfig/winfig-apps/blob/main/scripts/apps.json"
    click IconsJS "https://github.com/get-winfig/winfig-apps/blob/main/scripts/Icons.js"
    click ReleaseJS "https://github.com/get-winfig/winfig-apps/blob/main/scripts/release.js"
    click IconsDir "https://github.com/get-winfig/winfig-apps/tree/main/scripts/Icons/"
    click Cargo "https://github.com/get-winfig/winfig-apps/blob/main/src-tauri/Cargo.toml"
    click BuildRS "https://github.com/get-winfig/winfig-apps/blob/main/src-tauri/build.rs"
    click MainRS "https://github.com/get-winfig/winfig-apps/blob/main/src-tauri/src/main.rs"
    click TAURIConf "https://github.com/get-winfig/winfig-apps/blob/main/src-tauri/tauri.conf.json"
    click HTML "https://github.com/get-winfig/winfig-apps/blob/main/src/index.html"
    click CI "https://github.com/get-winfig/winfig-apps/blob/main/.github/workflows/release.yml"
    click packageJSON "https://github.com/get-winfig/winfig-apps/blob/main/package.json"
    click packageLock "https://github.com/get-winfig/winfig-apps/blob/main/package-lock.json"

    %% Styles
    classDef code fill:#CCE5FF,stroke:#3399FF,color:#000;
    classDef config fill:#D4EDDA,stroke:#28A745,color:#000;
    classDef external fill:#FFE5B4,stroke:#FFA500,color:#000;
    classDef artifacts fill:#E0E0E0,stroke:#A9A9A9,color:#000;
```
