# eddieonthecode/eddie-tetris architecture

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

- Interactive diagram: https://gitdiagram.com/eddieonthecode/eddie-tetris
- Repository: https://github.com/eddieonthecode/eddie-tetris

## Overview

##### Main Components
- User Interface Layer: This includes the index.html and the main App.tsx component that acts as the entry point into the application.
- Game Components: The core UI is broken into modular components under the src/components directory:
▪ Board Component – found under src/components/board, responsible for rendering the Tetris game board. Its SCSS styling and TypeScript logic indicate that it handles the gameplay grid and block positioning.
▪ Modal Component – under src/components/modal, which likely handles pop-up dialogs for notifications such as game over, instructions, or settings.
▪ Score Component – located in src/components/score to manage and display the game score.
- Domain Models and Enums:
▪ Enums (like mode.ts and move.ts) define the state and movement constants crucial for game logic.
- Configurations and Build/Tooling: Various configuration files (package.json, tailwind.config.js, postcss.config.js, tsconfig.json, vite.config.ts, etc.) indicate that the project is prepared to be run, built, and deployed within a standard modern JavaScript ecosystem.

##### Relationships and Interactions
- The index.html initiates the app, loading the compiled bundle generated via Vite.
- The Board component interacts with game logic objects such as blocks and moves, making use of enums and models to manage the game state.
- The Modal component acts as a conditional UI element, triggered based on game events (like pause or game over).
- The Score component receives state updates from App.tsx or the game logic layer, reflecting the user’s progress.
- External dependencies and tools (like Vite, Tailwind, and PostCSS) are involved in building, styling, and bundling the application.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: The entire UI is modular, with separation of concerns between game board, score display, and modal dialogs.
- Separation of Presentation and Domain Logic: The use of models and enums signifies that game state and behavior are maintained separately from the rendering logic.
- Use of Modern Tooling: The presence of Vite for bundling and a range of configuration files (including devcontainer configurations) suggests that the project is designed for rapid development and deployment in a containerized environment if needed.

##### Relevant Technologies and Frameworks
- React with TypeScript: The primary language and library for building the UI.
- Vite: The build-tool responsible for fast bundling and hot module reloading.
- Tailwind CSS & PostCSS: For responsive styling and CSS preprocessing.
- SCSS: Used for styling specific components (board and modal), showing a mix of style management strategies.
- CodeSandbox and DevContainer Configurations: These suggest an emphasis on a consistent development environment and ease of onboarding.

## Diagram (Mermaid)

```mermaid
graph TD
    Eddie["Eddie Tetris"]:::main

    subgraph "Presentation/UI Layer"
        indexHTML["index.html"]:::ui
        AppTSX["App.tsx"]:::ui
        subgraph "Board Component"
            BoardTSX["Board TSX"]:::ui
            BoardSCSS["Board SCSS"]:::ui
        end
        subgraph "Modal Component"
            ModalTSX["Modal TSX"]:::ui
            ModalSCSS["Modal SCSS"]:::ui
        end
        Score["Score Component"]:::ui
    end

    subgraph "Domain/Game Logic Layer"
        BlockModel["Block Model"]:::domain
        ColorModel["Color Model"]:::domain
        ModeEnum["Mode Enum"]:::domain
        MoveEnum["Move Enum"]:::domain
    end

    subgraph "Build & Tooling Infrastructure"
        Pkg["package.json"]:::tool
        PostCSS["postcss.config.js"]:::tool
        Tailwind["tailwind.config.js"]:::tool
        TSConfig["tsconfig.json"]:::tool
        Vite["vite.config.ts"]:::tool
        Pnpm["pnpm-lock.yaml"]:::tool
        DevContainer[".devcontainer"]:::tool
        CodeSandbox[".codesandbox"]:::tool
    end

    Eddie --> indexHTML
    indexHTML -->|"loads"| AppTSX
    AppTSX -->|"renders"| BoardTSX
    AppTSX -->|"triggers"| ModalTSX
    AppTSX -->|"updates"| Score
    BoardTSX -->|"uses"| BlockModel
    BoardTSX -->|"uses"| ColorModel
    BoardTSX -->|"reads"| ModeEnum
    BoardTSX -->|"reads"| MoveEnum
    Vite -->|"bundles"| AppTSX
    Tailwind -->|"styles"| AppTSX
    PostCSS -->|"styles"| AppTSX

    click indexHTML "https://github.com/eddieonthecode/eddie-tetris/blob/main/index.html"
    click AppTSX "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/App.tsx"
    click BoardTSX "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/components/board/board.tsx"
    click BoardSCSS "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/components/board/board.scss"
    click ModalTSX "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/components/modal/modal.tsx"
    click ModalSCSS "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/components/modal/modal.scss"
    click Score "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/components/score/score.tsx"
    click BlockModel "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/models/block.ts"
    click ColorModel "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/models/color.ts"
    click ModeEnum "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/enums/mode.ts"
    click MoveEnum "https://github.com/eddieonthecode/eddie-tetris/blob/main/src/enums/move.ts"
    click Pkg "https://github.com/eddieonthecode/eddie-tetris/blob/main/package.json"
    click PostCSS "https://github.com/eddieonthecode/eddie-tetris/blob/main/postcss.config.js"
    click Tailwind "https://github.com/eddieonthecode/eddie-tetris/blob/main/tailwind.config.js"
    click TSConfig "https://github.com/eddieonthecode/eddie-tetris/blob/main/tsconfig.json"
    click Vite "https://github.com/eddieonthecode/eddie-tetris/blob/main/vite.config.ts"
    click Pnpm "https://github.com/eddieonthecode/eddie-tetris/blob/main/pnpm-lock.yaml"
    click DevContainer "https://github.com/eddieonthecode/eddie-tetris/blob/main/.devcontainer"
    click CodeSandbox "https://github.com/eddieonthecode/eddie-tetris/blob/main/.codesandbox"

    classDef main fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef ui fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef domain fill:#a9dfbf,stroke:#1e8449,stroke-width:2px;
    classDef tool fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
```
