# pranavipulluri/cultural-quest-exchangee architecture

> Architecture diagram of the GitHub repository pranavipulluri/cultural-quest-exchangee, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranavipulluri/cultural-quest-exchangee
- Repository: https://github.com/pranavipulluri/cultural-quest-exchangee

## Overview

##### Main Components
- Frontend Application – This is the core of the project, driven by Vite and React. It is composed of:
- UI Components: Located under src/components and further divided into general UI elements (e.g., buttons, alerts, modals) and specialized components (e.g., AnimatedCharacter, KeralaItinerary, WorldGlobe, and multiple game components under src/components/games).
- Pages & Routing: Under src/pages you have distinct views (Auth, Chat, About, Marketplace, etc.), each likely wired together with a routing library.
- Global Contexts & Hooks: For example, AuthContext and ChatContext in src/contexts and various hooks (e.g., useSoundEffects, useProfile) in src/hooks that manage state and behavior across the app.
- Utility & Library Code: Under src/lib and src/utils which encapsulate common functionality.
- Asset Management – The public folder holds images, textures, and audio files which support the UI with backgrounds, character images, sounds, etc.
- Integration Layer – The supabase directory under the project contains configuration, migrations, and a dedicated integration module (src/integrations/supabase) that handles communication with the Supabase backend, including authentication and realtime data.
- Build & Configuration Tools – Files like vite.config.ts, tsconfig.json, tailwind.config.ts, and related configuration files that control the project’s build process and styling.

##### Relationships and Interactions
- The React frontend (view layer) consumes the UI components, which in turn depend on hooks and contexts for state management.
- User interactions on the various pages (e.g., starting a game like CookingChallenge or interacting with the chat feature) trigger actions that flow through the context providers.
- These actions may call functions in the integration layer where the Supabase client (defined in src/integrations/supabase/client.ts) handles persistent data storage and real-time interactions.
- Assets from the public folder are loaded by components for display (images, sounds, etc.).
- The build configuration files (Vite, TSConfig, Tailwind) ensure that the application compiles and runs with the expected optimizations and styling rules.

##### Emphasized Architectural Patterns
- Component-Based Architecture – The project segments the UI into reusable components (both generic UI modules and game-specific components).
- Separation of Concerns – There’s a clean separation between UI rendering (components), state management (contexts and hooks), business logic (in utilities and integrations), and persistence (via Supabase).
- Modular Integration – The integration code is separated into its own directory indicating that external services (Supabase) are abstracted into their own module.

##### Final Touches
- Every component and subcomponent is clearly labeled.
- Incorporate notes or legends to explain the purpose of each group (e.g., “UI Components (React & shadcn-ui)”, “Integration (Supabase Client)”).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Application
    subgraph "Frontend Application (React)"
        FE_App["Main React App"]:::frontend
        subgraph "UI Components"
            UI_Gen["General UI Components"]:::frontend
            UI_Spec["Specialized UI Components"]:::frontend
            UI_Game["Game Components"]:::frontend
        end
        Pages["Pages & Routing"]:::pages
    end

    %% Global State Management
    subgraph "Global State Management"
        GlobalCtx["Context Providers"]:::context
        Hooks["Custom Hooks"]:::context
    end

    %% Utility & Library Code
    subgraph "Utility & Library Code"
        UUtils["Utility Functions"]:::build
        ULib["Library Code"]:::build
    end

    %% Integration Layer (Supabase)
    subgraph "Integration Layer (Supabase)"
        Supabase["Supabase Client"]:::integration
    end

    %% Asset and Build Layers
    Assets["Asset Management"]:::asset
    Build["Build & Configuration Tools"]:::build
    Tech["Technology Stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS"]:::build

    %% Connections
    FE_App --> UI_Gen
    FE_App --> UI_Spec
    FE_App --> UI_Game
    FE_App --> Pages

    UI_Gen -->|"triggers"| GlobalCtx
    UI_Spec -->|"triggers"| GlobalCtx
    UI_Game -->|"triggers"| GlobalCtx
    Pages -->|"routes_to"| GlobalCtx

    GlobalCtx -->|"calls"| Hooks
    Hooks -->|"utilizes"| UUtils
    Hooks -->|"utilizes"| ULib

    GlobalCtx -->|"fetches/updates"| Supabase

    UI_Spec -->|"loads"| Assets
    Pages -->|"loads"| Assets

    FE_App -->|"configured_by"| Build
    Build -->|"supports"| Tech

    %% Click Events
    click FE_App "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/App.tsx"
    click FE_App "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/main.tsx"
    click UI_Gen "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/src/components/ui"
    click UI_Spec "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/components/AnimatedCharacter.tsx"
    click UI_Spec "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/components/KeralaItinerary.tsx"
    click UI_Spec "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/components/WorldGlobe.tsx"
    click UI_Spec "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/components/NavigationBar.tsx"
    click UI_Spec "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/components/PageLayout.tsx"
    click UI_Game "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/src/components/games"
    click Pages "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/src/pages"
    click GlobalCtx "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/src/contexts"
    click Hooks "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/src/hooks"
    click UUtils "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/src/utils"
    click ULib "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/src/lib"
    click Supabase "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/src/integrations/supabase/client.ts"
    click Assets "https://github.com/pranavipulluri/cultural-quest-exchangee/tree/main/public"
    click Build "https://github.com/pranavipulluri/cultural-quest-exchangee/blob/main/vite.config.ts"

    %% Styles
    classDef frontend fill:#FFE0B2,stroke:#BF360C,stroke-width:2px;
    classDef context fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px;
    classDef integration fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px;
    classDef asset fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef build fill:#D1C4E9,stroke:#4A148C,stroke-width:2px;
    classDef pages fill:#FFF9C4,stroke:#F57F17,stroke-width:2px;
```
