# ayushp2563/onetaplink architecture

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

- Interactive diagram: https://gitdiagram.com/ayushp2563/onetaplink
- Repository: https://github.com/ayushp2563/onetaplink

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with Vite, React (TypeScript), Tailwind CSS, and shadcn-ui components.
- It’s primarily a front-end “Profile Designer” that connects to Supabase for authentication, database storage, and file storage.

##### File structure
- Top-level:
- public/ and index.html → static assets and entry point
- src/ → all React application code
- src/components/ → reusable UI components (layouts, theme provider, custom inputs, shadcn-ui wrappers)
- src/pages/ → page-level components (Auth, ProfileEditor, Settings, UserProfile, etc.)
- src/integrations/supabase/ → Supabase client config and type definitions
- supabase/config.toml → Supabase project configuration for local emulation/deployment
- vite.config.ts, tsconfig*.json, tailwind.config.ts → build tool and styling setups
- No custom backend server code—app relies on Supabase BaaS for backend functionality.

##### Key insights from the README
- Tech stack: Vite + React + TypeScript + Tailwind CSS + shadcn-ui
- Deployment: Lovable’s built-in publisher or external hosts (e.g., Netlify)
- Editing: changes flow through Git (GitHub) and Lovable UI, triggering rebuilds.

##### Main components
a. Client (Browser)
- Runs the React SPA, bundling by Vite.
- Renders UI using shadcn-ui + Tailwind CSS.
- Contains page routes (React Router or a custom router via “ProtectedRoute” component).
b. Hosting & CI/CD
- GitHub repo + Lovable UI for code editing & version control.
- Vite build pipeline triggered on push / Lovable “Publish.”
- Static files served via Vercel/Netlify (or Lovable’s hosting).
c. Supabase Backend
- Auth service for user sign-in / sign-up.
- Database (Postgres) storing user profiles, links, metadata.
- Storage buckets for profile images / favicons.
d. External services
- (Optional) GitHub OAuth integration via Supabase for SSO.
- (Optional) Third-party analytics or CDN endpoints for static assets.

##### Relationships and data flows
- User’s Browser → (HTTPS) → Static Host → serves index.html + JS/CSS
- SPA → (RPC/REST/WebSocket) → Supabase Auth → login/signup flows
- SPA → (Postgres queries via Supabase client) → read/write profile data
- GitHub/Lovable UI → (Git) → GitHub repo → triggers build & redeploy

##### Architectural patterns & design principles
- Component-based UI (Atomic Design):
- ui/ folder = design primitives (buttons, inputs, modals)
- components/ = compound components (Navbar, ProfileForm, layouts)
- pages/ = route-level containers
- Client-driven state and side effects via React hooks (use-debounce, use-toast)
- BaaS pattern: no custom backend, leveraging Supabase for all server-side needs

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (Browser)" 
        direction TB
        browser(["User Browser"]):::client
        subgraph "React SPA" 
            direction TB
            main_tsx["src/main.tsx"]:::code
            app_tsx["src/App.tsx"]:::code
            subgraph "UI Primitives" 
                direction TB
                ui_dir["src/components/ui/"]:::code
            end
            subgraph "Compound Components" 
                direction TB
                comp_dir["src/components/"]:::code
            end
            subgraph "Layouts" 
                direction TB
                layouts_dir["src/components/layouts/"]:::code
            end
            prot_route["src/components/ProtectedRoute.tsx"]:::code
            theme_provider["src/components/theme-provider.tsx"]:::code
            theme_toggle["src/components/theme-toggle.tsx"]:::code
            pages_dir["src/pages/"]:::code
            vite_dev["Vite Dev Server (npm run dev)"]:::service
        end
    end

    %% CI/CD & Hosting Layer
    subgraph "CI/CD & Hosting" 
        direction TB
        gh_ui(["GitHub / Lovable UI"]):::external
        git_repo(["Git Repository"]):::hosting
        build["Build (Vite)"]:::service
        vite_config["vite.config.ts"]:::code
        deploy["Deploy (Vercel / Netlify / Lovable)"]:::hosting
        vercel_cfg["vercel.json"]:::code
    end

    %% BaaS Backend Layer
    subgraph "Supabase Backend" 
        direction TB
        auth["Supabase Auth Service"]:::service
        db["Postgres Database"]:::database
        storage["Storage Buckets"]:::storage
        sb_client["src/integrations/supabase/client.ts"]:::code
        sb_types["src/integrations/supabase/types.ts"]:::code
        sb_config["supabase/config.toml"]:::code
    end

    %% External Services
    subgraph "External Services" 
        direction TB
        github_oauth["GitHub OAuth (via Supabase)"]:::external
        analytics["Third-Party Analytics / CDN"]:::external
    end

    %% Static Assets
    static_html["index.html & public/"]:::code

    %% Connections
    browser -->|"loads static files"| static_html
    static_html -->|"serves React SPA"| browser
    browser -->|"runs SPA"| vite_dev
    vite_dev --> main_tsx
    main_tsx --> app_tsx
    app_tsx --> ui_dir
    app_tsx --> comp_dir
    app_tsx --> layouts_dir
    app_tsx --> prot_route
    app_tsx --> theme_provider
    app_tsx --> theme_toggle
    app_tsx --> pages_dir

    browser -->|"HTTPS RPC/REST/WebSocket"| auth
    browser -->|"Postgres queries"| db
    browser -->|"Storage API calls"| storage

    auth --> sb_client
    db --> sb_client
    storage --> sb_client
    sb_client --> sb_types
    sb_client --> sb_config

    gh_ui -->|"Git push"| git_repo
    git_repo -->|"trigger build"| build
    build --> vite_config
    build --> deploy
    deploy --> vercel_cfg
    deploy --> static_html

    auth --- github_oauth
    static_html --- analytics

    %% Click events
    click main_tsx "https://github.com/ayushp2563/onetaplink/blob/main/src/main.tsx"
    click app_tsx "https://github.com/ayushp2563/onetaplink/blob/main/src/App.tsx"
    click ui_dir "https://github.com/ayushp2563/onetaplink/tree/main/src/components/ui/"
    click comp_dir "https://github.com/ayushp2563/onetaplink/tree/main/src/components/"
    click layouts_dir "https://github.com/ayushp2563/onetaplink/tree/main/src/components/layouts/"
    click prot_route "https://github.com/ayushp2563/onetaplink/blob/main/src/components/ProtectedRoute.tsx"
    click theme_provider "https://github.com/ayushp2563/onetaplink/blob/main/src/components/theme-provider.tsx"
    click theme_toggle "https://github.com/ayushp2563/onetaplink/blob/main/src/components/theme-toggle.tsx"
    click pages_dir "https://github.com/ayushp2563/onetaplink/tree/main/src/pages/"
    click sb_client "https://github.com/ayushp2563/onetaplink/blob/main/src/integrations/supabase/client.ts"
    click sb_types "https://github.com/ayushp2563/onetaplink/blob/main/src/integrations/supabase/types.ts"
    click sb_config "https://github.com/ayushp2563/onetaplink/blob/main/supabase/config.toml"
    click vite_config "https://github.com/ayushp2563/onetaplink/blob/main/vite.config.ts"
    click vercel_cfg "https://github.com/ayushp2563/onetaplink/blob/main/vercel.json"

    %% Styles
    classDef client fill:#D6E9FE,stroke:#4A90E2,stroke-width:1px
    classDef service fill:#E8F5E9,stroke:#388E3C,stroke-width:1px
    classDef code fill:#FFF4E5,stroke:#FFA726,stroke-width:1px
    classDef database fill:#E3F2FD,stroke:#1976D2,stroke-width:1px
    classDef storage fill:#F3E5F5,stroke:#8E24AA,stroke-width:1px
    classDef hosting fill:#ECEFF1,stroke:#546E7A,stroke-width:1px
    classDef external fill:#FFEBEE,stroke:#E53935,stroke-width:1px
```
