# aveekgg/govern-assess-hub architecture

> Architecture diagram of the GitHub repository aveekgg/govern-assess-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aveekgg/govern-assess-hub
- Repository: https://github.com/aveekgg/govern-assess-hub

## Overview

##### Project type and purpose
- This is a full-stack, single-page survey application (“Lovable”) built with React+TypeScript and deployed via Vite.
- It uses Supabase as its back-end (PostgreSQL database, authentication, serverless functions) and integrates with external Google Sheets for data sync.

##### File structure
- Top-level assets and config:
- index.html, public/robots.txt (static hosting entry)
- bun.lockb, package.json, vite.config.ts, tsconfig*.json, tailwind.config.ts (build/system config)
- Source code (src/):
- main.tsx, App.tsx, index.css – application entry point and global styles
- components/ & components/ui/ – UI library built on shadcn-ui and Tailwind primitives
- pages/ – route components (Index, Admin, Results, NotFound)
- data/ – static survey schema (surveyData.json)
- hooks/ – custom React hooks (use-mobile, use-toast)
- integrations/supabase/ – Supabase client setup and types
- lib/ – shared utility functions
- Backend integration (supabase/):
- supabase/config.toml – project configuration
- migrations/ – SQL schema migrations for PostgreSQL
- functions/sync-to-google-sheets – Edge Function that pushes data to Google Sheets

##### README for additional insights
- Confirms tech stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS
- Clarifies development workflow (npm run dev) and deployment via Lovable’s platform
- Mentions no other microservices or external APIs beyond Google Sheets

## Diagram (Mermaid)

```mermaid
graph TB
    %% Frontend Layer
    subgraph "Frontend (src/)"
        direction TB
        browser["User Browser"]:::external
        indexHTML["index.html"]:::frontend
        main["main.tsx"]:::frontend
        App["App.tsx"]:::frontend

        subgraph "UI Components"
            direction TB
            UI["src/components/ui/*"]:::frontend
        end

        subgraph "Survey Components"
            direction TB
            Cat["CategorySection.tsx"]:::frontend
            Prog["ProgressBar.tsx"]:::frontend
            Rat["RatingScale.tsx"]:::frontend
            ResComp["ResultsChart.tsx"]:::frontend
        end

        subgraph "Route Pages"
            direction TB
            Home["Index.tsx"]:::frontend
            Admin["Admin.tsx"]:::frontend
            ResultsPage["Results.tsx"]:::frontend
            NotFound["NotFound.tsx"]:::frontend
        end

        Data["surveyData.json"]:::frontend

        subgraph "Custom Hooks"
            direction TB
            Mobile["use-mobile.tsx"]:::frontend
            Toast["use-toast.ts"]:::frontend
        end

        subgraph "Integrations"
            direction TB
            SupaCli["client.ts"]:::backend
            SupaTypes["types.ts"]:::backend
        end

        Utils["utils.ts"]:::frontend

        subgraph "Global Styles"
            direction TB
            CSS1["index.css"]:::frontend
            CSS2["App.css"]:::frontend
        end

        subgraph "Toolchain Configs"
            direction TB
            ViteCfg["vite.config.ts"]:::frontend
            TailwindCfg["tailwind.config.ts"]:::frontend
            TsCfg["tsconfig.json"]:::frontend
            PostCss["postcss.config.js"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Supabase"
        direction TB
        Auth["Auth Service"]:::backend
        DB["PostgreSQL Database"]:::backend
        Migrations["Migrations"]:::backend
        Functions["sync-to-google-sheets"]:::function
        ConfigToml["config.toml"]:::backend
    end

    %% External Services
    Sheets["Google Sheets API"]:::external

    %% Relationships
    browser --> indexHTML
    indexHTML --> main
    main --> App
    App --> UI
    App --> Cat
    App --> Prog
    App --> Rat
    App --> ResComp
    App --> Home
    App --> Admin
    App --> ResultsPage
    App --> NotFound
    App --> Data
    App --> Mobile
    App --> Toast
    App --> SupaCli
    App --> Utils
    App --> CSS1
    App --> CSS2
    SupaCli --> Auth
    SupaCli --> DB
    Auth --> DB
    DB --> Migrations
    Functions --> Sheets
    App --> Functions

    %% Click Events
    click indexHTML "https://github.com/aveekgg/govern-assess-hub/blob/main/index.html"
    click main "https://github.com/aveekgg/govern-assess-hub/blob/main/src/main.tsx"
    click App "https://github.com/aveekgg/govern-assess-hub/blob/main/src/App.tsx"
    click UI "https://github.com/aveekgg/govern-assess-hub/tree/main/src/components/ui/"
    click Cat "https://github.com/aveekgg/govern-assess-hub/blob/main/src/components/CategorySection.tsx"
    click Prog "https://github.com/aveekgg/govern-assess-hub/blob/main/src/components/ProgressBar.tsx"
    click Rat "https://github.com/aveekgg/govern-assess-hub/blob/main/src/components/RatingScale.tsx"
    click ResComp "https://github.com/aveekgg/govern-assess-hub/blob/main/src/components/ResultsChart.tsx"
    click Home "https://github.com/aveekgg/govern-assess-hub/blob/main/src/pages/Index.tsx"
    click Admin "https://github.com/aveekgg/govern-assess-hub/blob/main/src/pages/Admin.tsx"
    click ResultsPage "https://github.com/aveekgg/govern-assess-hub/blob/main/src/pages/Results.tsx"
    click NotFound "https://github.com/aveekgg/govern-assess-hub/blob/main/src/pages/NotFound.tsx"
    click Data "https://github.com/aveekgg/govern-assess-hub/blob/main/src/data/surveyData.json"
    click Mobile "https://github.com/aveekgg/govern-assess-hub/blob/main/src/hooks/use-mobile.tsx"
    click Toast "https://github.com/aveekgg/govern-assess-hub/blob/main/src/hooks/use-toast.ts"
    click SupaCli "https://github.com/aveekgg/govern-assess-hub/blob/main/src/integrations/supabase/client.ts"
    click SupaTypes "https://github.com/aveekgg/govern-assess-hub/blob/main/src/integrations/supabase/types.ts"
    click Utils "https://github.com/aveekgg/govern-assess-hub/blob/main/src/lib/utils.ts"
    click CSS1 "https://github.com/aveekgg/govern-assess-hub/blob/main/src/index.css"
    click CSS2 "https://github.com/aveekgg/govern-assess-hub/blob/main/src/App.css"
    click ViteCfg "https://github.com/aveekgg/govern-assess-hub/blob/main/vite.config.ts"
    click TailwindCfg "https://github.com/aveekgg/govern-assess-hub/blob/main/tailwind.config.ts"
    click TsCfg "https://github.com/aveekgg/govern-assess-hub/blob/main/tsconfig.json"
    click PostCss "https://github.com/aveekgg/govern-assess-hub/blob/main/postcss.config.js"
    click ConfigToml "https://github.com/aveekgg/govern-assess-hub/blob/main/supabase/config.toml"
    click Migrations "https://github.com/aveekgg/govern-assess-hub/blob/main/supabase/migrations/20251011060127_004fc6fc-4398-4822-8042-19bcc7f30e40.sql"
    click Functions "https://github.com/aveekgg/govern-assess-hub/blob/main/supabase/functions/sync-to-google-sheets/index.ts"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0288D1,stroke-width:1px;
    classDef backend fill:#E0F7FA,stroke:#00796B,stroke-width:1px;
    classDef function fill:#FFF9C4,stroke:#F57F17,stroke-width:1px;
    classDef external fill:#F5F5F5,stroke:#9E9E9E,stroke-width:1px;
```
