# fabpessoa/fab-pessoa-studio-website architecture

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

- Interactive diagram: https://gitdiagram.com/fabpessoa/fab-pessoa-studio-website
- Repository: https://github.com/fabpessoa/fab-pessoa-studio-website

## Overview

##### Project Type and Purpose
- The project is a web application where static HTML pages, design system pages, and assets (including 3D model assets in .glb format) provide the user interface.
- It also includes backend components such as server.js, various scripts (e.g., setup-db.js, main.js), and database migration files, suggesting dynamic content handling and possible database interactions.
- There is a “supabase” folder together with migration scripts and a Supabase library file (lib/supabase.js), indicating that the project uses Supabase as a backend-as-a-service or database system.

##### File Structure Analysis
- Frontend:
- HTML files: index.html, design-system.html, test-background.html, fabpessoawebsite.html.
- Assets directory: Contains models and other design assets (3D models in both PBR and Shaded formats).
- “Design System” folder: Includes its own index.html, which may be used for demonstrating design components or UI guidelines.
- Backend:
- server.js at the root suggests an entry point for a Node.js-based server.
- Scripts folder: Contains main.js (potential client or server logic) and setup-db.js (for establishing the database).
- Migrations folder: Holds SQL migration scripts (e.g., 01_initial_schema.sql) that are likely used to set up or modify the database schema.
- lib/supabase.js: Likely contains code to connect to Supabase, suggesting database or account management.
- Configuration and Deployment:
- Files like package.json, .env.local, vercel.json, and the workspace file imply that the project is managed via Node/npm, with environment configurations and deployment settings.
- The Supabase config (in the supabase directory) and init.sql indicate a database setup routine.

a. Main Components:
- Client/Frontend: Web pages (HTML), design system pages, and static assets (images, 3D models, etc.).
- Web Server/Backend: The Node.js server (server.js) managing HTTP requests, combined with scripts (main.js, setup-db.js) that run application logic.
- Database: Managed via Supabase, with initialization and migration managed through migrations and configuration in the supabase folder.
- External Services: Vercel (from vercel.json) may be used for deployment, and Supabase is an external service that provides the database/API layer.

b. Relationships and Interactions:
- The Client (web browser) makes HTTP requests to the Node.js server.
- The server handles these requests by rendering HTML pages and/or serving static assets.
- The server also interacts with the Supabase database using the library in lib/supabase.js, executing SQL migrations from the migrations folder as needed.
- There could be one or more API endpoints (defined implicitly in server.js and scripts) that handle data fetching or submission.

c. Architectural Patterns:
- Separation of concerns: The project clearly divides the frontend (static HTML and assets) from the backend/server logic (server.js and related scripts).
- Database migration/versioning: The migrations folder and setup scripts indicate that the project uses version-controlled schema updates.
- Use of external backend services: Integration with Supabase as a managed database solution.

d. Relevant Technologies and Frameworks:
- Node.js as the runtime environment (server.js, package.json).
- Supabase for database management and possibly real-time features.
- Likely usage of front-end technologies (HTML, JavaScript) to handle client-side interactivity; assets include advanced 3D models which might be rendered with a WebGL-based library.

##### Elements
- Clear labels for each major component:
- Web Browser / Client (with specific pages noted like index.html, design-system.html).
- Node.js Web Server (server.js, scripts for business logic).
- Database / Data Service (Supabase, including the migration process).
- External Deployment (Vercel, as indicated by vercel.json).
- From Client to Web Server, showing HTTP request/response flow.
- From Web Server to Database, showing data queries and updates.
- Possibly between the server and assets (to show static asset serving).
- Visual distinctions:

## Diagram (Mermaid)

```mermaid
graph TD
    Client["Client (Web Browser)"]:::client

    subgraph "Frontend Layer"
        FE1["index.html"]:::frontend
        FE2["design-system.html"]:::frontend
        FE3["test-background.html"]:::frontend
        FE4["fabpessoawebsite.html"]:::frontend
        FE5["Design System"]:::frontend
        FE6["Assets (3D Models)"]:::frontend
    end

    subgraph "Backend Layer"
        BE1["server.js"]:::backend
        subgraph "Backend Scripts"
            BE2["main.js"]:::backend
            BE3["setup-db.js"]:::backend
        end
    end

    subgraph "Database Layer"
        DB1["Supabase Database"]:::database
        subgraph "Migrations & Config"
            DB2["01_initial_schema.sql"]:::database
            DB3["init.sql"]:::database
            DB4["Supabase Config"]:::database
            DB5["supabase.js Library"]:::database
        end
    end

    E1["Vercel Deployment"]:::external

    Client -->|"HTTP_Request"| BE1
    BE1 -->|"Serves_HTML"| FE1
    BE1 -->|"Serves_HTML"| FE2
    BE1 -->|"Serves_HTML"| FE3
    BE1 -->|"Serves_HTML"| FE4
    BE1 -->|"Serves_Design"| FE5
    BE1 -->|"Serves_Assets"| FE6

    BE1 -->|"Executes"| BE2
    BE1 -->|"Initializes_DB"| BE3
    BE3 -->|"Applies_Migration"| DB2
    BE3 -->|"Initializes"| DB3
    BE1 -->|"Uses_Supabase"| DB5
    DB5 -->|"DB_Queries"| DB1
    DB4 -->|"Configures"| DB1

    E1 -->|"Hosts_Server"| BE1

    click FE1 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/index.html"
    click FE2 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/design-system.html"
    click FE3 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/test-background.html"
    click FE4 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/fabpessoawebsite.html"
    click FE5 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/Design System/index.html"
    click FE6 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/assets/models/..."
    click BE1 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/server.js"
    click BE2 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/scripts/main.js"
    click BE3 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/scripts/setup-db.js"
    click DB2 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/migrations/01_initial_schema.sql"
    click DB3 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/init.sql"
    click DB4 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/supabase/config.toml"
    click DB5 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/lib/supabase.js"
    click E1 "https://github.com/fabpessoa/fab-pessoa-studio-website/blob/main/vercel.json"

    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef database fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef client fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
