# patriciosebastian/personal-website architecture

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

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

## Overview

##### Main Components
- Frontend (Client-Side UI and Pages):
- The Next.js “app” directory holds the routing for various pages (home page, blog, admin, freelance, analytics, secret-login). For example, you have routes like /blog/[slug] for dynamic blog posts and /admin/create-post for content creation.
- UI Components:
- Located in the “src/components” and “src/components/ui” directories, these include reusable pieces (buttons, dropdowns, theme toggle, mobile navigation, etc.) that compose the user interface.
- Rich Text Editor Module:
- The presence of TinyMCE components (in both “src/components/tinyMCE.jsx” and “src/utils/tinyMCE/” files) indicates integrated rich text editing functionality for blog posts or admin content creation.
- Backend Integration:
- Supabase is integrated as noted in “src/lib/supabaseClient.js” and files under “src/utils/supabase/”. This shows where the system handles connections to databases and possibly authentication or other backend processes.
- Styles & Configuration:
- Tailwind CSS and PostCSS (configured via tailwind.config.js and postcss.config.mjs) chart the styling approach, while configurations like jsconfig.json and next.config.mjs determine build and runtime behavior.
- Middleware and Routing:
- Files like “middleware.js” in the root and within supabase-specific middleware under “src/utils/supabase/middleware.js” indicate request handling/authorization at the routing level.

##### Relationships and Interactions
- Client–Server Communication:
- Next.js pages under “src/app” or its dynamic routes interact with backend endpoints (such as the “analytics/route.js”) or server-side functions (for authentication routes) to fetch or submit data.
- Reusable Components and UI Integration:
- UI components render the dynamic content fetched/edited through the rich text editor and display superseded data from Supabase.
- External Service Integration:
- Supabase is the primary external service for database and possibly authentication, with clear separation via lib and utils.
- The Admin and Blog modules:
- The admin pages create or manage content (using the TinyMCE editor and Supabase integration) which is then rendered in the blog pages.

##### Architectural Patterns & Design Principles
- Modular & Component-Based Architecture:
- The separation of UI-specific components, utilities, and page views follows the component-based design typical in Next.js and modern React applications.
- MVC or Similar Pattern:
- While not strictly MVC, the project structure splits “views” (pages under app), “controllers” (middleware and route handling), and “model” (Supabase interactions and util functions) to assist with maintainability.
- Server-Side Rendering (SSR) and Static Generation:
- Next.js routing indicates a mix of SSR and possibly static optimizations, beneficial for a personal website.

##### Relevant Technologies, Frameworks, and Libraries
- Next.js – for routing, server-side rendering, and overall application framework.
- React – powering the component-based UI.
- Supabase – for backend services and database access.
- TinyMCE – as the rich text editor for content creation.
- Tailwind CSS & PostCSS – for styling.
- ESLint – for code quality, as indicated by the .eslintrc.json file.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (Next.js App)"
        FE_PAGES("Pages Directory"):::frontend
        FE_BLOG("Blog Routes"):::frontend
        FE_ADMIN("Admin Pages"):::frontend
        FE_OTHER("Analytics/Freelance/Secret Login"):::frontend
        FE_UI_GEN("Generic UI Components"):::ui
        FE_UI_SPEC("Specialized UI Components"):::ui
    end

    subgraph "Rich Text Editor"
        RT_TINYMCE("TinyMCE Component"):::rich
        RT_UTIL("TinyMCE Utilities"):::rich
    end

    subgraph "Backend Integration (Supabase)"
        BE_CLIENT("Supabase Client"):::backend
        BE_UTIL("Supabase Utilities"):::backend
    end

    subgraph "Middleware & Routing"
        MW_MAIN("Main Middleware"):::middleware
        MW_SUPA("Supabase-specific Middleware"):::middleware
    end

    subgraph "Styles & Configuration"
        STYLE_GLOBAL("Global Styling"):::styling
        STYLE_TAILWIND("Tailwind/PostCSS Config"):::styling
        STYLE_CONFIG("Project Config Files"):::styling
    end

    %% Relationships
    FE_PAGES -->|"fetchData"| BE_CLIENT
    FE_PAGES -->|"routeThrough"| MW_MAIN
    FE_ADMIN -->|"createContent"| RT_TINYMCE
    RT_TINYMCE -->|"uses"| RT_UTIL
    BE_CLIENT -->|"calls"| BE_UTIL
    BE_CLIENT -->|"securedBy"| MW_SUPA

    %% UI Components contribute to Pages rendering
    FE_UI_GEN --- FE_PAGES
    FE_UI_SPEC --- FE_PAGES

    %% Styling connections
    FE_PAGES -->|"styledBy"| STYLE_GLOBAL
    FE_UI_GEN -->|"styledBy"| STYLE_GLOBAL
    FE_UI_SPEC -->|"styledBy"| STYLE_GLOBAL

    %% Additional connections for overall architecture
    FE_OTHER -->|"rendersContent"| FE_PAGES

    %% Class Definitions for Colours
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef ui fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef rich fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef middleware fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef styling fill:#D3D3D3,stroke:#000,stroke-width:2px;

    %% Click Events
    click FE_PAGES "https://github.com/patriciosebastian/personal-website/tree/main/src/app"
    click FE_BLOG "https://github.com/patriciosebastian/personal-website/tree/main/src/app/blog"
    click FE_ADMIN "https://github.com/patriciosebastian/personal-website/tree/main/src/app/admin"
    click FE_UI_GEN "https://github.com/patriciosebastian/personal-website/tree/main/src/components"
    click FE_UI_SPEC "https://github.com/patriciosebastian/personal-website/tree/main/src/components/ui"
    click RT_TINYMCE "https://github.com/patriciosebastian/personal-website/blob/main/src/components/tinyMCE.jsx"
    click RT_UTIL "https://github.com/patriciosebastian/personal-website/tree/main/src/utils/tinyMCE"
    click BE_CLIENT "https://github.com/patriciosebastian/personal-website/blob/main/src/lib/supabaseClient.js"
    click BE_UTIL "https://github.com/patriciosebastian/personal-website/tree/main/src/utils/supabase"
    click MW_MAIN "https://github.com/patriciosebastian/personal-website/blob/main/middleware.js"
    click MW_SUPA "https://github.com/patriciosebastian/personal-website/blob/main/src/utils/supabase/middleware.js"
    click STYLE_GLOBAL "https://github.com/patriciosebastian/personal-website/tree/main/src/styles"
    click STYLE_TAILWIND "https://github.com/patriciosebastian/personal-website/blob/main/tailwind.config.js"
    click STYLE_CONFIG "https://github.com/patriciosebastian/personal-website/blob/main/jsconfig.json"
```
