# bedrock-oss/bds-versions architecture

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

- Interactive diagram: https://gitdiagram.com/bedrock-oss/bds-versions
- Repository: https://github.com/bedrock-oss/bds-versions

## Overview

##### Main Components
- Repository Archive – The core “database” of version information organized by OS (Linux and Windows) and by release type (stable versus preview). This is represented by:
– Directories containing JSON files for each version (e.g., linux, linux_preview, windows, windows_preview)
– The “versions.json” file which serves as an index for the latest stable version.
– Release notes directories for each operating system.
- Automation & CI/CD Pipeline – The GitHub Actions setup (found in the .github/workflows folder) and associated scripts (e.g., fetch.sh, readme.sh) that automatically update the archive.
- Consumers/Clients – The example in the README shows how external scripts or clients (like Curl commands via bash scripts) fetch the latest version info and download the corresponding JSON.

##### Relationships and Interactions
- The repository acts as a “data store” where updated JSON files and release notes are committed.
- The system is essentially “read-only” for consumers, allowing them to retrieve metadata about the BDS releases.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The repository is divided into logical sections—the version data (by OS and release type), the release notes, and the automation scripts.
- Automation through CI/CD: GitHub Actions manage the update cycle, ensuring that the repository remains current without manual intervention.
- Extensibility: The design supports the addition of new OS directories or new version types (stable vs. preview) with minimal disruption.
- Convention over configuration: The naming conventions (e.g., version numbers in filenames and directories) allow the system to be predictable and machine-readable.

##### Relevant Technologies & Libraries
- GitHub Actions for CI/CD automation.
- Shell scripting (Bash) and tools like curl, wget, and jq for data fetching and processing.
- JSON format as the primary data interchange format for version metadata.

##### Essential Elements
- Clear labels for:
- “GitHub Actions & Automation Scripts”
- “Linux Archive” (including linux and linux_preview)
- “Windows Archive” (including windows and windows_preview)
- “Release Notes” (for Linux and Windows)
- “version.json” as an index
- “Consumers/External Clients”
- Automation flow (from GitHub Actions to repository updates)
- Data delivery (from the repository to consumers via HTTP calls as shown in the README example)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Automation Pipeline"
        GA("GitHub Actions Workflow (fetch.yml)"):::automation
        FS("Fetch Script (fetch.sh)"):::automation
        RS("Readme Update Script (readme.sh)"):::automation
    end

    subgraph "Data Archive"
        DA("Latest Version Index (versions.json)"):::data

        subgraph "Linux Archive"
            LS("Stable JSON Files (linux)"):::data
            LP("Preview JSON Files (linux_preview)"):::data
        end

        subgraph "Windows Archive"
            WS("Stable JSON Files (windows)"):::data
            WP("Preview JSON Files (windows_preview)"):::data
        end

        subgraph "Release Notes Archive"
            RNL("Linux Release Notes (release_notes/linux)"):::notes
            RNP("Linux Preview Release Notes (release_notes/linux_preview)"):::notes
            RNW("Windows Release Notes (release_notes/windows)"):::notes
            RNWP("Windows Preview Release Notes (release_notes/windows_preview)"):::notes
        end
    end

    subgraph "Consumers"
        C1("README Documentation (README.md)"):::external
        C2("Usage Instructions (README/README.md)"):::external
    end

    %% Automation Pipeline Flow
    GA --> FS
    FS -->|"updates"| DA
    FS -->|"updates"| LS
    FS -->|"updates"| LP
    FS -->|"updates"| WS
    FS -->|"updates"| WP
    FS -->|"updates"| RNL
    FS -->|"updates"| RNP
    FS -->|"updates"| RNW
    FS -->|"updates"| RNWP

    %% Consumers Query Flow
    C1 -->|"query"| DA
    C2 -->|"query"| DA
    DA -->|"provides"| LS
    DA -->|"provides"| WS

    %% Click Events for Automation & CI/CD Pipeline
    click GA "https://github.com/bedrock-oss/bds-versions/blob/main/.github/workflows/fetch.yml"
    click FS "https://github.com/bedrock-oss/bds-versions/blob/main/fetch.sh"
    click RS "https://github.com/bedrock-oss/bds-versions/blob/main/readme.sh"
    
    %% Click Events for Data Archive
    click LS "https://github.com/bedrock-oss/bds-versions/tree/main/linux"
    click LP "https://github.com/bedrock-oss/bds-versions/tree/main/linux_preview"
    click WS "https://github.com/bedrock-oss/bds-versions/tree/main/windows"
    click WP "https://github.com/bedrock-oss/bds-versions/tree/main/windows_preview"
    click DA "https://github.com/bedrock-oss/bds-versions/blob/main/versions.json"
    click RNL "https://github.com/bedrock-oss/bds-versions/tree/main/release_notes/linux"
    click RNP "https://github.com/bedrock-oss/bds-versions/tree/main/release_notes/linux_preview"
    click RNW "https://github.com/bedrock-oss/bds-versions/tree/main/release_notes/windows"
    click RNWP "https://github.com/bedrock-oss/bds-versions/tree/main/release_notes/windows_preview"
    
    %% Click Events for Consumers
    click C1 "https://github.com/bedrock-oss/bds-versions/blob/main/README.md"
    click C2 "https://github.com/bedrock-oss/bds-versions/blob/main/README/README.md"

    classDef automation fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef data fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef notes fill:#ffdead,stroke:#333,stroke-width:2px;
    classDef external fill:#ffa07a,stroke:#333,stroke-width:2px;
```
