# 0xmcc/pushy-notify-pal architecture

> Architecture diagram of the GitHub repository 0xmcc/pushy-notify-pal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xmcc/pushy-notify-pal
- Repository: https://github.com/0xmcc/pushy-notify-pal

## Overview

##### Architectural Layers (Top to Bottom)

a) Presentation Layer:
- Components directory structure:
- UI Components (src/components/ui)
- Game-specific components (src/components/arena, src/components/multiplayer)
- Profile management (src/components/profile)
- Wallet interface (src/components/wallet)

b) Application Layer:
- Services & Hooks:
- Game Service (src/services/game-service.ts)
- Custom Hooks (src/hooks)
- Utils (src/utils)

c) Integration Layer:
- External Services:
- Supabase Integration (src/integrations/supabase)
- Wallet Adapter (src/utils/wallet-adapter.ts)

##### Data Flow Representation

- User interactions → Game Components
- Game Components → Game Service
- Game Service → Supabase
- Wallet Operations → Blockchain/External Wallet

**┌─ UI Layer ─────────────────┐**
- Game Arena              │
- Multiplayer Interface   │
- Wallet Section         │
- Profile Management     │
- ┘

**┌─ Services ─────────────────┐**
- Game Logic              │
- State Management        │
- File Upload            │
- ┘

**┌─ External Services ────────┐**
- Supabase Database       │
- Wallet Provider         │
- File Storage           │
- ┘

##### Implementation Details

- Rectangles: UI Components
- Hexagons: Services
- Clouds: External Services

- Blue: UI Components
- Green: Game Logic
- Orange: Financial/Wallet Components
- Purple: External Services
- Gray: Infrastructure Components

- User Interface Components
- Game Logic
- State Management
- External Services (Supabase, Wallet)
- Data Flow

##### Data Persistence

This structure will provide a clear understanding of the application's architecture while maintaining the appropriate level of detail for a principal software engineer to understand the system's complete flow and interactions.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[UI Layer]
        GA[Game Arena]:::game
        MI[Multiplayer Interface]:::game
        WS[Wallet Section]:::wallet
        PM[Profile Management]:::ui
        Header[Header Component]:::ui
        BNav[Bottom Navigation]:::ui
        Layout[Main Layout]:::ui
    end

    subgraph Services
        GS[Game Service]:::service
        GU[Game Utils]:::service
        FU[File Upload]:::service
        WA[Wallet Adapter]:::wallet
    end

    subgraph Integration
        SI[Supabase Integration]:::external
        DB[(Database)]:::storage
        FS[(File Storage)]:::storage
    end

    subgraph Types
        GT[Game Types]:::types
        RPST[RPS Game Types]:::types
    end

    subgraph PWA
        SW[Service Worker]:::pwa
        MF[Manifest]:::pwa
    end

    UI --> GA
    UI --> MI
    UI --> WS
    UI --> PM
    UI --> Header
    UI --> BNav
    Layout --> UI

    GA --> GS
    MI --> GS
    WS --> WA
    GS --> SI
    SI --> DB
    FU --> FS
    GS --> GU

    %% Click Events
    click GA "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/components/arena/GameArena.tsx"
    click MI "https://github.com/0xmcc/pushy-notify-pal/tree/main/src/components/multiplayer/"
    click WS "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/components/WalletSection.tsx"
    click PM "https://github.com/0xmcc/pushy-notify-pal/tree/main/src/components/profile/"
    click GS "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/services/game-service.ts"
    click SI "https://github.com/0xmcc/pushy-notify-pal/tree/main/src/integrations/supabase/"
    click UI "https://github.com/0xmcc/pushy-notify-pal/tree/main/src/components/ui/"
    click SW "https://github.com/0xmcc/pushy-notify-pal/blob/main/public/sw.js"
    click MF "https://github.com/0xmcc/pushy-notify-pal/blob/main/public/manifest.json"
    click GT "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/types/game.ts"
    click RPST "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/types/rps_game.ts"
    click Layout "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/app/layout.tsx"
    click Header "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/components/Header.tsx"
    click BNav "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/components/BottomNav.tsx"
    click FU "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/utils/fileUpload.ts"
    click GU "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/utils/gameUtils.ts"
    click WA "https://github.com/0xmcc/pushy-notify-pal/blob/main/src/utils/wallet-adapter.ts"

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:#fff
    classDef game fill:#2ecc71,stroke:#27ae60,color:#fff
    classDef wallet fill:#e67e22,stroke:#d35400,color:#fff
    classDef service fill:#9b59b6,stroke:#8e44ad,color:#fff
    classDef external fill:#34495e,stroke:#2c3e50,color:#fff
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:#fff
    classDef types fill:#1abc9c,stroke:#16a085,color:#fff
    classDef pwa fill:#e74c3c,stroke:#c0392b,color:#fff

    %% Legend
    subgraph Legend
        L1[UI Components]:::ui
        L2[Game Components]:::game
        L3[Wallet Components]:::wallet
        L4[Services]:::service
        L5[External Services]:::external
        L6[Storage]:::storage
        L7[Types]:::types
        L8[PWA Features]:::pwa
    end
```
