# best-of-lists/best-of architecture

> Architecture diagram of the GitHub repository best-of-lists/best-of, 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/best-of-lists/best-of
- Repository: https://github.com/best-of-lists/best-of

## Overview

##### Main Components
- Repository Core: Represent the GitHub repository as the central codebase. This includes:
- The README.md and accompanying markdown files (config/header.md, config/footer.md) that form the presentation layer.
- The projects.yaml file containing the core list data.
- History and change logs in the “history” directory that record updates and project changes.
- Automation Workflows: Indicate the .github/workflows components. These workflows (e.g., setup-best-of-list.yml and update-best-of-list.yml) run automated tasks such as pulling in new changes, updating scores, and regenerating the markdown pages.
- Contribution and Template System: Include folders like “template” and CONTRIBUTING.md that help structure contributions and guidelines for adding new projects.
- External Integration: Optionally display how the system might interact with external APIs (such as GitHub’s API for star counts, package manager APIs, etc.) that feed into the “project-quality score” used for ranking.
- Best-of Generator: Mention the external best-of-generator (as referenced in the README) that might be used or integrated to help generate updated markdown or automate list creation, via scripts like create-best-of-list.md.

##### Relationships and Interactions
- User Contributions → GitHub (issues, pull requests): Users add or update project data either by editing projects.yaml or submitting change requests. This triggers the CI/CD workflows.
- GitHub Workflows → Data Processing: The workflows (triggered periodically or on changes) pull the latest information, process the configuration and history logs, and update the projects’ ranking and metadata.
- Data Processing → Markdown Generation: Processed data, combined with header/footer templates, is used to update the README and other static pages that showcase the “best-of” lists.
- External APIs → Data Enrichment: The project-quality score and other metrics (stars, forks, etc.) are likely fetched via external API calls that then get integrated by the workflows.

##### Important Architectural Patterns/Design Principles
- Separation of Concerns: Notice the clear separation between configuration (config/ and template/ directories), historical tracking (history/), core data (projects.yaml), and automated processing (GitHub workflows).
- Automation and CI/CD: The use of GitHub Actions emphasizes automation in updating and maintaining the curated lists.
- Template-Driven Generation: The project uses markdown (with separate header/footer templates) to dynamically generate a polished view of the curated lists.

##### Relevant Technologies/Frameworks
- GitHub Actions (YAML-based workflows) for CI/CD automation.
- Markdown as the presentation format.
- YAML for configuration and project data (projects.yaml).
- Likely external API integrations (GitHub API and possibly package manager APIs for metrics).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Contribution
    U["User Contributions (Issues/PRs)"]:::user

    %% GitHub Repository Subgraph
    subgraph "GitHub Repository"
        R1["README.md"]:::repo
        R1b1["config/header.md"]:::repo
        R1b2["config/footer.md"]:::repo
        R2["projects.yaml"]:::repo
        R3["Change History (history/)"]:::repo
        R4["Contribution Guidelines (CONTRIBUTING.md)"]:::repo
        R5["Template Files (template/)"]:::repo
        R5a["Template Contribution (template/CONTRIBUTING.md)"]:::repo
    end

    %% GitHub Workflows Subgraph
    subgraph "GitHub Workflows"
        W1["setup-best-of-list.yml"]:::workflow
        W2["update-best-of-list.yml"]:::workflow
    end

    %% External APIs, Best-of Generator and Output
    E["External APIs"]:::external
    G["Best-of Generator (create-best-of-list.md)"]:::generator
    O["Output Markdown (Updated README & Best-of Lists)"]:::output

    %% Connections
    U -->|"submits"| R1
    U -->|"follows"| R4

    %% Repository files feeding processing
    R2 -->|"processes"| W1
    R3 -->|"logs"| W1
    R5 -->|"applyTemplates"| O

    %% Repository triggers workflows
    R1 -->|"triggers"| W1

    %% Internal workflow chaining
    W1 -->|"chains"| W2
    W1 -->|"fetches"| E
    W1 -->|"integrates"| G

    %% Workflows and Generator update output
    W2 -->|"updates"| O
    G -->|"generates"| O

    %% Click Events for Repository Core
    click R1 "https://github.com/best-of-lists/best-of/blob/main/README.md"
    click R1b1 "https://github.com/best-of-lists/best-of/blob/main/config/header.md"
    click R1b2 "https://github.com/best-of-lists/best-of/blob/main/config/footer.md"
    click R2 "https://github.com/best-of-lists/best-of/blob/main/projects.yaml"
    click R3 "https://github.com/best-of-lists/best-of/tree/main/history/"
    click R4 "https://github.com/best-of-lists/best-of/blob/main/CONTRIBUTING.md"
    click R5 "https://github.com/best-of-lists/best-of/tree/main/template/"
    click R5a "https://github.com/best-of-lists/best-of/blob/main/template/CONTRIBUTING.md"

    %% Click Events for Automation Workflows
    click W1 "https://github.com/best-of-lists/best-of/blob/main/.github/workflows/setup-best-of-list.yml"
    click W2 "https://github.com/best-of-lists/best-of/blob/main/.github/workflows/update-best-of-list.yml"

    %% Click Event for Best-of Generator
    click G "https://github.com/best-of-lists/best-of/blob/main/create-best-of-list.md"

    %% Styles
    classDef user fill:#ffe6e6,stroke:#ff3333,stroke-width:2px
    classDef repo fill:#e6f2ff,stroke:#3366ff,stroke-width:2px
    classDef workflow fill:#e6ffe6,stroke:#33cc33,stroke-width:2px
    classDef external fill:#fff0e6,stroke:#ff9933,stroke-width:2px
    classDef generator fill:#f9e6ff,stroke:#9933ff,stroke-width:2px
    classDef output fill:#e6e6e6,stroke:#666666,stroke-width:2px
```
