# tusharganvir21/simple-game-website architecture

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

- Interactive diagram: https://gitdiagram.com/tusharganvir21/simple-game-website
- Repository: https://github.com/tusharganvir21/simple-game-website

## Overview

##### Project Type & Purpose
- The project is a full-stack web application intended for playing interactive games (Rock-Paper-Scissors, Tic-Tac-Toe, Slide Puzzle and Quiz).
- It is built primarily using HTML, CSS, JavaScript, PHP, and MySQL, and it also includes login and signup functionality for user management.
- The purpose is to provide a college project that allows users to register, log in, and then enjoy several games from a central “home” interface.

##### Identifying the Main Components
- Frontend:
- The “Home-page” directory contains the main user interface including index pages, game-specific subdirectories (rock-paper-scissor, slide-puzzle, tic-tac-toe) each with their own styling, JavaScript, and PHP scripts.
- Static assets such as CSS files, images, and JS files used to render the various game interfaces and the overall website layout.
- Authentication Module:
- The “login” directory holds PHP scripts for login, signup, and logout functionalities along with supporting CSS, images, and functions.
- It handles user input, session management, and securely interfaces with the backend.
- Quiz Module:
- The “quiz” directory contains files that manage the quiz game, including PHP scripts for connecting to the database, checking answers, and displaying results.
- A SQL file (quiz_db.sql) guides the database schema setup for quiz data.
- Database:
- The project uses MySQL (as indicated by the SQL file in the quiz module and PHP connect scripts), managing users’ account information and quiz-related data.

##### Analyzing the File Structure for Architectural Patterns
- The project is organized by feature areas (Home-page, login, quiz) rather than by layered separation. However, there is a logical separation between presentation (HTML/CSS/JS), business logic (PHP scripts and functions), and data (MySQL).
- Shared resources and style files in the main Home-page directory which indicate a common look and feel across modules.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client
    Browser("User's Browser"):::client

    %% Frontend Layer
    subgraph "Frontend Layer"
        HomePage("Home Page & Shared Assets"):::frontend
        RPS("Rock-Paper-Scissors Module"):::frontend
        Slide("Slide Puzzle Module"):::frontend
        TTT("Tic-Tac-Toe Module"):::frontend
        Quiz("Quiz Module"):::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Auth("Authentication Module"):::backend
        GameLogic("Game Logic (PHP Scripts)"):::backend
    end

    %% Database Layer
    Database(("MySQL Database")):::database

    %% Relationships
    Browser -->|"HTTP_request"| HomePage
    HomePage -->|"navigate"| RPS
    HomePage -->|"navigate"| Slide
    HomePage -->|"navigate"| TTT
    HomePage -->|"access"| Quiz
    HomePage -->|"login"| Auth
    RPS -->|"process_game"| GameLogic
    Slide -->|"process_game"| GameLogic
    TTT -->|"process_game"| GameLogic
    Auth -->|"validate_user"| Database
    Quiz -->|"quiz_logic"| Database
    GameLogic -->|"data_exchange"| Database

    %% Click Events
    click HomePage "https://github.com/tusharganvir21/simple-game-website/tree/main/Home-page"
    click RPS "https://github.com/tusharganvir21/simple-game-website/tree/main/Home-page/rock-paper-scissor"
    click Slide "https://github.com/tusharganvir21/simple-game-website/tree/main/Home-page/slide-puzzle"
    click TTT "https://github.com/tusharganvir21/simple-game-website/tree/main/Home-page/tic-tac-toe"
    click Auth "https://github.com/tusharganvir21/simple-game-website/tree/main/login"
    click Quiz "https://github.com/tusharganvir21/simple-game-website/tree/main/quiz"
    click Database "https://github.com/tusharganvir21/simple-game-website/blob/main/quiz/SQLFile/quiz_db.sql"

    %% Styles
    classDef client fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef frontend fill:#aed6f1,stroke:#2e86c1,stroke-width:2px;
    classDef backend fill:#a9dfbf,stroke:#239b56,stroke-width:2px;
    classDef database fill:#f5cba7,stroke:#d35400,stroke-width:2px;
```
