# mohammadaahnaaf/puzzellia architecture

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

- Interactive diagram: https://gitdiagram.com/mohammadaahnaaf/puzzellia
- Repository: https://github.com/mohammadaahnaaf/puzzellia

## Overview

##### Main Components Identification

The system architecture should be represented as follows:

a. Client-Side Components:
- Pages Layer (Entry Points)
- Game Components Layer
- Shared Components Layer
- Data Layer

b. Build & Configuration:
- Next.js Configuration
- TypeScript Configuration
- Styling Configuration (Tailwind CSS)

**┌─ Next.js Application**
- Pages (Entry Points)
- Components
- Data Layer

**┌─ Components**
- Games Module
- Geometry
- Math
- Maze
- Number
- Protractor
- Sudoku
- Thermometer
- Trigonometry
- Home Module
- Layouts Module
- Shared Module

##### Component Relationships

- Data flow between components
- Component inheritance
- Page routing
- State management

##### Specific Implementation Details

For each game component, show:
- Board component
- SVG component
- Game logic component
- Data structure

##### Key Architectural Patterns to Highlight

- Next.js Pages Router architecture
- Component-based structure
- Shared component reusability
- Game module isolation

Create distinct sections for:
a. Frontend Architecture
- Page components
- Game components
- Shared components
- Routing system

b. Data Flow
- Game state management
- Component communication
- API interactions

c. Build & Deploy
- Next.js configuration
- Environment variables
- Vercel deployment

##### Additional Elements

Include:
- Version information
- Technology stack badges
- Component responsibility descriptions

##### Clear data flow between components

Remember to include a note about the scalability of the architecture for adding new games and features, as this appears to be a growing educational platform.

This system design should provide a clear understanding of how Puzzellia's educational games are structured and how they interact within the Next.js framework while maintaining clean separation of concerns and reusable components.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph NextApp["Next.js Application"]
        direction TB
        
        subgraph FrontEnd["Frontend Architecture"]
            direction TB
            
            Pages["Pages Layer"]:::pages
            GameComp["Game Components"]:::gamecomp
            SharedComp["Shared Components"]:::shared
            DataLayer["Data Layer"]:::data
            
            Pages --> GameComp
            Pages --> SharedComp
            GameComp --> DataLayer
            SharedComp --> DataLayer
        end
        
        subgraph Games["Game Modules"]
            direction TB
            Geometry["Geometry"]:::game
            Math["Math"]:::game
            Maze["Maze"]:::game
            Number["Number"]:::game
            Protractor["Protractor"]:::game
            Sudoku["Sudoku"]:::game
            Thermometer["Thermometer"]:::game
            Trigonometry["Trigonometry"]:::game
        end
        
        subgraph Core["Core Components"]
            direction TB
            Home["Home Module"]:::core
            Layout["Layout Module"]:::core
            AppEntry["App Entry Point"]:::core
            API["API Routes"]:::core
        end
        
        subgraph Config["Configuration"]
            direction TB
            NextConfig["Next.js Config"]:::config
            TSConfig["TypeScript Config"]:::config
            TailwindConfig["Tailwind Config"]:::config
            GlobalStyles["Global Styles"]:::config
        end
        
        subgraph Data["Data Management"]
            direction TB
            GameData["Game Data Structures"]:::data
            CatData["Categories Data"]:::data
        end
    end
    
    %% Component Relationships
    GameComp --> Games
    Core --> Pages
    Data --> GameComp
    Config --> NextApp
    
    %% Styling
    classDef pages fill:#3498db
    classDef gamecomp fill:#2ecc71
    classDef shared fill:#e67e22
    classDef data fill:#9b59b6
    classDef config fill:#95a5a6
    classDef game fill:#27ae60
    classDef core fill:#34495e
    
    %% Click Events
    click Pages "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/pages"
    click GameComp "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games"
    click SharedComp "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/shared"
    click DataLayer "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/data"
    click Home "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/home"
    click Layout "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/layouts"
    click NextConfig "https://github.com/mohammadaahnaaf/puzzellia/blob/main/next.config.js"
    click TSConfig "https://github.com/mohammadaahnaaf/puzzellia/blob/main/tsconfig.json"
    click TailwindConfig "https://github.com/mohammadaahnaaf/puzzellia/blob/main/tailwind.config.js"
    click Geometry "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/geomatry"
    click Math "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/math"
    click Maze "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/maze"
    click Number "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/number"
    click Protractor "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/protractor"
    click Sudoku "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/sudoku"
    click Thermometer "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/thermometer"
    click Trigonometry "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/components/games/trigonomatry"
    click GlobalStyles "https://github.com/mohammadaahnaaf/puzzellia/blob/main/src/styles/globals.css"
    click AppEntry "https://github.com/mohammadaahnaaf/puzzellia/blob/main/src/pages/_app.tsx"
    click API "https://github.com/mohammadaahnaaf/puzzellia/tree/main/src/pages/api"
    click GameData "https://github.com/mohammadaahnaaf/puzzellia/blob/main/src/data/games.tsx"
    click CatData "https://github.com/mohammadaahnaaf/puzzellia/blob/main/src/data/categories.ts"
```
