# damiansire/github-raffle architecture

> Architecture diagram of the GitHub repository damiansire/github-raffle, 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/damiansire/github-raffle
- Repository: https://github.com/damiansire/github-raffle

## Overview

##### Main Application Components

a. Frontend Layer (Angular Application)
- Divide it into two main pages:
- All Players Screen
- Raffle Screen

b. External Services Layer
- GitHub Integration (via GitHub Service)
- Prize Management System

##### Detailed Component Breakdown

Create sub-sections showing:

a. All Players Screen Components:
- Players List Component
- Player Card Component
- Prize List Component
- Start Raffle Button Component

b. Raffle Screen Components:
- Available Prizes Component
- Current Prize Component
- Current Winner Component
- Raffle Button Component
- Raffle Participant Component
- Winners History Component

##### Services Layer
- GitHub Service
- Prizes Service
- Sort Prize Service

##### Data Flow Representation

- Data flow between components
- Service interactions
- External API calls to GitHub

##### Component Relationships
- Parent-child relationships between components
- Service injection points
- Data flow between screens

##### Environment Configuration
- A small section showing the environment configuration for the GitHub token

##### State Management
- How data is shared between components (through services)

**[External Services Layer]**
- ↕
**[Angular Application Layer]**
- ↓
**[Pages Layer]**
- ↓
**[Components Layer]**
- ↓
**[Services Layer]**

Remember to highlight the two main workflows:
##### Raffle Execution Flow

This will create a comprehensive visualization of your Angular raffle application's architecture while maintaining clarity and usefulness for technical discussions and development planning.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External
        GitHub[GitHub API]
        PrizeAssets[Prize Assets]:::assets
        PrizeListData[Prize List JSON]:::data
    end

    subgraph Frontend["Angular Frontend"]
        subgraph Pages
            AllPlayers[All Players Screen]:::page
            RaffleScreen[Raffle Screen]:::page
        end

        subgraph AllPlayersComponents["All Players Components"]
            PlayersList[Players List]:::component
            PlayerCard[Player Card]:::component
            PrizeList[Prize List]:::component
            StartRaffle[Start Raffle Button]:::component
        end

        subgraph RaffleComponents["Raffle Components"]
            AvailablePrizes[Available Prizes]:::component
            CurrentPrize[Current Prize]:::component
            CurrentWinner[Current Winner]:::component
            RaffleButton[Raffle Button]:::component
            RaffleParticipant[Raffle Participant]:::component
            WinnersHistory[Winners History]:::component
        end

        subgraph Services
            GitHubService[GitHub Service]:::service
            PrizesService[Prizes Service]:::service
            SortPrizeService[Sort Prize Service]:::service
        end

        PrizeInterface[Prize Interface]:::interface
    end

    %% Relationships
    GitHub --> GitHubService
    PrizeAssets --> PrizesService
    PrizeListData --> PrizesService
    
    GitHubService --> PlayersList
    PrizesService --> PrizeList
    PrizesService --> AvailablePrizes
    SortPrizeService --> CurrentPrize
    
    PlayersList --> PlayerCard
    
    AllPlayers --> AllPlayersComponents
    RaffleScreen --> RaffleComponents
    
    PrizeInterface --> PrizesService

    %% Click Events
    click AllPlayers "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/all-players-screen/all-players-screen.component.ts"
    click RaffleScreen "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/raffle-screen/raffle-screen.component.ts"
    click PlayersList "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/all-players-screen/components/players-list/players-list.component.ts"
    click PlayerCard "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/all-players-screen/components/players-list/player-card/player-card.component.ts"
    click PrizeList "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/all-players-screen/components/prize-list/prize-list.component.ts"
    click StartRaffle "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/all-players-screen/components/start-raffle-button/start-raffle-button.component.ts"
    click AvailablePrizes "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/raffle-screen/components/avalaible-prizes-raffle-screen/avalaible-prizes-raffle-screen.component.ts"
    click CurrentPrize "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/raffle-screen/components/current-prize/current-prize.component.ts"
    click CurrentWinner "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/raffle-screen/components/current-winner/current-winner.component.ts"
    click RaffleButton "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/raffle-screen/components/raffle-button/raffle-button.component.ts"
    click RaffleParticipant "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/raffle-screen/components/raffle-participant/raffle-participant.component.ts"
    click WinnersHistory "https://github.com/damiansire/github-raffle/blob/master/src/app/pages/raffle-screen/components/winners-history/winners-history.component.ts"
    click GitHubService "https://github.com/damiansire/github-raffle/blob/master/src/app/services/github.service.ts"
    click PrizesService "https://github.com/damiansire/github-raffle/blob/master/src/app/services/prizes.service.ts"
    click SortPrizeService "https://github.com/damiansire/github-raffle/blob/master/src/app/services/sort-prize.service.ts"
    click PrizeAssets "https://github.com/damiansire/github-raffle/tree/master/public/prizes-icons"
    click PrizeListData "https://github.com/damiansire/github-raffle/blob/master/public/prizes-list.json"
    click PrizeInterface "https://github.com/damiansire/github-raffle/blob/master/src/app/interfaces/prizes.interface.ts"

    %% Styling
    classDef page fill:#2196F3,stroke:#1565C0,color:white
    classDef component fill:#4CAF50,stroke:#2E7D32,color:white
    classDef service fill:#FFC107,stroke:#FFA000,color:black
    classDef interface fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef assets fill:#607D8B,stroke:#455A64,color:white
    classDef data fill:#FF5722,stroke:#E64A19,color:white
```
