# codebru/garden architecture

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

- Interactive diagram: https://gitdiagram.com/codebru/garden
- Repository: https://github.com/codebru/garden

## Overview

##### Main Components

a. Frontend Application Layer

b. Core Simulation Components
- As interconnected components within the main application

c. Rendering System
- To the simulation components

d. Infrastructure Layer
- Firebase hosting configuration
- GitHub Actions deployment workflow

##### Component Relationships

- index.js as the entry point, connecting to all major subsystems
- Utils module providing shared functionality across components
- Grid system organizing the simulation space

##### Technical Stack Elements

Technologies:
- Webpack (build system)
- Firebase (hosting platform)
- GitHub Actions (CI/CD)
- Browser Runtime Environment

- [Browser Environment]

- [Application Core (index.js)]

- [Simulation Components]
- Air System
- Dirt System
- Plant System
- Block System

- [Rendering Layer]
- Grid System

- [Shared Services]
- Constants
- Utils

- [Infrastructure]
- Firebase Hosting
- GitHub Actions

##### Special Notes

- Modular nature of the simulation components
- How the drawing system interfaces with the simulation state
- Entry point (index.js) as the orchestrator of all components
- Build process flow from source to deployed application

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Infrastructure
        FB[Firebase Hosting]:::infra
        GH[GitHub Actions]:::infra
    end

    subgraph "Build System"
        WP[Webpack]:::build
        HTML[HTML Template]:::build
        CSS[Styling]:::build
    end

    subgraph "Application Core"
        EP[Entry Point]:::core
        CG[Core Game Engine]:::core
    end

    subgraph "Rendering Layer"
        DS[Draw System]:::render
        GS[Grid System]:::render
    end

    subgraph "Element System"
        direction TB
        EM[Element Manager]:::element
        AE[Air Element]:::element
        DE[Dirt Element]:::element
        PE[Plant Element]:::element
        BE[Block Element]:::element
    end

    subgraph "Support Layer"
        direction TB
        CM[Constants Manager]:::support
        CC[Color Constants]:::support
        UT[Utilities]:::support
    end

    %% Infrastructure Connections
    GH --> FB
    WP --> FB

    %% Build System Connections
    HTML --> WP
    CSS --> WP
    EP --> WP

    %% Core Connections
    EP --> CG
    CG --> DS
    CG --> GS
    
    %% Element System Connections
    EM --> AE
    EM --> DE
    EM --> PE
    EM --> BE
    CG --> EM

    %% Support Layer Connections
    CM --> CG
    CC --> CM
    UT --> CG
    UT --> EM

    %% Click Events
    click DS "https://github.com/codebru/garden/blob/main/src/draw.js"
    click GS "https://github.com/codebru/garden/blob/main/src/grid.js"
    click AE "https://github.com/codebru/garden/blob/main/src/air.js"
    click DE "https://github.com/codebru/garden/blob/main/src/dirt.js"
    click PE "https://github.com/codebru/garden/blob/main/src/plant.js"
    click BE "https://github.com/codebru/garden/blob/main/src/block.js"
    click CM "https://github.com/codebru/garden/blob/main/src/constants/index.js"
    click CC "https://github.com/codebru/garden/blob/main/src/constants/colors.js"
    click UT "https://github.com/codebru/garden/blob/main/src/utils.js"
    click EP "https://github.com/codebru/garden/blob/main/src/index.js"
    click CSS "https://github.com/codebru/garden/blob/main/src/main.css"
    click HTML "https://github.com/codebru/garden/blob/main/src/index.html"
    click WP "https://github.com/codebru/garden/blob/main/webpack.config.js"
    click FB "https://github.com/codebru/garden/blob/main/firebase.json"
    click GH "https://github.com/codebru/garden/tree/main/.github/workflows"

    %% Styling
    classDef infra fill:#gray,stroke:#333,stroke-width:2px
    classDef build fill:#f9d71c,stroke:#333,stroke-width:2px
    classDef core fill:#ff6b6b,stroke:#333,stroke-width:2px
    classDef render fill:#4ecdc4,stroke:#333,stroke-width:2px
    classDef element fill:#45b7d1,stroke:#333,stroke-width:2px
    classDef support fill:#96ceb4,stroke:#333,stroke-width:2px
```
