# phillipc0/pp-cga-fe-public architecture

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

- Interactive diagram: https://gitdiagram.com/phillipc0/pp-cga-fe-public
- Repository: https://github.com/phillipc0/pp-cga-fe-public

## Overview

##### Project Type & Purpose
- This is a single‐page/mobile front-end application built with React Native (Expo) and TypeScript.
- It provides a client for multiplayer card games (“Lügen” and “Mau”) with authentication, game lobbies, rule views, and real-time interactions via a backend API.

##### File Structure Analysis
- Top level:
- app.json, package.json, tsconfig.json – project/config metadata
- .github, scripts, run-config – CI, build & run scripts
- app/ – route-based pages/screens under Expo’s new App Router
- components/ – reusable UI components (cards, timers, leaderboards)
- hooks/ – React context & custom hooks (authContext, useStorageState)
- utilities/ – data-access layer (deck shuffling, HTTP requests)
- assets/ – fonts & images

##### README Insights
- Defines the tech stack (Node.js, Expo SDK, Java JDK) and local setup (Android emulator/Expo Go).
- Describes IDE run configurations for development and EAS for production builds.

##### Detailed Coverage
- Every directory/module appears at the appropriate layer.
- Call out the App Router (`app/_layout.tsx`) as the navigation entrypoint.
- AuthContext wrapper around your screen tree.
- How assets flow into the UI via ThemedComponents or Style constants.
- Run-configs & shell scripts that automate `npm run android`, `expo-go`, and `eas build`.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::external
    Device["Mobile Device / Emulator"]:::external
    User -->|Interacts| Device

    subgraph "Expo App"
        direction TB

        subgraph "UI Layer (app/, components/)"
            direction TB
            LayoutApp["App Router Entry (app/_layout.tsx)"]:::ui
            AuthReg["Register (app/register.tsx)"]:::ui
            AuthSign["SignIn (app/signIn.tsx)"]:::ui

            subgraph "Main App Group (app/(app)/_layout.tsx)"
                direction TB
                Home["Home/Join (app/(app)/index.tsx)"]:::ui
                InstaJoin["Instajoin (app/(app)/instajoin.tsx)"]:::ui
                NewLue["New Lügen Game (app/(app)/newLuegenGame.tsx)"]:::ui
                NewMau["New Mau Game (app/(app)/newMauGame.tsx)"]:::ui
                Lobby["Game Lobby (app/(app)/gameLobby.tsx)"]:::ui
                LueView["Luegen Game View (app/(app)/LuegenGameView.tsx)"]:::ui
                MauView["Mau Game View (app/(app)/MauGameView.tsx)"]:::ui
                Profile["Profile Page (app/(app)/profilePage.tsx)"]:::ui
                Rules["Rule Page (app/(app)/rulePage.tsx)"]:::ui
            end

            subgraph "Reusable Components (components/)"
                direction TB
                Card["Card (components/Card.tsx)"]:::ui
                OwnHand["OwnHand (components/OwnHand.tsx)"]:::ui
                PlayerComp["Player (components/Player.tsx)"]:::ui
                LobbyPlayer["LobbyPlayerComponent (components/LobbyPlayerComponent.tsx)"]:::ui
                LobbyRule["LobbyRuleComponent (components/LobbyRuleComponent.tsx)"]:::ui
                JackSel["JackSelectionComponent (components/JackSelectionComponent.tsx)"]:::ui
                Timer["TurnTimer (components/TurnTimer.tsx)"]:::ui
                Ruleset["RulesetWidget (components/RulesetWidget.tsx)"]:::ui
                Collapsible["Collapsible (components/Collapsible.tsx)"]:::ui
                Leaderboard["Leaderboard (components/Leaderboard.tsx)"]:::ui
                Themed["ThemedComponents (components/ThemedComponents.tsx)"]:::ui
            end
        end

        subgraph "State Management (hooks/)"
            direction TB
            AuthCtx["AuthContext (hooks/authContext.tsx)"]:::logic
            Storage["useStorageState (hooks/useStorageState.tsx)"]:::logic
        end

        subgraph "Network Layer"
            direction TB
            NetConst["Network Constants (constants/Network.ts)"]:::logic
            Requests["HTTP Requests (utilities/requests.ts)"]:::logic
        end

        subgraph "Business Logic / Utilities"
            direction TB
            DeckUtils["Deck Utils (utilities/deckUtils.ts)"]:::logic
        end

        subgraph "Constants & Styles (constants/)"
            direction TB
            Colors["Colors (constants/Colors.ts)"]:::logic
            Styles["Styles (constants/Styles.ts)"]:::logic
            Interfaces["Interfaces (constants/Interfaces.ts)"]:::logic
        end

        subgraph "Assets"
            direction TB
            Fonts["Fonts (assets/fonts/)"]:::logic
            Images["Images (assets/images/)"]:::logic
        end

        LayoutApp --> AuthReg
        LayoutApp --> AuthSign
        AuthCtx --> LayoutApp
        Storage --> AuthCtx
        LayoutApp -->|"renders"| Home
        Home -->|"uses"| LobbyPlayer
        Home -->|"uses"| LobbyRule
        Home --> Storage
        Home --> AuthCtx
        Home -->|Invokes| InstaJoin
        InstaJoin --> Requests
        NewLue --> Requests
        NewMau --> Requests
        Lobby --> Requests
        LueView --> Requests
        MauView --> Requests
        Requests -->|reads| NetConst
        Requests -->|uses| Interfaces
        Requests -->|calls| ExternalAPI
    end

    ExternalAPI["Backend API"]:::external
    Device -->|"Network Calls"| ExternalAPI

    subgraph "Build & Deploy"
        direction TB
        ExpoCLI["expo CLI (scripts & run-config)"]:::config
        AndroidEmu["Android Emulator / Device"]:::external
        EAS["EAS (eas.json)"]:::config
        CI["CI/CD (.github/workflows/ci.yml)"]:::config
        ShellScripts["Shell Scripts (scripts/)"]:::config

        ExpoCLI --> AndroidEmu
        ShellScripts --> ExpoCLI
        CI --> EAS
        EAS -->|"builds artifact"| AndroidEmu
    end

    click LayoutApp "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/_layout.tsx"
    click AuthReg "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/register.tsx"
    click AuthSign "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/signIn.tsx"
    click Home "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/index.tsx"
    click InstaJoin "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/instajoin.tsx"
    click NewLue "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/newLuegenGame.tsx"
    click NewMau "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/newMauGame.tsx"
    click Lobby "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/gameLobby.tsx"
    click LueView "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/LuegenGameView.tsx"
    click MauView "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/MauGameView.tsx"
    click Profile "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/profilePage.tsx"
    click Rules "https://github.com/phillipc0/pp-cga-fe-public/blob/master/app/(app)/rulePage.tsx"
    click Card "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/Card.tsx"
    click OwnHand "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/OwnHand.tsx"
    click PlayerComp "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/Player.tsx"
    click LobbyPlayer "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/LobbyPlayerComponent.tsx"
    click LobbyRule "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/LobbyRuleComponent.tsx"
    click JackSel "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/JackSelectionComponent.tsx"
    click Timer "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/TurnTimer.tsx"
    click Ruleset "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/RulesetWidget.tsx"
    click Collapsible "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/Collapsible.tsx"
    click Leaderboard "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/Leaderboard.tsx"
    click Themed "https://github.com/phillipc0/pp-cga-fe-public/blob/master/components/ThemedComponents.tsx"
    click AuthCtx "https://github.com/phillipc0/pp-cga-fe-public/blob/master/hooks/authContext.tsx"
    click Storage "https://github.com/phillipc0/pp-cga-fe-public/blob/master/hooks/useStorageState.tsx"
    click NetConst "https://github.com/phillipc0/pp-cga-fe-public/blob/master/constants/Network.ts"
    click Requests "https://github.com/phillipc0/pp-cga-fe-public/blob/master/utilities/requests.ts"
    click DeckUtils "https://github.com/phillipc0/pp-cga-fe-public/blob/master/utilities/deckUtils.ts"
    click Colors "https://github.com/phillipc0/pp-cga-fe-public/blob/master/constants/Colors.ts"
    click Styles "https://github.com/phillipc0/pp-cga-fe-public/blob/master/constants/Styles.ts"
    click Interfaces "https://github.com/phillipc0/pp-cga-fe-public/blob/master/constants/Interfaces.ts"
    click Fonts "https://github.com/phillipc0/pp-cga-fe-public/tree/master/assets/fonts/"
    click Images "https://github.com/phillipc0/pp-cga-fe-public/tree/master/assets/images/"
    click ShellScripts "https://github.com/phillipc0/pp-cga-fe-public/blob/master/scripts/createGame.sh"
    click CI "https://github.com/phillipc0/pp-cga-fe-public/blob/master/.github/workflows/ci.yml"
    click EAS "https://github.com/phillipc0/pp-cga-fe-public/blob/master/eas.json"

    classDef ui fill:#e0f7fa,stroke:#006064,color:#006064
    classDef logic fill:#e8f5e9,stroke:#2e7d32,color:#2e7d32
    classDef config fill:#fff3e0,stroke:#ef6c00,color:#ef6c00
    classDef external fill:#ffebee,stroke:#c62828,color:#c62828
```
