# stanislavcodes/advent-of-code architecture

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

## Overview

##### Main Components

a. Runner System:
- Entry point (index.ts) as the central orchestrator
- Day-specific solution modules
- Input handling system

b. Solution Structure:
- Individual day modules (day1 through day11)
- Part A and B solutions for each day
- Input file processing

**[Runner System (index.ts)]**
- ↓
**[Day Module Manager]**
- ↙     ↓     ↘
**[Day 1]  [Day 2]  [Day N]**
- ↙ ↘     ↙ ↘     ↙ ↘
**[A] [B]  [A] [B]  [A] [B]**
- ↓   ↓    ↓   ↓    ↓   ↓
**[Input Processing Layer]**

##### Specific Elements

a. Core Components:
- Main Runner (index.ts)
- Day Module Interface
- Solution Interface (A/B pattern)
- Input Handler

b. Flow Indicators:
- Solution execution path
- Input data flow
- Result output flow

##### Technical Details to Highlight

- TypeScript implementation (shown by .ts extensions)
- Bun runtime environment
- File-based input handling system
- Dual solution pattern (A/B parts)

##### Implementation Notes

- The modular nature of the solutions
- The consistent pattern across days
- The separation of concerns between running code and solving problems
- The standardized input handling approach

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core
        Runner["Main Runner"]
        DayManager["Day Module Manager"]
        InputHandler["Input Processing Layer"]
    end

    subgraph "Day Modules"
        Day1["Day 1 Module"]
        Day2["Day 2 Module"]
        Day3["Day 3 Module"]
        DayN["Day 11 Module"]
    end

    subgraph "Solutions"
        Day1A["Day 1 Part A"]:::solution
        Day1B["Day 1 Part B"]:::solution
        Day2A["Day 2 Part A"]:::solution
        Day2B["Day 2 Part B"]:::solution
        DayNA["Day 11 Part A"]:::solution
        DayNB["Day 11 Part B"]:::solution
    end

    subgraph "Input Files"
        Input1[(Day 1 Input)]:::input
        Input2[(Day 2 Input)]:::input
        InputN[(Day 11 Input)]:::input
    end

    subgraph "Configuration"
        TSConfig["TypeScript Config"]:::config
        PackageJson["Package Config"]:::config
        BunLock["Bun Lock File"]:::config
    end

    %% Core relationships
    Runner --> DayManager
    DayManager --> InputHandler
    
    %% Day module relationships
    DayManager --> Day1
    DayManager --> Day2
    DayManager --> Day3
    DayManager --> DayN

    %% Solution relationships
    Day1 --> Day1A
    Day1 --> Day1B
    Day2 --> Day2A
    Day2 --> Day2B
    DayN --> DayNA
    DayN --> DayNB

    %% Input relationships
    Day1A & Day1B --> Input1
    Day2A & Day2B --> Input2
    DayNA & DayNB --> InputN

    %% Configuration relationships
    TSConfig -.-> Runner
    PackageJson -.-> Runner
    BunLock -.-> Runner

    %% Styling
    classDef solution fill:#FFE873
    classDef input fill:#D3D3D3
    classDef config fill:#90EE90

    %% Click events
    click Runner "https://github.com/stanislavcodes/advent-of-code/blob/2024/index.ts"
    click TSConfig "https://github.com/stanislavcodes/advent-of-code/blob/2024/tsconfig.json"
    click PackageJson "https://github.com/stanislavcodes/advent-of-code/blob/2024/package.json"
    click BunLock "https://github.com/stanislavcodes/advent-of-code/blob/2024/bun.lockb"
    click Day1 "https://github.com/stanislavcodes/advent-of-code/tree/2024/day1"
    click Day2 "https://github.com/stanislavcodes/advent-of-code/tree/2024/day2"
    click Day3 "https://github.com/stanislavcodes/advent-of-code/tree/2024/day3"
    click DayN "https://github.com/stanislavcodes/advent-of-code/tree/2024/day11"
    click Day1A "https://github.com/stanislavcodes/advent-of-code/blob/2024/day1/a.ts"
    click Day1B "https://github.com/stanislavcodes/advent-of-code/blob/2024/day1/b.ts"
    click Day2A "https://github.com/stanislavcodes/advent-of-code/blob/2024/day2/a.ts"
    click Day2B "https://github.com/stanislavcodes/advent-of-code/blob/2024/day2/b.ts"
    click DayNA "https://github.com/stanislavcodes/advent-of-code/blob/2024/day11/a.ts"
    click Input1 "https://github.com/stanislavcodes/advent-of-code/blob/2024/day1/input.txt"
    click Input2 "https://github.com/stanislavcodes/advent-of-code/blob/2024/day2/input.txt"
    click InputN "https://github.com/stanislavcodes/advent-of-code/blob/2024/day11/input.txt"
```
