# ronnyroq/pso-team-manager architecture

> Architecture diagram of the GitHub repository ronnyroq/pso-team-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ronnyroq/pso-team-manager
- Repository: https://github.com/ronnyroq/pso-team-manager

## Overview

##### Key Relationships to Highlight

a) Data Flow Patterns
- Discord Events → Command Handler → Business Logic → Database
- Cache System ↔ Database
- Web Interface ↔ Backend Services

b) Integration Points
- Steam Integration (via steamUtils.js)
- External APIs (shown in various api.js files)
- Cronjob System (cronjobs.js)

##### Specific Implementation Details

- Hexagons for Discord-specific components
- Rectangles for core business logic
- Clouds for external services
- Rounded rectangles for web components

##### Component Grouping

- Match Management System
- matches/
- lineup/
- referees.js
- Team Management System
- teams/
- transfers/
- contracts.js
- League System
- league/
- season.js
- Player Management
- player/
- rating.js
- steamid.js

##### Additional Elements

Supporting systems:
- Configuration Management (config/)
- Utility Functions (functions/)
- Logging System (logger.js)
- Authentication/Authorization flows

##### Technical Stack Indicators

Technology badges for:
- Node.js runtime
- Discord.js library
- MongoDB database
- Express.js (for web interface)
- EJS templating
- Tailwind CSS

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Discord
        DC[Discord Client]
        API["/api.js"]
        CR[Command Registration]
    end
    
    subgraph CommandSystem
        CH[Command Handler]
        subgraph Commands
            LM["League Management"]
            MM["Match Management"]
            TM["Team Management"]
            PM["Player Management"]
            NM["National Team Management"]
            TS["Transfer System"]
        end
    end
    
    subgraph DataLayer
        DB[(MongoDB)]
        Cache{{"Cache System"}}
        subgraph CacheTypes
            AC["All Cache"]
            PC["Players Cache"]
            CC["Countries Cache"]
        end
    end
    
    subgraph ExternalServices
        Steam["Steam Integration"]
        PSAF["PSAF Server"]
    end
    
    subgraph WebInterface
        WH["Web Handler"]
        SR["Site Router"]
        ST["Site Templates"]
        SA["Static Assets"]
        SU["Site Utilities"]
    end
    
    subgraph Config
        Constants["Constants"]
        LeagueData["League Data"]
        CountriesConfig["Countries Config"]
        DBConfig["Database Config"]
    end
    
    subgraph Utils
        CronJobs["Cron Jobs"]
        GenUtils["General Utils"]
        Helpers["Helper Functions"]
        AutoComplete["Auto Complete"]
    end
    
    DC --> API
    API --> CR
    CR --> CH
    CH --> Commands
    Commands --> DataLayer
    DataLayer --> ExternalServices
    Cache --> DB
    WH --> SR
    SR --> ST
    WebInterface --> DataLayer
    Config --> CommandSystem
    Utils --> CommandSystem
    
    %% Click Events
    click DC "https://github.com/RonnyRoq/pso-team-manager/blob/main/app.js"
    click API "https://github.com/RonnyRoq/pso-team-manager/blob/main/api.js"
    click CR "https://github.com/RonnyRoq/pso-team-manager/blob/main/commandsRegister.js"
    click CH "https://github.com/RonnyRoq/pso-team-manager/blob/main/commands.js"
    click LM "https://github.com/RonnyRoq/pso-team-manager/tree/main/commands/league"
    click MM "https://github.com/RonnyRoq/pso-team-manager/tree/main/commands/matches"
    click TM "https://github.com/RonnyRoq/pso-team-manager/tree/main/commands/teams"
    click PM "https://github.com/RonnyRoq/pso-team-manager/tree/main/commands/player"
    click NM "https://github.com/RonnyRoq/pso-team-manager/tree/main/commands/nationalTeams"
    click TS "https://github.com/RonnyRoq/pso-team-manager/tree/main/commands/transfers"
    click AC "https://github.com/RonnyRoq/pso-team-manager/blob/main/functions/allCache.js"
    click PC "https://github.com/RonnyRoq/pso-team-manager/blob/main/functions/playersCache.js"
    click CC "https://github.com/RonnyRoq/pso-team-manager/blob/main/functions/countriesCache.js"
    click Steam "https://github.com/RonnyRoq/pso-team-manager/blob/main/functions/steamUtils.js"
    click PSAF "https://github.com/RonnyRoq/pso-team-manager/blob/main/config/psafServerConfig.js"
    click WH "https://github.com/RonnyRoq/pso-team-manager/blob/main/web.js"
    click SR "https://github.com/RonnyRoq/pso-team-manager/blob/main/site.js"
    click ST "https://github.com/RonnyRoq/pso-team-manager/tree/main/site/pages"
    click SA "https://github.com/RonnyRoq/pso-team-manager/tree/main/web/static"
    click SU "https://github.com/RonnyRoq/pso-team-manager/blob/main/site/siteUtils.js"
    click Constants "https://github.com/RonnyRoq/pso-team-manager/blob/main/config/constants.js"
    click LeagueData "https://github.com/RonnyRoq/pso-team-manager/blob/main/config/leagueData.js"
    click CountriesConfig "https://github.com/RonnyRoq/pso-team-manager/blob/main/config/countriesConfig.js"
    click DBConfig "https://github.com/RonnyRoq/pso-team-manager/blob/main/config/mongoConfig.js"
    click CronJobs "https://github.com/RonnyRoq/pso-team-manager/blob/main/cronjobs.js"
    click GenUtils "https://github.com/RonnyRoq/pso-team-manager/blob/main/utils.js"
    click Helpers "https://github.com/RonnyRoq/pso-team-manager/blob/main/functions/helpers.js"
    click AutoComplete "https://github.com/RonnyRoq/pso-team-manager/blob/main/functions/autoComplete.js"

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef discord fill:#7289DA,color:white
    classDef commands fill:#4CAF50,color:white
    classDef data fill:#FFC107
    classDef external fill:#F44336,color:white
    classDef web fill:#2196F3,color:white
    classDef config fill:#9C27B0,color:white
    classDef utils fill:#795548,color:white
    
    class DC,API,CR discord
    class CH,LM,MM,TM,PM,NM,TS commands
    class DB,Cache,AC,PC,CC data
    class Steam,PSAF external
    class WH,SR,ST,SA,SU web
    class Constants,LeagueData,CountriesConfig,DBConfig config
    class CronJobs,GenUtils,Helpers,AutoComplete utils
```
