# bloqxstudio/json-documentor architecture

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

- Interactive diagram: https://gitdiagram.com/bloqxstudio/json-documentor
- Repository: https://github.com/bloqxstudio/json-documentor

## Overview

##### Project Type & Purpose
- The README makes it clear that this is a web application built with modern front-end technologies (React, Vite, TypeScript) that also communicates with Supabase for backend services (API calls, database operations, serverless functions).
- The project is structured for both development and deployability (with support for live development using npm scripts, and with deployment guidance in Lovable and external services like Netlify for custom domains).

##### Key Architectural Components
A. Frontend/UI Layer:
- Components: Your “src” directory contains a rich library of React components (UI elements, forms, filters, and layouts) so start by grouping these into major categories:
- Base Pages: The “pages” folder includes distinct routes such as AdminPanel, ComponentDetail, ComponentEdit, Login, Register, etc.
- UI & Layout Components: In “src/components/ui” and “src/components/layout”, you get the reusable UI blocks (buttons, cards, alerts, navigation menus, etc.).
- Domain-Specific Components: There are specific groups – such as “admin”, “forms”, “filters” and others – that handle business logic, user management, component creation and editing.
- Context & Hooks: Add a node that represents “src/context” (e.g., AuthContext) and “src/hooks” (custom hooks for toast and mobile detection) to indicate how state and behavior are managed across the app.

B. API & Integration Layer:
- Supabase Integration: The “src/integrations/supabase” directory contains the Supabase client integration code and types, which indicate direct external communication. Also note the “supabase” directory (with config and functions like “analyze-json”) that represents custom serverless functions in the Supabase ecosystem.
- Migration Scripts: The “src/scripts/migrateComponentsToSupabase.ts” file is a utility tool for data migration; include this as an auxiliary process that might be triggered separately from normal app runtime.

C. Build, Deployment & Configuration:
- There are configuration files (e.g., package.json, tsconfig.*, vite.config.ts, and tailwind.config.ts) that define the build and tooling settings.
- The README explains multiple ways to edit and deploy the code (direct editing in Lovable, GitHub Codespaces, local development with npm, etc.), which supports the idea that deployment is streamlined and integrated with the hosting backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User (Browser)"]:::external

    subgraph "Frontend Application"
        F1["Pages (UI Components - Pages)"]:::frontend
        F2["UI Components (Reusable)"]:::frontend
        F3["UI Layout (Layout Components)"]:::frontend
        F4["Domain Admin"]:::frontend
        F5["Domain Forms"]:::frontend
        F6["Domain Filters"]:::frontend
        F7["State Management (Contexts)"]:::frontend
        F8["Custom Hooks"]:::frontend
    end

    subgraph "API & Integration Layer"
        A1["API Utilities"]:::api
        A2["Supabase Client Integration"]:::api
    end

    subgraph "Supabase Backend"
        B1["Serverless Function: analyze-json"]:::backend
        B2["Database & Auth Services"]:::backend
    end

    M["Migration Script"]:::aux

    %% Connections
    U -->|"initiates"| F1
    F1 -->|"sends API call"| A1
    A1 -->|"integrates"| A2
    A2 -->|"triggers"| B1
    A2 -->|"accesses"| B2
    M -->|"migrates data"| A1
    M -->|"updates"| B2

    %% Internal Frontend connections (aggregation of components)
    F1 --- F2
    F1 --- F3
    F1 --- F4
    F1 --- F5
    F1 --- F6
    F1 --- F7
    F1 --- F8

    %% Click Events
    click F1 "https://github.com/bloqxstudio/json-documentor/tree/main/src/pages"
    click F2 "https://github.com/bloqxstudio/json-documentor/tree/main/src/components/ui"
    click F3 "https://github.com/bloqxstudio/json-documentor/tree/main/src/components/layout"
    click F4 "https://github.com/bloqxstudio/json-documentor/tree/main/src/components/admin"
    click F5 "https://github.com/bloqxstudio/json-documentor/tree/main/src/components/forms"
    click F6 "https://github.com/bloqxstudio/json-documentor/tree/main/src/components/filters"
    click F7 "https://github.com/bloqxstudio/json-documentor/tree/main/src/context"
    click F8 "https://github.com/bloqxstudio/json-documentor/tree/main/src/hooks"
    click A1 "https://github.com/bloqxstudio/json-documentor/tree/main/src/lib/api"
    click A2 "https://github.com/bloqxstudio/json-documentor/tree/main/src/integrations/supabase"
    click B1 "https://github.com/bloqxstudio/json-documentor/tree/main/supabase/functions/analyze-json"
    click M "https://github.com/bloqxstudio/json-documentor/blob/main/src/scripts/migrateComponentsToSupabase.ts"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef api fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef backend fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef aux fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
