# azuro-protocol/example-app architecture

> Architecture diagram of the GitHub repository azuro-protocol/example-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azuro-protocol/example-app
- Repository: https://github.com/azuro-protocol/example-app

## Overview

##### Main Components Identification

a) Frontend Layer:
- Next.js Application (App Router structure)
- Client-side Components
- UI Components Library
- Wallet Integration

b) Core Features:
- Sports Betting Engine
- Wallet Management
- User Authentication (Privy Integration)
- Event Management
- Betslip System

**┌─ Client Layer ─────────────────────────────────────┐**
- ┌─ Next.js App Router ─┐ ┌─ Component Library ──┐ │
- Pages             │ │ - UI Components      │ │
- Layouts           │ │ - Compositions       │ │
- Client Components │ │ - Feedback Elements  │ │
- ┘ └───────────────────────┘ │
- ┌─ State Management ───┐ ┌─ Local Modules ──────┐ │
- Contexts          │ │ - Wallet Provider    │ │
- Hooks             │ │ - SVG Provider       │ │
- Global State      │ │ - Cookie Storage     │ │
- ┘ └───────────────────────┘ │
- ┘

**┌─ Integration Layer ──────────────────────────────┐**
- ┌─ Authentication ────┐ ┌─ Wallet Integration ─┐ │
- Privy            │ │ - Web3 Providers     │ │
- Social Login     │ │ - Multiple Wallets   │ │
- ┘ └───────────────────────┘ │
- ┘

**┌─ Business Logic Layer ────────────────────────────┐**
- ┌─ Betting Engine ────┐ ┌─ Event Management ───┐ │
- Odds Processing  │ │ - Sports Data        │ │
- Bet Placement    │ │ - Live Updates       │ │
- ┘ └───────────────────────┘ │
- ┘

##### Connection Flows

- User interaction flows
- Data flow between components
- Authentication processes
- Wallet connection flows
- Betting transaction flows

##### Important Details

- Next.js App Router structure (/src/app)
- Component organization (/src/components)
- Local modules integration (/local_modules)
- Authentication flow with Privy
- Sports betting business logic
- State management through contexts

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client_Layer
        NextRouter["Next.js App Router"]:::frontend
        CompLib["UI Component Library"]:::frontend
        ClientComp["Client Components"]:::frontend
        Layout["Layout System"]:::frontend
        DataDisplay["Data Display Components"]:::frontend
        Navigation["Navigation System"]:::frontend
        
        subgraph State
            Contexts["State Management"]:::frontend
            GlobalState["Global State"]:::frontend
            Hooks["Custom Hooks"]:::frontend
        end
    end

    subgraph Integration_Layer
        Auth["Authentication System"]:::auth
        WalletInt["Wallet Integration"]:::wallet
        Profile["User Profile System"]:::auth
    end

    subgraph Business_Logic_Layer
        BetEngine["Sports Betting Engine"]:::business
        EventMgmt["Event Management"]:::business
        Betslip["Betslip System"]:::business
        Funding["Funding/Payment System"]:::business
    end

    %% Connections
    NextRouter --> CompLib
    NextRouter --> ClientComp
    NextRouter --> Layout
    CompLib --> DataDisplay
    CompLib --> Navigation

    Auth --> Profile
    Auth --> WalletInt
    
    BetEngine --> Betslip
    EventMgmt --> BetEngine
    WalletInt --> Funding
    
    Contexts --> GlobalState
    Contexts --> Hooks
    GlobalState --> BetEngine
    GlobalState --> Betslip

    %% Click Events
    click NextRouter "https://github.com/Azuro-protocol/example-app/tree/main/src/app"
    click CompLib "https://github.com/Azuro-protocol/example-app/tree/main/src/components"
    click WalletInt "https://github.com/Azuro-protocol/example-app/tree/main/local_modules/wallet"
    click Betslip "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/Betslip"
    click EventMgmt "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/events"
    click BetEngine "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/event/Markets"
    click Auth "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/modals/ConnectModal"
    click Layout "https://github.com/Azuro-protocol/example-app/tree/main/src/components/layout"
    click Contexts "https://github.com/Azuro-protocol/example-app/tree/main/src/contexts"
    click ClientComp "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/ClientOnly"
    click DataDisplay "https://github.com/Azuro-protocol/example-app/tree/main/src/components/dataDisplay"
    click Profile "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/profile"
    click Navigation "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/Navigation"
    click Funding "https://github.com/Azuro-protocol/example-app/tree/main/src/compositions/funding"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef auth fill:#2ecc71,stroke:#27ae60,color:white
    classDef wallet fill:#e74c3c,stroke:#c0392b,color:white
    classDef business fill:#f39c12,stroke:#d35400,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Components"]:::frontend
        AuthComp["Authentication Components"]:::auth
        WalletComp["Wallet Components"]:::wallet
        BusinessComp["Business Logic"]:::business
    end
```
