# avishka07/e-sport-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/avishka07/e-sport-management-system
- Repository: https://github.com/avishka07/e-sport-management-system

## Overview

##### Project Type & Purpose
- The project is a full-stack application for an e-sports management system that provides personalized game recommendations.
- The README emphasizes data-driven matchmaking powered by relationship analysis with Neo4j, alongside a classic Flask/React full-stack implementation using PostgreSQL for core data management.

##### File Structure Analysis
- There are clearly separated directories for frontend, backend, and an additional recommendation module.
- The “backend” folder contains the Flask application code organized into app components (routes, models, recommendation logic, and utilities), along with migrations and Kubernetes deployment descriptors.
- The “frontend” folder holds the React application, using Tailwind CSS for styling, with a robust component structure.
- There are Dockerfiles for containerization and Kubernetes YAML files in the backend, indicating infrastructure/deployment considerations.
- The standalone “recommendation” folder mirrors parts of the backend’s recommendation logic and could represent a dedicated microservice or a module that is central to the project.

##### Key Architectural Components
a. Frontend:
- React application (React, Tailwind CSS).
- Components like AdminNavbar, EventCard, SignIn/SignUp, etc.
- State management (store) indicating a client-side architecture that interacts with backend APIs.

b. Backend:
- Flask-based API server managing business logic and API endpoints.
- Organized routes (admin_routes, event_routes, recommendation_routes, user_routes) indicating clear separation of concerns.
- Modular recommendation engine included in backend/app/recommendation – this handles player matching, filtering, and Neo4j connections.
- Utility modules for database interaction (both PostgreSQL and Neo4j).
- Dockerization indicated by the presence of Dockerfiles and Kubernetes configuration files for different services such as user management, recommendation, tournament management, and notification services.

c. Databases:
- PostgreSQL is used as the core relational database.
- Neo4j for handling graph-based relationships essential to the recommendation engine.

d. Additional Infrastructure:
- Container orchestration using Docker and Kubernetes.
- Continuous integration workflows via GitHub (see .github/workflows directory).

##### Relationships & Interactions
- The Frontend (React) communicates with the Backend (Flask) via API calls.
- The Backend serves as the mediator between the frontend and the databases:
– It reads/writes to the PostgreSQL database for core data management.
– It leverages Neo4j, accessed via specialized modules, to perform complex graph queries for recommendation services.
- The recommendation modules within the backend may also be separately accessed or even scaled independently (as suggested by the separate recommendation directory and dedicated Kubernetes deployments).
- Docker containers encapsulate each major service, and Kubernetes deployments manage scaling and orchestration.

##### Architectural Patterns & Technologies
- Separation of concerns: clear modularization of frontend, backend, and recommendation logic.
- Microservices/Containerization: Use of Docker and Kubernetes (separate deployment YAML files for different services).
- MVC-like structure in backend: Routes/controllers, Models (both SQL and Neo4j-based), and Business logic (recommendation algorithms).
- API-based communication: RESTful endpoints provided by Flask are accessed by the React frontend.
- Data-driven processing: Integration of data from PostgreSQL and Neo4j to guide recommendation decisions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        RF["React Frontend"]:::frontend
        AUI["Admin & UI Components"]:::frontend
        SM["State Management"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        FAS["Flask API Server"]:::backend
        AR["API Routes"]:::backend
        RE["Recommendation Engine"]:::backend
        SRM["Standalone Recommendation Module"]:::backend
        DM["Database Models"]:::backend
        DU["Database Utility Modules"]:::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        PG["(PostgreSQL Database)"]:::database
        NG["(Neo4j Graph Database)"]:::database
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        BD["Backend Dockerfile"]:::infrastructure
        FD["Frontend Dockerfile"]:::infrastructure
        KD["Kubernetes Deployment"]:::infrastructure
        CI["CI Workflows"]:::infrastructure
    end

    %% Frontend internal connections
    AUI -->|"feeds"| RF
    SM  -->|"feeds"| RF

    %% Frontend to Backend connection
    RF -->|"APIcalls"| FAS

    %% Backend internal connections
    FAS -->|"handles"| AR
    FAS -->|"delegates"| RE
    FAS -->|"routesTo"| SRM
    FAS -->|"manages"| DM
    FAS -->|"utilizes"| DU

    %% Backend to Database connections
    FAS -->|"CRUD"| PG
    FAS -->|"graph-q"| NG
    RE -->|"graph-match"| NG

    %% Infrastructure connections
    CI -->|"triggersBuild"| BD
    CI -->|"triggersBuild"| FD
    BD -->|"deployedBy"| KD
    FD -->|"deployedBy"| KD
    KD -->|"orchestrates"| FAS
    KD -->|"orchestrates"| RF

    %% Click Events
    click RF "https://github.com/avishka07/e-sport-management-system/tree/main/frontend/"
    click AUI "https://github.com/avishka07/e-sport-management-system/tree/main/frontend/src/components/"
    click SM "https://github.com/avishka07/e-sport-management-system/blob/main/frontend/src/store/store.js"
    click FAS "https://github.com/avishka07/e-sport-management-system/blob/main/backend/main.py"
    click AR "https://github.com/avishka07/e-sport-management-system/tree/main/backend/app/routes/"
    click RE "https://github.com/avishka07/e-sport-management-system/tree/main/backend/app/recommendation/"
    click SRM "https://github.com/avishka07/e-sport-management-system/tree/main/recommendation/"
    click DM "https://github.com/avishka07/e-sport-management-system/tree/main/backend/app/models/"
    click DU "https://github.com/avishka07/e-sport-management-system/tree/main/backend/app/utils/"
    click BD "https://github.com/avishka07/e-sport-management-system/tree/main/backend/Dockerfile"
    click FD "https://github.com/avishka07/e-sport-management-system/tree/main/frontend/Dockerfile"
    click KD "https://github.com/avishka07/e-sport-management-system/tree/main/backend/kubernetes/"
    click CI "https://github.com/avishka07/e-sport-management-system/tree/main/.github/workflows/"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef database fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#FFA07A,stroke:#000,stroke-width:2px;
```
