# jethro-dev/personal-website architecture

> Architecture diagram of the GitHub repository jethro-dev/personal-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jethro-dev/personal-website
- Repository: https://github.com/jethro-dev/personal-website

## Overview

##### Main Components Identification
- Frontend – App Pages:
- The app directory contains two key groups:
▪ The “(site)” folder houses public pages such as blogs and the main landing pages.
▪ The “(studio)” folder represents the admin interface (or studio) for managing content.
- Backend / API Actions:
- The “action” folder (with send-email.ts) indicates server-side actions, likely serving as API endpoints or utility tasks.
- Reusable UI Components:
- The components folder is rich with UI elements (e.g., blog cards, navbars, portfolio grids) and even a nested ui subfolder for styled components.
- CMS / Data Management:
- The schemas folder (with various schema files) and the lib folder (with sanity and utility modules) suggest integration with Sanity CMS for content management.
- Styling & Configuration:
- Global styles (globals.css, tailwind.config.ts) and configuration files (next.config.js, postcss.config.js, tsconfig.json) outline the project’s build and styling infrastructure.
- Other:
- Providers (like the theme provider) and hooks for state and effects add additional layers of client-side dynamism.

##### Identifying Relationships and Interactions
- The public site pages under app/(site) consume UI components from the components folder to render the layout, blog posts, and other content.
- The studio pages under app/(studio) are likely used by administrators and content creators, pulling schema definitions (from the schemas folder) and interacting with Sanity through the lib/sanity*.ts modules.
- The action folder’s email sending script interacts with server-side logic, potentially integrating with third-party email services.
- Configuration files and providers (e.g., theme-provider) define app-wide behaviors that affect both the public and studio components.
- Hooks and utilities provide cross-cutting solutions (e.g., useConfettiGradient) and maintain consistency across component interactions.

##### Architectural Patterns & Design Principles
- Component-Based Architecture: The project makes heavy use of reusable UI components for consistency and modularity.
- Separation of Concerns: There’s a clear separation between public pages and admin pages along with segregated routing (via folder grouping).
- CMS Integration: The Sanity CMS schemas indicate a headless CMS implementation where content management is abstracted from actual rendering.
- Server/Client Boundary: Using Next.js, there is a clear distinction between server-side actions (e.g., action/send-email.ts) and client-side interactivity (React components, hooks, and providers).

##### Including Relevant Technologies
- Next.js for rendering and routing.
- Sanity CMS (through sanity.cli.ts, sanity.config.ts, and schemas) for content management.
- Tailwind CSS for styling (tailwind.config.ts and globals.css).
- TypeScript for type safety (evidenced by tsconfig.json, .tsx files).
- ESLint and PostCSS for code and styling enforcement.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure & Config Subgraph
    subgraph "Infrastructure & Config"
        g1["globals.css"]:::config
        g2["tailwind.config.ts"]:::config
        g3["next.config.js"]:::config
        g4["postcss.config.js"]:::config
        g5["tsconfig.json"]:::config
        prov["Theme Provider"]:::provider
        hook["useConfettiGradient"]:::hook
    end

    %% CMS Integration Subgraph
    subgraph "CMS Integration"
        cmsSchema["CMS Schemas"]:::cms
        cmsUtil["CMS Utilities"]:::cms
    end

    %% Reusable Components & API Subgraph
    subgraph "Reusable Components & API"
        comp["UI Components"]:::component
        api["Email API Action"]:::api
    end

    %% Application Layers Subgraph
    subgraph "Application Layers"
        site["Public Site Pages"]:::app
        studio["Admin Studio"]:::app
    end

    %% Infrastructure & Config to Application Layers
    prov -->|"provides theme"| site
    prov -->|"provides theme"| studio
    hook -->|"adds dynamic effects"| site
    hook -->|"adds dynamic effects"| studio
    g1 -->|"global styles"| site
    g2 -->|"global styles"| site
    g3 -->|"global settings"| site
    g4 -->|"global settings"| site
    g5 -->|"global settings"| site
    g1 -->|"global styles"| studio
    g2 -->|"global styles"| studio
    g3 -->|"global settings"| studio
    g4 -->|"global settings"| studio
    g5 -->|"global settings"| studio

    %% CMS Integration to Application Layers
    cmsSchema -->|"defines content"| site
    cmsUtil -->|"feeds content"| site
    cmsSchema -->|"defines content"| studio
    cmsUtil -->|"feeds content"| studio

    %% Application Layers to Reusable Components & API
    site -->|"renders using"| comp
    studio -->|"renders using"| comp
    site -->|"triggers"| api

    %% Class Styles
    classDef config fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef provider fill:#e1bee7,stroke:#6a1b9a,stroke-width:2px;
    classDef hook fill:#ffe082,stroke:#ff6f00,stroke-width:2px;
    classDef cms fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef component fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
    classDef api fill:#ffccbc,stroke:#d84315,stroke-width:2px;
    classDef app fill:#cfd8dc,stroke:#37474f,stroke-width:2px;

    %% Click Events
    click site "https://github.com/jethro-dev/personal-website/tree/main/app/(site)"
    click studio "https://github.com/jethro-dev/personal-website/tree/main/app/(studio)"
    click api "https://github.com/jethro-dev/personal-website/blob/main/action/send-email.ts"
    click comp "https://github.com/jethro-dev/personal-website/tree/main/components"
    click cmsSchema "https://github.com/jethro-dev/personal-website/tree/main/schemas"
    click cmsUtil "https://github.com/jethro-dev/personal-website/blob/main/lib/sanity.ts"
    click g1 "https://github.com/jethro-dev/personal-website/blob/main/app/globals.css"
    click g2 "https://github.com/jethro-dev/personal-website/blob/main/tailwind.config.ts"
    click g3 "https://github.com/jethro-dev/personal-website/blob/main/next.config.js"
    click g4 "https://github.com/jethro-dev/personal-website/blob/main/postcss.config.js"
    click g5 "https://github.com/jethro-dev/personal-website/blob/main/tsconfig.json"
    click prov "https://github.com/jethro-dev/personal-website/blob/main/providers/theme-provider.tsx"
    click hook "https://github.com/jethro-dev/personal-website/blob/main/hooks/useConfettiGradient.tsx"
```
