# atharv-rem/design-index architecture

> Architecture diagram of the GitHub repository atharv-rem/design-index, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atharv-rem/design-index
- Repository: https://github.com/atharv-rem/design-index

## Overview

##### Project Type and Purpose
- This is a frontend-centric, single-page React application (“Design Index”) that provides a searchable directory of design resources.
- It’s hosted on Vercel (static assets + a serverless function for sitemap), connects to Supabase for data/search, and uses Cloudflare R2 to store and serve images.

##### File Structure Analysis
- Top level
– design-directory/
- api/sitemap.js (Vercel serverless function)
- public/ (robots.txt, sitemap.xml stub)
- src/ (React entrypoints, components, assets)
- supabaseClient.js (Supabase init)
- zustand-global-storage.js (global state management)
- vite.config.js, vercel.json (build & deploy configs)
- Components follow a flat structure under src/components (about, homepage, search bar/results, etc.)
- database.json in src likely mocks or seeds data locally.
- Configuration: package.json, eslint.config.js, Tailwind + Vite setup.

##### README Insights
- Core tech: React + TailwindCSS, React Router, Zustand, Tanstack Virtualization.
- External services: Supabase (Postgres & search), Cloudflare R2 (static image hosting), Vercel (hosting + functions).
- Purpose: Curated, fast searchable catalogue of mostly free design assets.

a. Main Components
- User’s Browser (React SPA)
- Vercel CDN & Edge (serving index.html, JS bundles, CSS)
- Vercel Serverless Function (api/sitemap.js)
- Supabase (database + search engine)
- Cloudflare R2 (image storage & delivery)
b. Relationships & Data Flows
1. Browser → Vercel CDN (fetch static assets)
2. Browser → Supabase via supabaseClient (REST/GraphQL calls for search & resource data)
3. Browser → Cloudflare R2 (pre-signed URL image fetch)
4. Vercel Function → Supabase (generate sitemap from DB) → returns XML to Vercel → CDN
c. Architectural Patterns
- SPA (frontend heavy) with API-first design
- Serverless functions (sitemap generation)
- External Backend-as-a-Service (Supabase)
- CDN + Object Storage (Vercel + Cloudflare R2)
- Global state via Zustand; virtualization via Tanstack for performance
d. Key Technologies
– React, React Router, TailwindCSS, Zustand, Tanstack Virtualization
– Vite (build tool), Vercel (hosting + functions)
– Supabase (DB & search), Cloudflare R2 (images)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["User Browser\n(React SPA)"]:::frontend
    end

    %% Hosting Layer
    subgraph "Static Hosting (Vercel)"
        direction TB
        CDN["Vercel CDN\n(Static Assets)"]:::api
        SitemapFn["Serverless Function\napi/sitemap.js"]:::api
    end

    %% Dynamic Services
    subgraph "Dynamic Services"
        direction TB
        Supabase["Supabase\n(Database & Search)"]:::storage
    end

    %% External Storage
    subgraph "Object Storage & Assets"
        direction TB
        R2["Cloudflare R2\n(Image Storage)"]:::storage
    end

    %% Codebase
    subgraph "Codebase (design-directory/src)"
        direction TB
        Entry["React Entry Points\nmain.jsx, App.jsx"]:::frontend
        Components["UI Components\nsrc/components/"]:::frontend
        Styles["Global Styles\nindex.css"]:::frontend
        SupaClient["Supabase Client Init\nsupabaseClient.js"]:::api
        Zustand["Global State (Zustand)\nzustand-global-storage.js"]:::frontend
        Assets["Image Assets\nsrc/assets/"]:::frontend
        DataMock["Local Data Mock\ndatabase.json"]:::frontend
    end

    %% Config & Deployment
    subgraph "Config & Deployment"
        direction TB
        BuildCfg["Build & Deploy Config\nvite.config.js, vercel.json"]:::api
        StaticAssets["Static Hosting Assets\nrobots.txt, sitemap.xml"]:::api
        ProjectCfg["Project Config\npackage.json, package-lock.json"]:::frontend
    end

    %% Connections
    Browser -->|"Fetch Static Assets"| CDN
    Browser -->|"REST/GraphQL Calls"| Supabase
    Browser -->|"Fetch Images (pre-signed URLs)"| R2
    SitemapFn -->|"Query for Sitemap"| Supabase
    CDN -->|"Serves Function Endpoint"| SitemapFn

    %% Codebase to Runtime Relationships
    Browser --> Entry
    Entry --> Components
    Entry --> Styles
    Entry --> SupaClient
    Entry --> Zustand
    Components --> Assets
    Components --> DataMock

    %% Deployment Config Links
    CDN --> StaticAssets
    SitemapFn --> BuildCfg
    CDN --> BuildCfg
    Browser --> ProjectCfg

    %% Click Events
    click Entry "https://github.com/atharv-rem/design-index/blob/main/design-directory/src/main.jsx"
    click Entry "https://github.com/atharv-rem/design-index/blob/main/design-directory/src/App.jsx"
    click Components "https://github.com/atharv-rem/design-index/tree/main/design-directory/src/components/"
    click Styles "https://github.com/atharv-rem/design-index/blob/main/design-directory/src/index.css"
    click SupaClient "https://github.com/atharv-rem/design-index/blob/main/design-directory/src/supabaseClient.js"
    click Zustand "https://github.com/atharv-rem/design-index/blob/main/design-directory/src/zustand-global-storage.js"
    click SitemapFn "https://github.com/atharv-rem/design-index/blob/main/design-directory/api/sitemap.js"
    click StaticAssets "https://github.com/atharv-rem/design-index/blob/main/design-directory/public/robots.txt"
    click StaticAssets "https://github.com/atharv-rem/design-index/blob/main/design-directory/public/sitemap.xml"
    click BuildCfg "https://github.com/atharv-rem/design-index/blob/main/design-directory/vite.config.js"
    click BuildCfg "https://github.com/atharv-rem/design-index/blob/main/design-directory/vercel.json"
    click Assets "https://github.com/atharv-rem/design-index/tree/main/design-directory/src/assets/"
    click DataMock "https://github.com/atharv-rem/design-index/blob/main/design-directory/src/database.json"
    click ProjectCfg "https://github.com/atharv-rem/design-index/blob/main/design-directory/package.json"
    click ProjectCfg "https://github.com/atharv-rem/design-index/blob/main/design-directory/package-lock.json"

    %% Styles
    classDef frontend fill:#1e2a38,stroke:#61DAFB,color:#E0E0E0;
    classDef api fill:#014d40,stroke:#00d4d4,color:#E0E0E0;
    classDef storage fill:#4a341c,stroke:#fbbf24,color:#E0E0E0;
```
