# hasanpayandeh/multiplayereggclicker architecture

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

- Interactive diagram: https://gitdiagram.com/hasanpayandeh/multiplayereggclicker
- Repository: https://github.com/hasanpayandeh/multiplayereggclicker

## Overview

##### Project Identification
- Project Type & Purpose: This is a competitive, multiplayer mobile game built with React Native (client-side) that communicates with a server developed using PHP and MySQL. The game’s purpose is to let players click on an egg as quickly as possible to score points in real-time rounds until one reaches a winning score.
- Key Technologies: React Native, PHP, MySQL; the project also uses Expo CLI for the mobile build process.

##### Break Down the File Structure
- Server-side: The Back-end folder contains PHP files (API.php and functions.php) which expose API endpoints and business logic. The mysql_structure.sql file indicates the database schema used by the backend.
- Assets: Contains images (like the ProjectLogo and screenshots) which are useful for visual branding and the user interface.

a. Client-Side:
- Subdivide or annotate that it includes a Login Page and a Match Page.
- Mention that it sends HTTP requests via fetch() calls (as seen in App.js, with endpoints for actions like login, retrieving match page data, and resetting the match).
b. Server-Side:
- API endpoints that the client interacts with (e.g., login, match data retrieval, reset match).
- That server-side logic interacts with the database.
c. Database:
d. Additional Infrastructure:

##### Relationships and Interactions
- Optionally, note state or session management aspects like user login sessions and match synchronization.

##### Highlighting Architectural Patterns & Technologies
- That the architecture follows a client-server design pattern.
- That the client-side is built in React Native (with Expo CLI used for builds) and the server-side is in PHP with MySQL as the data store.
- Mention design considerations – for instance, the need for synchronization (to counter slight time differences when eggs appear across devices) is handled on the server side.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Expo["Expo CLI"]:::build
    Assets["Assets & Branding"]:::assets
    Client["React Native Mobile Client (Includes Login Page & Match Page)"]:::client
    Hosting["Hosting Environment"]:::hosting
    Server["PHP Backend/API Server (Handles API endpoints & Game Logic)"]:::server
    DB["MySQL Database (Schema defined in mysql_structure.sql)"]:::database

    Expo --> Client
    Assets ---|"branding assets"| Client
    Client -->|"HTTPRequests(login,fetchMatch,reset)"| Server
    Server -->|"HTTPResponse"| Client
    Hosting --> Server
    Server -->|"CRUDOperations"| DB

    click Client "https://github.com/hasanpayandeh/multiplayereggclicker/blob/main/App.js"
    click Client "https://github.com/hasanpayandeh/multiplayereggclicker/blob/main/app.json"
    click Client "https://github.com/hasanpayandeh/multiplayereggclicker/blob/main/babel.config.js"
    click Client "https://github.com/hasanpayandeh/multiplayereggclicker/blob/main/package.json"
    
    click Server "https://github.com/hasanpayandeh/multiplayereggclicker/blob/main/Back-end/API.php"
    click Server "https://github.com/hasanpayandeh/multiplayereggclicker/blob/main/Back-end/functions.php"
    
    click DB "https://github.com/hasanpayandeh/multiplayereggclicker/blob/main/Back-end/mysql_structure.sql"
    
    click Assets "https://github.com/hasanpayandeh/multiplayereggclicker/tree/main/assets"

    classDef client fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef server fill:#ffcccb,stroke:#000,stroke-width:2px;
    classDef database fill:#d1c4e9,stroke:#000,stroke-width:2px;
    classDef build fill:#c3f0ca,stroke:#000,stroke-width:2px;
    classDef hosting fill:#fff2cc,stroke:#000,stroke-width:2px;
    classDef assets fill:#f8d7da,stroke:#000,stroke-width:2px;
```
