# prithvi2004/graphify-fe architecture

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

- Interactive diagram: https://gitdiagram.com/prithvi2004/graphify-fe
- Repository: https://github.com/prithvi2004/graphify-fe

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with React, TypeScript, Vite, Tailwind CSS, and shadcn-ui.
- It serves as a front-end client that authenticates users (via Supabase Auth) and reads/writes data to a Supabase backend.

##### File structure
- Top level:
- public/ (static assets: robots.txt, video)
- src/ (application source code)
- supabase/ (Supabase config)
- config files: tsconfig, vite.config.ts, tailwind.config.ts, eslint.config.js
- src/ hierarchy:
- components/ (UI primitives, auth, hero, home sections)
- hooks/ (custom React hooks)
- integrations/ (Supabase client & types)
- lib/ (utility functions)
- pages/ (Routable views: Index, Generate, NotFound)
- main.tsx & index.html (app entry point)

##### README
- Confirms tech stack: React + TypeScript, Vite, shadcn-ui, Tailwind CSS
- Deployment & editing via Lovable platform
- No custom backend in this repo—Supabase provides authentication and database

##### Main components
a. Client-side React App (SPA)
- UI layer (shadcn-ui components, Tailwind styling)
- React Router pages (Index, Generate, NotFound)
- State management & hooks (e.g., useToast, useMobile)
b. Vite Development Server / Build
- Serves index.html, bundles src/ to static assets
c. Static Hosting / CDN
- Hosts the built assets (HTML, JS, CSS, media)
- Either Lovable’s hosting or custom domain
d. User Authentication & Database (Supabase)
- AuthProvider + GoogleAuthButton → Supabase Auth
- Supabase client (src/integrations/supabase/client.ts)
- Supabase DB (tables, real-time subscriptions)
e. External Services
- Lovable platform (CI/CD, auto-deploy)
- Optional custom domain / DNS

##### Relationships and data flows
- Browser → (HTTPS) → Static Hosting → serves index.html & bundle
- React App → (Supabase SDK calls) → Supabase Auth & REST/Realtime APIs
- User actions (Generate page) → calls DB functions or edge functions via Supabase
- Vite dev server (dev mode) proxies API calls if configured

##### Architectural patterns & design principles
- SPA architecture: clear separation of UI components vs. data integration
- “Presentational vs. Container” components:
- UI primitives (components/ui/*) for look & feel
- Functional components (pages, integrations) for business logic
- Context providers (AuthProvider, ThemeProvider) for cross-cutting concerns
- Modular directory structure: by feature (auth, hero, home) & by layer (ui, hooks, lib)

- Clear, concise labels (component name + file path)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Frontend (SPA)"
        direction TB
        EntryHTML["index.html"]:::assets
        EntryMain["main.tsx"]:::frontend
        App["App.tsx"]:::frontend
        AppCSS["App.css"]:::frontend
        subgraph "UI Library"
            UIPrims["src/components/ui"]:::frontend
        end
        ThemeProv["theme-provider.tsx"]:::frontend
        ThemeToggle["theme-toggle.tsx"]:::frontend
        AuthProv["AuthProvider.tsx"]:::frontend
        GoogleBtn["GoogleAuthButton.tsx"]:::frontend
        UserMenu["UserMenu.tsx"]:::frontend
        subgraph "Hero Section"
            FeatureShow["FeatureShowcase.tsx"]:::frontend
            HeroStats["HeroStats.tsx"]:::frontend
            HeroVideo["HeroVideo.tsx"]:::frontend
        end
        HomeEx["example.tsx"]:::frontend
        subgraph "Hooks"
            UseMobile["use-mobile.tsx"]:::frontend
            UseToast["use-toast.ts"]:::frontend
        end
        subgraph "Pages"
            IndexPg["Index.tsx"]:::frontend
            GeneratePg["Generate.tsx"]:::frontend
            NotFoundPg["NotFound.tsx"]:::frontend
        end
        LibUtils["utils.ts"]:::frontend
        SupaClient["client.ts"]:::frontend
        SupaTypes["types.ts"]:::frontend
    end

    subgraph "BaaS: Supabase"
        direction TB
        SupabaseAuth["Supabase Auth"]:::ext
        SupabaseDB["Supabase Database"]:::db
        SupabaseConfig["config.toml"]:::config
    end

    subgraph "Platform & Hosting"
        direction TB
        ViteConfig["vite.config.ts"]:::config
        TailwindConfig["tailwind.config.ts"]:::config
        TSConfigs["tsconfig.json"]:::config
        ESLintConfig["eslint.config.js"]:::config
        PostCSSConfig["postcss.config.js"]:::config
        ViteEnv["vite-env.d.ts"]:::config
        DevServer["Vite Dev Server"]:::ext
        CDN["Static Hosting / CDN"]:::assets
        Lovable["Lovable CI/CD"]:::ext
    end

    %% Connections
    EntryHTML --> EntryMain
    EntryMain --> App
    App --> UIPrims
    App --> ThemeProv --> ThemeToggle
    App --> AuthProv
    AuthProv --> GoogleBtn
    AuthProv --> SupabaseAuth
    GoogleBtn --> SupabaseAuth
    App --> UserMenu
    App --> IndexPg
    App --> GeneratePg
    App --> NotFoundPg
    GeneratePg --> SupaClient --> SupabaseDB
    IndexPg --> SupaClient
    SupaClient --> SupabaseAuth
    SupaClient --> SupabaseDB
    App --> UseMobile
    App --> UseToast
    App --> LibUtils
    App --> SupaTypes

    %% Build & Deploy Flow
    EntryMain --> ViteConfig --> DevServer --> CDN
    CDN -->|"Hosts static assets"| EntryHTML
    Lovable --> CDN

    %% Click Events
    click EntryMain "https://github.com/prithvi2004/graphify-fe/blob/main/src/main.tsx"
    click EntryHTML "https://github.com/prithvi2004/graphify-fe/blob/main/index.html"
    click App "https://github.com/prithvi2004/graphify-fe/blob/main/src/App.tsx"
    click AppCSS "https://github.com/prithvi2004/graphify-fe/blob/main/src/App.css"
    click UIPrims "https://github.com/prithvi2004/graphify-fe/tree/main/src/components/ui/"
    click ThemeProv "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/theme-provider.tsx"
    click ThemeToggle "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/theme-toggle.tsx"
    click AuthProv "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/auth/AuthProvider.tsx"
    click GoogleBtn "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/auth/GoogleAuthButton.tsx"
    click UserMenu "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/UserMenu.tsx"
    click FeatureShow "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/hero/FeatureShowcase.tsx"
    click HeroStats "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/hero/HeroStats.tsx"
    click HeroVideo "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/hero/HeroVideo.tsx"
    click HomeEx "https://github.com/prithvi2004/graphify-fe/blob/main/src/components/home/example.tsx"
    click UseMobile "https://github.com/prithvi2004/graphify-fe/blob/main/src/hooks/use-mobile.tsx"
    click UseToast "https://github.com/prithvi2004/graphify-fe/blob/main/src/hooks/use-toast.ts"
    click SupaClient "https://github.com/prithvi2004/graphify-fe/blob/main/src/integrations/supabase/client.ts"
    click SupaTypes "https://github.com/prithvi2004/graphify-fe/blob/main/src/integrations/supabase/types.ts"
    click LibUtils "https://github.com/prithvi2004/graphify-fe/blob/main/src/lib/utils.ts"
    click IndexPg "https://github.com/prithvi2004/graphify-fe/blob/main/src/pages/Index.tsx"
    click GeneratePg "https://github.com/prithvi2004/graphify-fe/blob/main/src/pages/Generate.tsx"
    click NotFoundPg "https://github.com/prithvi2004/graphify-fe/blob/main/src/pages/NotFound.tsx"
    click SupabaseConfig "https://github.com/prithvi2004/graphify-fe/blob/main/supabase/config.toml"
    click ViteConfig "https://github.com/prithvi2004/graphify-fe/blob/main/vite.config.ts"
    click TailwindConfig "https://github.com/prithvi2004/graphify-fe/blob/main/tailwind.config.ts"
    click TSConfigs "https://github.com/prithvi2004/graphify-fe/blob/main/tsconfig.json"
    click ESLintConfig "https://github.com/prithvi2004/graphify-fe/blob/main/eslint.config.js"
    click PostCSSConfig "https://github.com/prithvi2004/graphify-fe/blob/main/postcss.config.js"
    click ViteEnv "https://github.com/prithvi2004/graphify-fe/blob/main/src/vite-env.d.ts"
    click UIPrims "https://github.com/prithvi2004/graphify-fe/tree/main/src/components/ui/"

    %% Styles
    classDef frontend fill:#cfe2ff,stroke:#084298
    classDef db fill:#fce5cd,stroke:#b45f06
    classDef ext fill:#d9ead3,stroke:#38761d
    classDef assets fill:#e7e6e6,stroke:#a0a0a0
    classDef config fill:#f0f0f0,stroke:#505050
```
