# hamdielzard/wordeo architecture

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

- Interactive diagram: https://gitdiagram.com/hamdielzard/wordeo
- Repository: https://github.com/hamdielzard/wordeo

## Overview

##### Main Components
- Client (Frontend)
- Located in the “client” directory.
- Built with React (entry point at client/src/index.jsx) and includes multiple components (e.g., Game components, Store components, Pages for Account, Game, Leaderboard, etc.), styles, and tests.
- The client is containerized (client/Dockerfile) and runs on port 3000 (as indicated in the README instructions).
- Server (Backend)
- Found in the “server” directory.
- A Node.js with Express service that implements several controllers (auth, game, score, store, user, word) and corresponding routes.
- Uses an MVC-like architecture with controllers, routes, and models (e.g., user.js, scores.js, store.js, words.js).
- Containerized using its own Dockerfile and managed via docker-compose.
- Database
- Although no explicit database configuration files are present, the README mentions MongoDB as part of the MERN stack. Represent MongoDB as a separate component that the server interacts with, mainly via the models.
- Additional Components
- Docker & docker-compose: Represent the orchestration container layer.
- CI/CD Pipelines: The .github/workflows files (for SonarQube, Docker builds, etc.) should be noted as supporting elements that ensure code quality and consistent builds.
- Load Testing: The “wordeo_load_test” folder contains test plans and CSV data that can be referenced as part of performance testing.

##### Relationships and Interactions
- Inside the backend, show the flow from “routes” → “controllers” → “models” for handling requests.
- Server to the MongoDB instance to indicate database operations (e.g., registration, scores, game state, etc.).
- External services (such as CI/CD workflows) that build, test, and deploy the containers via Docker-compose.

##### Architectural Patterns and Technologies
- Separation between the frontend (React-based, Single Page Application) and backend (Node/Express with MVC structure).
- That backend services are organized via RESTful API endpoints (auth, game, scores, store, user, words).
- Mention that Docker and docker-compose are used to containerize and orchestrate the components.
- MERN stack as the central technology, showing that MongoDB serves as the persistent storage.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    User["User"]:::user

    %% Frontend Layer
    subgraph "Frontend Layer"
        Client["Client (React)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Server["Server (Node/Express)"]:::backend
        subgraph "MVC Pattern"
            Routes["Routes"]:::backend
            Controllers["Controllers"]:::backend
            Models["Models"]:::backend
        end
        Server -->|"handles"| Routes
        Routes -->|"calls"| Controllers
        Controllers -->|"accesses"| Models
    end

    %% Database
    Database["MongoDB Database"]:::database

    %% Infrastructure Components
    subgraph "Infrastructure"
        Docker["Docker Infrastructure"]:::infra
        CICD["CI/CD Pipelines"]:::infra
    end

    %% Load Testing Component
    LoadTesting["Load Testing"]:::infra

    %% Connections
    User -->|"Uses"| Client
    Client -->|"API_Request"| Server
    Models -->|"DB_Operation"| Database
    CICD -->|"Deploys"| Client
    CICD -->|"Deploys"| Server
    Docker -->|"Orchestrates"| Client
    Docker -->|"Orchestrates"| Server
    LoadTesting -->|"Tests"| Server

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef database fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef infra fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef user fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;

    %% Click Events for Component Mapping
    click Client "https://github.com/hamdielzard/wordeo/tree/main/client/"
    click Client "https://github.com/hamdielzard/wordeo/blob/main/client/src/index.jsx"
    click Client "https://github.com/hamdielzard/wordeo/tree/main/client/Dockerfile"
    click Server "https://github.com/hamdielzard/wordeo/tree/main/server/"
    click Server "https://github.com/hamdielzard/wordeo/blob/main/server/index.js"
    click Routes "https://github.com/hamdielzard/wordeo/tree/main/server/routes"
    click Controllers "https://github.com/hamdielzard/wordeo/tree/main/server/controllers"
    click Models "https://github.com/hamdielzard/wordeo/tree/main/server/models"
    click Database "https://github.com/hamdielzard/wordeo/tree/main/server/models"
    click Docker "https://github.com/hamdielzard/wordeo/tree/main/client/Dockerfile"
    click Docker "https://github.com/hamdielzard/wordeo/tree/main/server/Dockerfile"
    click Docker "https://github.com/hamdielzard/wordeo/blob/main/docker-compose.yml"
    click CICD "https://github.com/hamdielzard/wordeo/tree/main/.github/workflows/"
    click LoadTesting "https://github.com/hamdielzard/wordeo/tree/main/wordeo_load_test/"
```
