# zikk/adventofcode architecture

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

- Interactive diagram: https://gitdiagram.com/zikk/adventofcode
- Repository: https://github.com/zikk/adventofcode

## Overview

##### Main Components

a. Language-Specific Solution Modules:
- Rust Solutions Module (src/bin/*.rs files)
- TypeScript Solutions Module (src/ts/*.ts files)

b. Build and Configuration Layer:
- Rust Configuration (Cargo.toml)
- TypeScript Configuration (tsconfig.json, package.json)
- Bun Runtime Environment (indicated by bun.lockb)
- Go Module (indicated by go.mod)

**┌─ Solution Layer ─────────────────────────┐**

- ┌─ Rust Solutions ┐ ┌─ TS Solutions ─┐ │
- Day 1-16     │ │    Day 1-3     │ │
- (Individual   │ │   (Individual   │ │
- Binaries)    │ │    Modules)    │ │
- ┘ └───────────────┘  │

- ┘

**┌─ Build & Configuration Layer ────────────┐**

- ┌─ Rust ─────┐ ┌─ TypeScript ────┐    │
- Cargo.toml │ │ tsconfig.json   │    │
- Cargo.lock │ │ package.json    │    │
- ┘ └────────────────┘     │

- ┌─ Runtime ───┐ ┌─ Other ────────┐    │
- Bun Runtime │ │ Go Module      │    │
- ┘ └────────────────┘     │

- ┘

##### Important Elements to Highlight

a. Solution Structure:
- How each day's solutions are independent executables in Rust
- Demonstrate the parallel TypeScript implementation structure
- Separation between languages while solving the same problems

b. Build System:
- How Cargo manages Rust builds
- TypeScript compilation flow
- Bun's role in running TypeScript code

##### Relationships

- Rust source files → Cargo build system → Executable binaries
- TypeScript source files → TypeScript compiler → Bun runtime
- Configuration files → Their respective language environments

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph SolutionLayer["Solution Layer"]
        subgraph RustSolutions["Rust Solutions"]
            RustBin["Day 1-16 Solutions"]:::rust
        end
        
        subgraph TSSolutions["TypeScript Solutions"]
            TSModules["Day 1-3 Solutions"]:::typescript
            TSEntry["Entry Point"]:::typescript
        end
    end

    subgraph BuildLayer["Build & Configuration Layer"]
        subgraph RustConfig["Rust Configuration"]
            CargoToml["Cargo.toml"]:::config
            CargoLock["Cargo.lock"]:::config
        end

        subgraph TSConfig["TypeScript Configuration"]
            TSConfigJson["tsconfig.json"]:::config
            PackageJson["package.json"]:::config
        end

        subgraph Runtime["Runtime Environment"]
            BunRuntime["Bun Runtime"]:::runtime
            BunLock["bun.lockb"]:::config
        end

        subgraph OtherConfig["Other Configuration"]
            GoMod["go.mod"]:::config
            VSCode[".vscode"]:::config
        end
    end

    %% Relationships
    RustBin --> CargoToml
    CargoToml --> CargoLock
    
    TSModules --> TSConfigJson
    TSModules --> TSEntry
    TSEntry --> BunRuntime
    TSConfigJson --> PackageJson
    PackageJson --> BunLock
    BunLock --> BunRuntime

    %% Styling
    classDef rust fill:#6082B6,stroke:#333,stroke-width:2px
    classDef typescript fill:#F7DF1E,stroke:#333,stroke-width:2px
    classDef config fill:#A9A9A9,stroke:#333,stroke-width:2px
    classDef runtime fill:#90EE90,stroke:#333,stroke-width:2px

    %% Click events
    click RustBin "https://github.com/zikk/adventofcode/tree/2024/src/bin/"
    click TSModules "https://github.com/zikk/adventofcode/tree/2024/src/ts/"
    click CargoToml "https://github.com/zikk/adventofcode/blob/2024/Cargo.toml"
    click CargoLock "https://github.com/zikk/adventofcode/blob/2024/Cargo.lock"
    click TSConfigJson "https://github.com/zikk/adventofcode/blob/2024/tsconfig.json"
    click PackageJson "https://github.com/zikk/adventofcode/blob/2024/package.json"
    click BunLock "https://github.com/zikk/adventofcode/blob/2024/bun.lockb"
    click GoMod "https://github.com/zikk/adventofcode/blob/2024/go.mod"
    click TSEntry "https://github.com/zikk/adventofcode/blob/2024/index.ts"
    click VSCode "https://github.com/zikk/adventofcode/tree/2024/.vscode/"
```
