# tylp/advent-of-code-2024 architecture

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

- Interactive diagram: https://gitdiagram.com/tylp/advent-of-code-2024
- Repository: https://github.com/tylp/advent-of-code-2024

## Overview

##### Main components
- GitHub Actions CI/CD Pipeline: Represent the .github/workflows/rust.yml file as the continuous integration component that automates builds and tests.
- Project Entry Point / Workspace: Even if not defined explicitly as a workspace, the top-level Cargo.toml and the overall directory (including the puzzles folder) act as the central entry point.
- Puzzle Modules (Day1, Day2, etc.): Each “day” subdirectory under puzzles (e.g., puzzles/day1, puzzles/day2, …) is its own Rust package/crate. In each, the main.rs is the executable entry file.
- Rust Toolchain: Implicitly include the Cargo tool and Rust compiler, which are used to build and run the puzzles.

##### Relationships and interactions
- The Cargo commands (such as “cargo run -p day1 …”) indicate that the Rust Cargo tool is responsible for resolving dependencies and building each puzzle crate.

##### Important architectural patterns
- Modularization: The project is modularized by separating each day's puzzle into its own crate, thereby isolating functionality and dependencies.
- CI/CD: The GitHub Actions workflow shows a modern DevOps pattern integrating automated testing and building.

##### Mention key technologies, frameworks, or libraries
- Rust as the programming language.
- Cargo as the build and package management tool.
- GitHub Actions for CI/CD integration.
- The standard Rust project structure (Cargo.toml, src/main.rs) which dictates how each component (crate) is built and executed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    P0["Advent of Code 2024 Project"]:::project
    workspace["Workspace (Cargo.toml)"]:::workspace
    ci_cd["GitHub Actions CI/CD Pipeline"]:::cicd
    toolchain["Rust Toolchain (Cargo & Rust Compiler)"]:::toolchain

    %% Top-level project structure
    P0 -->|"contains"| workspace
    P0 -->|"contains"| ci_cd
    workspace -->|"manages"| PM

    ci_cd -->|"CI_trigger"| workspace

    %% Puzzles Modules subgraph
    subgraph "Puzzles Modules"
        direction TB
        %% Day 1 Module
        day1["Day 1 Puzzle Module"]:::puzzleContainer
        subgraph "Day 1 Files"
            direction TB
            day1Cargo["Cargo.toml"]:::file
            day1Readme["README.md"]:::file
            day1Main["src/main.rs"]:::file
        end
        day1 --- day1Cargo
        day1 --- day1Readme
        day1 --- day1Main

        %% Day 2 Module
        day2["Day 2 Puzzle Module"]:::puzzleContainer
        subgraph "Day 2 Files"
            direction TB
            day2Cargo["Cargo.toml"]:::file
            day2Readme["README.md"]:::file
            day2Main["src/main.rs"]:::file
        end
        day2 --- day2Cargo
        day2 --- day2Readme
        day2 --- day2Main

        %% Day 3 Module
        day3["Day 3 Puzzle Module"]:::puzzleContainer
        subgraph "Day 3 Files"
            direction TB
            day3Cargo["Cargo.toml"]:::file
            day3Readme["README.md"]:::file
            day3Main["src/main.rs"]:::file
        end
        day3 --- day3Cargo
        day3 --- day3Readme
        day3 --- day3Main

        %% Day 4 Module
        day4["Day 4 Puzzle Module"]:::puzzleContainer
        subgraph "Day 4 Files"
            direction TB
            day4Cargo["Cargo.toml"]:::file
            day4Readme["README.md"]:::file
            day4Main["src/main.rs"]:::file
        end
        day4 --- day4Cargo
        day4 --- day4Readme
        day4 --- day4Main

        %% Day 5 Module
        day5["Day 5 Puzzle Module"]:::puzzleContainer
        subgraph "Day 5 Files"
            direction TB
            day5Cargo["Cargo.toml"]:::file
            day5Readme["README.md"]:::file
            day5Main["src/main.rs"]:::file
        end
        day5 --- day5Cargo
        day5 --- day5Readme
        day5 --- day5Main

        %% Day 6 Module
        day6["Day 6 Puzzle Module"]:::puzzleContainer
        subgraph "Day 6 Files"
            direction TB
            day6Cargo["Cargo.toml"]:::file
            day6Readme["README.md"]:::file
            day6Main["src/main.rs"]:::file
        end
        day6 --- day6Cargo
        day6 --- day6Readme
        day6 --- day6Main

        %% Day 11 Module
        day11["Day 11 Puzzle Module"]:::puzzleContainer
        subgraph "Day 11 Files"
            direction TB
            day11Cargo["Cargo.toml"]:::file
            day11Readme["README.md"]:::file
            day11Main["src/main.rs"]:::file
        end
        day11 --- day11Cargo
        day11 --- day11Readme
        day11 --- day11Main
    end

    %% Connect Workspace to each Puzzle Module
    workspace -->|"builds"| day1
    workspace -->|"builds"| day2
    workspace -->|"builds"| day3
    workspace -->|"builds"| day4
    workspace -->|"builds"| day5
    workspace -->|"builds"| day6
    workspace -->|"builds"| day11

    %% Each Puzzle Module uses the Rust Toolchain for building & execution
    day1 -->|"cargo_build"| toolchain
    day2 -->|"cargo_build"| toolchain
    day3 -->|"cargo_build"| toolchain
    day4 -->|"cargo_build"| toolchain
    day5 -->|"cargo_build"| toolchain
    day6 -->|"cargo_build"| toolchain
    day11 -->|"cargo_build"| toolchain

    %% Click Events for top-level components
    click workspace "https://github.com/tylp/advent-of-code-2024/blob/main/Cargo.toml"
    click ci_cd "https://github.com/tylp/advent-of-code-2024/blob/main/.github/workflows/rust.yml"

    %% Click Events for Day 1 Puzzle Module and its files
    click day1 "https://github.com/tylp/advent-of-code-2024/tree/main/puzzles/day1"
    click day1Cargo "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day1/Cargo.toml"
    click day1Readme "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day1/README.md"
    click day1Main "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day1/src/main.rs"

    %% Click Events for Day 2 Puzzle Module and its files
    click day2 "https://github.com/tylp/advent-of-code-2024/tree/main/puzzles/day2"
    click day2Cargo "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day2/Cargo.toml"
    click day2Readme "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day2/README.md"
    click day2Main "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day2/src/main.rs"

    %% Click Events for Day 3 Puzzle Module and its files
    click day3 "https://github.com/tylp/advent-of-code-2024/tree/main/puzzles/day3"
    click day3Cargo "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day3/Cargo.toml"
    click day3Readme "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day3/README.md"
    click day3Main "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day3/src/main.rs"

    %% Click Events for Day 4 Puzzle Module and its files
    click day4 "https://github.com/tylp/advent-of-code-2024/tree/main/puzzles/day4"
    click day4Cargo "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day4/Cargo.toml"
    click day4Readme "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day4/README.md"
    click day4Main "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day4/src/main.rs"

    %% Click Events for Day 5 Puzzle Module and its files
    click day5 "https://github.com/tylp/advent-of-code-2024/tree/main/puzzles/day5"
    click day5Cargo "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day5/Cargo.toml"
    click day5Readme "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day5/README.md"
    click day5Main "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day5/src/main.rs"

    %% Click Events for Day 6 Puzzle Module and its files
    click day6 "https://github.com/tylp/advent-of-code-2024/tree/main/puzzles/day6"
    click day6Cargo "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day6/Cargo.toml"
    click day6Readme "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day6/README.md"
    click day6Main "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day6/src/main.rs"

    %% Click Events for Day 11 Puzzle Module and its files
    click day11 "https://github.com/tylp/advent-of-code-2024/tree/main/puzzles/day11"
    click day11Cargo "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day11/Cargo.toml"
    click day11Readme "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day11/README.md"
    click day11Main "https://github.com/tylp/advent-of-code-2024/blob/main/puzzles/day11/src/main.rs"

    %% Styles
    classDef project fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef workspace fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef puzzleContainer fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef file fill:#d9d9d9,stroke:#333,stroke-width:1px;
    classDef toolchain fill:#ffe0cc,stroke:#333,stroke-width:2px;
```
