# attensys-stark/attensysui architecture

> Architecture diagram of the GitHub repository attensys-stark/attensysui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/attensys-stark/attensysui
- Repository: https://github.com/attensys-stark/attensysui

## Overview

##### Project type and purpose
- AttenSysUI is a full-stack Next.js application focused on event/bootcamp/course management with on-chain certification and attendance tracking.
- The README shows it combines a React/Next.js front end, Next.js API routes (serverless back end), integrations with Pinata (IPFS), Firebase, and Starknet smart contracts.

##### File structure
- Top-level “src/app” holds all Next.js 13+ route handlers (page.tsx, layout.tsx) and API routes under “src/app/api/…/route.ts”.
- “src/components” contains hundreds of UI components organized by feature domain (bootcamp, courses, events, explorer, etc.).
- “src/lib/firebase” and “src/lib/services” hold Firebase client initialization and business logic wrappers (authService, reviewService).
- “src/deployments” contains contract ABIs and addresses for on-chain interactions.
- “src/hooks”, “src/utils”, and “src/services” are custom React hooks, utility functions, and client-side service modules (signMessage, addNetwork).
- Config and constants (.env, config.ts, constants/index.ts) drive API keys (Pinata), network URLs, and chain parameters.

##### README for additional insights
- The architecture is a single Next.js monorepo combining front end UI, back end API routes, and on-chain calls.
- External dependencies include:
- Pinata API (for IPFS uploads)
- Starknet blockchain (for NFT certificates & attendance records)
- Firebase (for user auth and real-time data if used)

##### Elements
- UI → API routes
- API routes → Service wrappers → External services
- External back to API/UI for responses
- Blue for frontend components
- Green for serverless/backend
- Yellow for services
- Gray/cloud for external

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        UI["Client Browser (React/Next.js UI)"]:::frontend
        Components["UI Components"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        subgraph "API Routes"
            AccessAPI["/api/access-link"]:::backend
            PinataAPI["/api/pinata/upload"]:::backend
            SignAPI["/api/sign"]:::backend
            URLAPI["/api/url"]:::backend
        end
    end

    %% Service Layer
    subgraph "Service Layer"
        subgraph "Firebase Service"
            FSinit["Firebase Client Init"]:::service
            AuthS["Authentication Service"]:::service
            RevS["Review Service"]:::service
        end
        subgraph "Pinata Service"
            PinAPI["Pinata Upload Endpoint"]:::service
            PinHook["usePinataAccess hook"]:::service
        end
        subgraph "Blockchain Service"
            ABI["Contract ABIs & Addresses"]:::service
            Conn["Connector Utilities"]:::service
        end
        subgraph "Wallet & Tx Utilities"
            SignMsg["signMessage & universalSign"]:::service
            Network["addNetwork"]:::service
            WalletHook["useWallet hook"]:::service
            TxTrack["useWaitForTx hook"]:::service
        end
        subgraph "Global Utils & Const"
            Config["App Config & utils"]:::service
            Const["Constants definitions"]:::service
            Helpers["Generic Helpers"]:::service
        end
        subgraph "App State Management"
            StateWallet["Connected Wallet State"]:::service
            StateTx["Transaction State"]:::service
            StateVer["Versioning State"]:::service
        end
        subgraph "UI Support"
            UIS["UI Primitives (button, spinner, dialog)"]:::service
        end
    end

    %% Data Stores
    subgraph "Data Stores"
        FirebaseDB["Firebase Database"]:::datastore
        IPFS["IPFS (Pinata)"]:::datastore
    end

    %% External Integrations
    subgraph "External Integrations"
        PinataCloud["Pinata Cloud"]:::external
        Starknet["Starknet Blockchain"]:::external
    end

    %% CI/CD
    CI["CI/CD Workflow"]:::ci

    %% Connections
    UI --> Components
    UI --> AccessAPI
    UI --> PinataAPI
    UI --> SignAPI
    UI --> URLAPI

    AccessAPI --> FSinit
    AccessAPI --> Conn
    AccessAPI --> Starknet

    PinataAPI --> PinAPI
    PinataAPI --> PinataCloud
    PinataCloud --> IPFS

    SignAPI --> SignMsg
    SignAPI --> WalletHook
    SignAPI --> Conn
    SignAPI --> Starknet

    URLAPI --> Network
    URLAPI --> Config
    URLAPI --> Const

    FSinit --> FirebaseDB
    AuthS --> FirebaseDB
    RevS --> FirebaseDB

    Conn --> ABI
    Conn --> Starknet

    PinHook --> PinataCloud

    SignMsg --> TXTrack
    WalletHook --> StateWallet
    TxTrack --> StateTx

    Config --> Helpers
    Const --> Helpers

    UIS --> Components

    CI --> UI
    CI --> AccessAPI
    CI --> PinataAPI
    CI --> SignAPI
    CI --> URLAPI

    %% Click Events
    click UI "https://github.com/attensys-stark/attensysui/blob/main/src/app/page.tsx"
    click Components "https://github.com/attensys-stark/attensysui/tree/main/src/components/"
    click AccessAPI "https://github.com/attensys-stark/attensysui/blob/main/src/app/api/access-link/route.ts"
    click PinataAPI "https://github.com/attensys-stark/attensysui/blob/main/src/app/api/pinata/upload/route.ts"
    click SignAPI "https://github.com/attensys-stark/attensysui/blob/main/src/app/api/sign/route.ts"
    click URLAPI "https://github.com/attensys-stark/attensysui/blob/main/src/app/api/url/route.ts"
    click FSinit "https://github.com/attensys-stark/attensysui/blob/main/src/lib/firebase/client.ts"
    click AuthS "https://github.com/attensys-stark/attensysui/blob/main/src/lib/services/authService.ts"
    click RevS "https://github.com/attensys-stark/attensysui/blob/main/src/lib/services/reviewService.ts"
    click PinHook "https://github.com/attensys-stark/attensysui/blob/main/src/hooks/usePinataAccess.ts"
    click ABI "https://github.com/attensys-stark/attensysui/blob/main/src/deployments/abi.ts"
    click Conn "https://github.com/attensys-stark/attensysui/blob/main/src/helpers/connectorsLatest.ts"
    click SignMsg "https://github.com/attensys-stark/attensysui/blob/main/src/services/signMessage.ts"
    click Network "https://github.com/attensys-stark/attensysui/blob/main/src/services/addNetwork.ts.ts"
    click WalletHook "https://github.com/attensys-stark/attensysui/blob/main/src/hooks/useWallet.ts"
    click TxTrack "https://github.com/attensys-stark/attensysui/blob/main/src/hooks/useWaitForTx.ts"
    click Config "https://github.com/attensys-stark/attensysui/blob/main/src/config.ts"
    click Const "https://github.com/attensys-stark/attensysui/blob/main/src/constants/index.ts"
    click Helpers "https://github.com/attensys-stark/attensysui/blob/main/src/utils/helpers.ts"
    click StateWallet "https://github.com/attensys-stark/attensysui/blob/main/src/state/connectedWalletStarknetkit.ts"
    click StateTx "https://github.com/attensys-stark/attensysui/blob/main/src/state/transactionState.ts"
    click StateVer "https://github.com/attensys-stark/attensysui/blob/main/src/state/versionState.ts"
    click UIS "https://github.com/attensys-stark/attensysui/blob/main/src/components/ui/button.tsx"
    click CI "https://github.com/attensys-stark/attensysui/blob/main/.github/workflows/attensys_flow.yml"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#333,stroke-width:1px
    classDef service fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef datastore fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef external fill:#f8d7da,stroke:#333,stroke-width:1px
    classDef ci fill:#d1ecf1,stroke:#333,stroke-width:1px
```
