# gnyblast/futsal-team-builder architecture

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

- Interactive diagram: https://gitdiagram.com/gnyblast/futsal-team-builder
- Repository: https://github.com/gnyblast/futsal-team-builder

## Overview

##### Project type and purpose
- This is a single-page front-end application (Angular 17 + Angular Material) called “Futsal-Team-Builder.”
- Its sole purpose is to generate and display balanced football teams in the browser, with optional persistence (via Firestore).

##### File structure
- Top-level files: configuration (.gitignore, angular.json, tsconfig.json), Docker/Podman build files, CI workflow (.github/workflows/build-and-release.yml), README.
- `src/app/`: the heart of the SPA.
- `components/`: the visual UI blocks (login, register, main view, drawer, navbar, confirmation dialog).
- `services/`: encapsulated logic (authentication, dialog management, drawer state, Firestore I/O, player data, team-generation algorithm).
- `directives/`, `enums/`, `interfaces/`: cross-cutting Angular utilities and type definitions.
- `material.module.ts`: Angular Material imports consolidation.
- `src/assets/`: static test data (test_players.json).
- `src/environments/`: build-time environment configs.
- Docker and Podman containerization folders (docker/Dockerfile, podman/Containerfile) enable both dev server and production build.
- CI pipeline defined under `.github/workflows`.

##### README for additional insights
- Confirms purely a front-end Angular SPA (no custom backend code).
- Supports local dev (npm start), containerized dev (Docker/Podman), production build (Angular CLI + container).
- Live URL provided.
- Demo data auto-populated from `src/assets/test_players.json`.

##### Detail without overthinking
- Critical paths: user interactions, data flow, build/deploy steps.
- Keep it organized: group related components/services under a single “Angular App” boundary.
- Non-obvious dependencies (e.g., FirestoreService requires environment variables).
- The goal is maximum clarity on how UI, business logic, data, and deployment interact in this SPA.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and browser
    Browser["User Browser"]:::external
    Browser -->|Loads SPA| AngularApp

    subgraph "Angular Application"
        direction TB
        AppModule["AppModule"]:::module
        MaterialModule["MaterialModule"]:::module

        subgraph "Components" 
            direction TB
            AppComponent["AppComponent"]:::frontend
            LoginComponent["LoginComponent"]:::frontend
            RegisterComponent["RegisterComponent"]:::frontend
            MainComponent["MainComponent"]:::frontend
            NavbarComponent["NavbarComponent"]:::frontend
            DrawerComponent["DrawerComponent"]:::frontend
            ConfirmationDialogComponent["ConfirmationDialogComponent"]:::frontend
        end

        subgraph "Services"
            direction TB
            AuthService["AuthService"]:::service
            FirestoreService["FirestoreService"]:::service
            PlayersService["PlayersService"]:::service
            TeamGenerateService["TeamGenerateService"]:::service
            ConfirmationDialogService["ConfirmationDialogService"]:::service
            DrawerService["DrawerService"]:::service
        end

        subgraph "Utilities"
            direction TB
            ValidateNameDirective["ValidateNameDirective"]:::util
            PositionsEnum["PositionsEnum"]:::util
            IPlayer["IPlayer Interface"]:::util
            ITeam["ITeam Interface"]:::util
        end

        AppModule -->|Imports| MaterialModule
        AppModule -->|Declares| AppComponent
        AppModule -->|Declares| LoginComponent
        AppModule -->|Declares| RegisterComponent
        AppModule -->|Declares| MainComponent
        AppModule -->|Declares| NavbarComponent
        AppModule -->|Declares| DrawerComponent
        AppModule -->|Declares| ConfirmationDialogComponent
        AppModule -->|Provides| AuthService
        AppModule -->|Provides| FirestoreService
        AppModule -->|Provides| PlayersService
        AppModule -->|Provides| TeamGenerateService
        AppModule -->|Provides| ConfirmationDialogService
        AppModule -->|Provides| DrawerService

        %% Component to Services interactions
        AppComponent -->|injects| AuthService
        AppComponent -->|injects| FirestoreService
        LoginComponent -->|calls| AuthService
        RegisterComponent -->|calls| AuthService
        MainComponent -->|calls| PlayersService
        MainComponent -->|calls| TeamGenerateService
        NavbarComponent -->|uses| DrawerService
        DrawerComponent -->|uses| DrawerService
        ConfirmationDialogComponent -->|uses| ConfirmationDialogService

        %% Utilities usage
        LoginComponent -->|validates| ValidateNameDirective
        TeamGenerateService -->|uses| PositionsEnum
        PlayersService -->|models| IPlayer
        TeamGenerateService -->|models| ITeam
    end

    subgraph "Data Layer"
        direction TB
        FirestoreDB[(Firestore DB)]:::data
        TestPlayers["test_players.json"]:::data
    end

    %% Data flows
    FirestoreService -->|reads/writes| FirestoreDB
    PlayersService -->|fallback load| TestPlayers

    %% External libraries
    AngularMaterialLib["Angular Material Library"]:::external
    MaterialModule -->|imports| AngularMaterialLib

    %% Environments
    EnvironmentConfigs["Environment Configs"]:::external
    FirestoreService -->|uses| EnvironmentConfigs
    PlayersService -->|uses| EnvironmentConfigs

    %% DevOps & CI/CD
    subgraph "CI/CD Pipeline"
        direction TB
        GitHubActions["GitHub Actions"]:::devops
        AngularBuild["Angular CLI Build"]:::devops
        DockerBuild["Docker/Podman Build"]:::devops
        ContainerRuntime["Container Runtime"]:::devops
    end

    GitHubActions -->|triggers| AngularBuild
    AngularBuild -->|produces| DockerBuild
    DockerBuild -->|deploys| ContainerRuntime

    click AppModule "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/app.module.ts"
    click AppComponent "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/app.component.ts"
    click LoginComponent "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/components/login/login.component.ts"
    click RegisterComponent "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/components/register/register.component.ts"
    click MainComponent "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/components/main/main.component.ts"
    click NavbarComponent "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/components/navbar/navbar.component.ts"
    click DrawerComponent "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/components/drawer/drawer.component.ts"
    click ConfirmationDialogComponent "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/components/confirmation/confirmation.component.ts"
    click AuthService "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/services/auth.service.ts"
    click FirestoreService "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/services/firestore.service.ts"
    click PlayersService "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/services/players.service.ts"
    click TeamGenerateService "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/services/team-generate.service.ts"
    click ConfirmationDialogService "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/services/confirmation-dialog.service.ts"
    click DrawerService "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/services/drawer.service.ts"
    click MaterialModule "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/material.module.ts"
    click ValidateNameDirective "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/directives/validate-name.directive.ts"
    click PositionsEnum "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/enums/positions.enum.ts"
    click IPlayer "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/interfaces/IPlayer.ts"
    click ITeam "https://github.com/gnyblast/futsal-team-builder/blob/main/src/app/interfaces/ITeam.ts"
    click EnvironmentConfigs "https://github.com/gnyblast/futsal-team-builder/blob/main/src/environments/environment.ts"
    click TestPlayers "https://github.com/gnyblast/futsal-team-builder/blob/main/src/assets/test_players.json"
    click DockerBuild "https://github.com/gnyblast/futsal-team-builder/tree/main/docker/Dockerfile"
    click DockerBuild "https://github.com/gnyblast/futsal-team-builder/tree/main/podman/Containerfile"
    click GitHubActions "https://github.com/gnyblast/futsal-team-builder/blob/main/.github/workflows/build-and-release.yml"
    click AngularBuild "https://github.com/gnyblast/futsal-team-builder/blob/main/angular.json"
    click AngularBuild "https://github.com/gnyblast/futsal-team-builder/blob/main/tsconfig.json"

    classDef frontend fill:#D6EAF8,stroke:#21618C,color:#1B4F72
    classDef service fill:#D5F5E3,stroke:#1D8348,color:#145A32
    classDef data fill:#FADBD8,stroke:#C0392B,color:#641E16
    classDef external fill:#FCF3CF,stroke:#B7950B,color:#7D6608
    classDef devops fill:#E5E8E8,stroke:#566573,color:#1C2833
    classDef module fill:#EBDEF0,stroke:#7D3C98,color:#4A235A
    classDef util fill:#FDEBD0,stroke:#BA4A00,color:#7E5109
```
