# aisouler/gkd_subscription architecture

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

- Interactive diagram: https://gitdiagram.com/aisouler/gkd_subscription
- Repository: https://github.com/aisouler/gkd_subscription

## Overview

This project is a subscription rule generator for the GKD system. In essence, it collects and processes a huge variety of app-specific rules (each defined in separate TypeScript files under the src/apps directory) to build a JSON5 subscription file (and related versioning/changelog files) that clients of GKD can pull and use. The project also includes well-defined build and CI/CD automation (via scripts and GitHub workflows) along with configurations for code style (Prettier, ESLint) and version control.

##### Main Components
- Source Code Repository:
- Src directory, particularly the src/apps folder that contains hundreds of TypeScript files representing individual app rules.
- Other configuration files (e.g., tsconfig.json, commitlint.config.ts) and global files (e.g., selectors, subscription definitions) that support the functioning of these rules.
- Build Scripts & Tools:
- Scripts directory containing build.ts, check.ts, and updateReadMeMd.ts. These scripts coordinate the transformation of source files into distribution files.
- Configuration files for formatting and linting (.prettierrc.mjs, eslint.config.mjs) that ensure code quality.
- Distribution and Output:
- CI/CD Pipeline:
- .github/workflows directory where various workflow YAML files are stored (e.g., build_release.yml, pull_request_check.yml). Indicate that these automated workflows trigger on pushes, pull requests, or other repository events.
- External Integrations and Consumers:
- External clients of this subscription file — for example, the GKD client apps that download the JSON file via the npmmirror and GitHub raw URLs.
- A note about the APIs, documentation, and external contribution guidelines referenced in the README.
- Documentation & Community:
- A component for the documentation, including the detailed README, contribution guides (CONTRIBUTING.md), and the supplementary materials (Selectors.md and Template.md).

##### Relationships and Data Flow
- A flow from the individual rule files in src/apps being processed by the build scripts (in scripts/) to generate the subscription files in the dist folder.
- How the CI/CD workflows automatically run these build scripts when code is pushed or pull requests are created.
- Optionally, include a feedback loop to the GitHub Issues and Discussions components, where users report problems or request new rule adaptations.

##### Design Principles
- Modularity – each app rule contained in its own file, enabling easy additions or adjustments.
- Automated build pipeline that follows a continuous integration approach.
- Separation of concerns between rules (domain logic), build automation (scripts/CI), and distribution (dist).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Source Repository
    subgraph "Source Repository"
        SRC["Global Source & Configurations (src)"]:::repo
        APPS["Rule Files (src/apps)"]:::repo
    end

    %% Build & Automation
    subgraph "Build & Automation"
        BUILD["Build Scripts & Tools (scripts)"]:::build
        CI["CI/CD Workflows (.github/workflows)"]:::ci
    end

    DIST["Distribution Files (dist)"]:::dist
    DOCS["Documentation & Community"]:::docs
    EXTERNAL["External Clients (GKD Client Apps)"]:::external
    FEEDBACK["Feedback: GitHub Issues & Discussions"]:::feedback

    %% Data Flow
    APPS -->|"process"| BUILD
    SRC -->|"provides-config"| BUILD
    CI -->|"triggers"| BUILD
    BUILD -->|"generates"| DIST
    DIST -->|"accessible-to"| EXTERNAL
    DOCS -->|"guidelines-for"| EXTERNAL
    EXTERNAL -->|"feedback"| FEEDBACK
    FEEDBACK -->|"reports-to"| SRC

    %% Click Events
    click SRC "https://github.com/aisouler/gkd_subscription/tree/main/src"
    click APPS "https://github.com/aisouler/gkd_subscription/tree/main/src/apps"
    click BUILD "https://github.com/aisouler/gkd_subscription/tree/main/scripts"
    click CI "https://github.com/aisouler/gkd_subscription/tree/main/.github/workflows"
    click DIST "https://github.com/aisouler/gkd_subscription/tree/main/dist"
    click DOCS "https://github.com/aisouler/gkd_subscription/blob/main/README.md"

    %% Styles
    classDef repo fill:#e0f7fa,stroke:#333,stroke-width:2px;
    classDef build fill:#fff9c4,stroke:#333,stroke-width:2px;
    classDef ci fill:#ffccbc,stroke:#333,stroke-width:2px;
    classDef dist fill:#c8e6c9,stroke:#333,stroke-width:2px;
    classDef docs fill:#d1c4e9,stroke:#333,stroke-width:2px;
    classDef external fill:#ffcdd2,stroke:#333,stroke-width:2px;
    classDef feedback fill:#f0f4c3,stroke:#333,stroke-width:2px;
```
