# siddhant-goswami/expertora architecture

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

- Interactive diagram: https://gitdiagram.com/siddhant-goswami/expertora
- Repository: https://github.com/siddhant-goswami/expertora

## Overview

##### Main components
- Frontend Client Application: Built with React, Vite, and TypeScript.
- Components: Found in src/components (with further subdivision for UI components under src/components/ui) and UI-specific hooks under src/hooks.
- Pages: The routing and page level components in src/pages (e.g., Auth, Index, and NotFound).
- Styling: Handled using Tailwind CSS and component styles defined in source files (e.g., src/App.css, src/index.css).
- Integration Layer:
- Supabase Integration: There’s a dedicated folder under src/integrations/supabase (for the client) and a supabase directory with its own config and functions (like ai-search) that shows how backend logic or functions are managed.
- Build & Configurations:
- Vite configuration (vite.config.ts), TypeScript configuration files, postcss.config.js, tailwind.config.ts, and linting configurations ensure standardized build and style approaches.
- Deployment/Publishing: Instructions in the README indicate deployment is managed via Lovable or alternative hosts such as Netlify.

##### Relationships and interactions
- The Frontend Application communicates with the Supabase backend/integration layer through API calls encapsulated in src/integrations/supabase/client.ts.
- The UI components (from shadcn-ui coupled with Tailwind styling) are assembled in pages and further enhanced with custom hooks (src/hooks) for functionalities like authentication and notifications.
- The build process (using Vite) ties all these frontend components together while adhering to the configuration/compilation rules prescribed in tsconfig and other config files.

##### Important architectural patterns and design principles
- Component-based design (React components are organized in a clear directory structure).
- Separation of concerns: UI elements are separated from business logic or integration code. For example, the Supabase integration exists separately from individual UI components.
- Modular design: The adoption of shadcn-ui ensures that UI components are created in a reusable fashion.
- Integration/communication layer: The project encapsulates third-party services (Supabase functions) in well-defined directories.

##### Relevant technologies
- Frontend: React, TypeScript, Vite.
- Styling/UI: shadcn-ui, Tailwind CSS.
- API/Backend Functions: Supabase (for database/auth operations and serverless functions, such as ai-search).

##### Specific elements
- "UI Component Library" (shadcn-ui & Tailwind CSS).
- "Supabase Integration" (with further notes on client.ts, types.ts, and the Supabase function – ai-search).
- "Build/Configuration" (representing Vite, TypeScript, and other config files).
- Data flows from the Frontend Application to the Supabase backend (indicating API calls/communication).
- Dependencies between the Build configurations and the Frontend code.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Application Subgraph
    subgraph "Frontend Application"
        FE1["React Application"]:::frontend
        FE2["Pages"]:::frontend
        FE3["Components"]:::frontend
        FE4["Hooks"]:::frontend
        subgraph "Styling"
            ST1["App.css"]:::styling
            ST2["index.css"]:::styling
            ST3["Tailwind Config"]:::styling
        end
    end

    %% UI Component Library Subgraph
    subgraph "UI Component Library"
        UI["shadcn-ui & Tailwind CSS"]:::ui
    end

    %% Integration Layer Subgraph
    subgraph "Integration Layer"
        IN1["Supabase Client"]:::integration
        IN2["Supabase Backend Functions"]:::integration
    end

    %% Build/Configuration Subgraph
    subgraph "Build/Configuration"
        BC1["Vite Config"]:::config
        BC2["TS Config"]:::config
        BC3["TS App Config"]:::config
        BC4["PostCSS Config"]:::config
    end

    %% Connections within Frontend Application
    FE1 -->|"incorporates"| FE2
    FE1 -->|"composedOf"| FE3
    FE1 -->|"enhancedBy"| FE4
    FE1 -->|"styledWith"| ST1
    FE1 -->|"styledWith"| ST2
    FE1 -->|"styledWith"| ST3
    FE3 -->|"uses"| UI

    %% Connections between Frontend and Integration
    FE1 -->|"APICalls"| IN1
    IN1 -->|"triggers"| IN2

    %% Connections between Build/Configuration and Frontend
    BC1 -->|"builds"| FE1
    BC2 -->|"builds"| FE1
    BC3 -->|"builds"| FE1
    BC4 -->|"builds"| FE1

    %% Click Events
    click FE1 "https://github.com/siddhant-goswami/expertora/tree/main/src/"
    click FE2 "https://github.com/siddhant-goswami/expertora/tree/main/src/pages"
    click FE3 "https://github.com/siddhant-goswami/expertora/tree/main/src/components"
    click UI "https://github.com/siddhant-goswami/expertora/tree/main/src/components/ui"
    click FE4 "https://github.com/siddhant-goswami/expertora/tree/main/src/hooks"
    click ST1 "https://github.com/siddhant-goswami/expertora/blob/main/src/App.css"
    click ST2 "https://github.com/siddhant-goswami/expertora/blob/main/src/index.css"
    click ST3 "https://github.com/siddhant-goswami/expertora/blob/main/tailwind.config.ts"
    click IN1 "https://github.com/siddhant-goswami/expertora/tree/main/src/integrations/supabase"
    click IN2 "https://github.com/siddhant-goswami/expertora/tree/main/supabase/"
    click BC1 "https://github.com/siddhant-goswami/expertora/blob/main/vite.config.ts"
    click BC2 "https://github.com/siddhant-goswami/expertora/blob/main/tsconfig.json"
    click BC3 "https://github.com/siddhant-goswami/expertora/blob/main/tsconfig.app.json"
    click BC4 "https://github.com/siddhant-goswami/expertora/blob/main/postcss.config.js"

    %% Style Classes
    classDef frontend fill:#cfe8fc,stroke:#0b72b9,stroke-width:2px;
    classDef ui fill:#e6ccff,stroke:#8e44ad,stroke-width:2px;
    classDef integration fill:#fde4cf,stroke:#d35400,stroke-width:2px;
    classDef config fill:#f9f7cf,stroke:#b7950b,stroke-width:2px;
    classDef styling fill:#d1f2eb,stroke:#16a085,stroke-width:2px;
```
