# fabe/site architecture

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

- Interactive diagram: https://gitdiagram.com/fabe/site
- Repository: https://github.com/fabe/site

## Overview

##### Project Type & Overall Purpose
- The README reveals that this “site” is the source code for a personal website.
- With Next.js as the chosen framework (indicated by pages, next.config.js, and related config files) and a directory full of UI components and API code, you’re dealing with a full-stack application that serves both dynamic pages/routes and API endpoints.
- The design is modular – featuring reusable React components and a built-in GraphQL API for data management.

##### Analyzing the File Structure
- Top-Level Directories and Files:
– The “pages” directory: Contains application routes such as _app.tsx, _document.tsx, and various page-specific files (e.g., posts, photos, playlists). This represents the UI routing layer of Next.js.
– The “components” directory: Organized into subdirectories (e.g., Home, Button, Dialog, Layouts, SEO). These are the reusable UI building blocks.
– The “graphql” directory: Contains client configuration, constants, helpers, queries, resolvers, schema and type definitions – highlighting the API layer that likely powers dynamic content fetching.
– The “lib” directory: Hosts utility functions (e.g., contentfulLoader.ts, generateFeeds.ts, etc.) that support various backend and data-fetching operations.
– Configuration files (e.g., next-sitemap.config.js, tailwind.config.js, etc.) indicate the usage of specific tools such as TailwindCSS for styling and relevant deployment integrations (Vercel).
- Architectural Patterns:
– A strong modular pattern is evident with clear separations between UI components and backend API logic.
– The use of GraphQL files (queries, type definitions, resolvers) suggests that the website uses a single API endpoint (or several within pages/api) to fetch or manipulate data, possibly from external sources like Contentful or Spotify.
– The file organization indicates adherence to the Next.js convention, ensuring server-side rendering (SSR) or static site generation (SSG) where needed.

- Main Components to Include:
– Frontend/UI Layer:
▪ Next.js Pages: Representing different routes such as home, posts, photos, playlists, login, etc.
▪ Components: The reusable UI elements like Button, Dialog, SEO, Home sections (Intro, Posts, Projects, etc.).
▪ Public Assets: Static files and media (PDFs, video files, etc.) in the “public” directory.
– API/Backend Layer:
▪ GraphQL API: Represent the GraphQL endpoint (pages/api/graphql.ts) and its connected components such as queries, resolvers, type definitions (from the “graphql” directory).
▪ Additional API Routes: Endpoints like /og.tsx and /verifyPassword.ts in pages/api.
– Utility & Integration Layer:
▪ Libraries & Helpers: Utility functions like those in the “lib” folder (contentfulLoader, generateFeeds, etc.) which might integrate external APIs/services (for example Contentful or Spotify).
▪ External Services: Although not explicitly detailed in the file tree, the presence of modules like “graphql/resolvers/spotify” hints at integration with external APIs.
– Configuration & Build Tools:
▪ Config files (next.config.js, tailwind.config.js, etc.), which support the project’s build, deployment, and styling.

- Relationships & Interactions:
– Show calls from GraphQL resolvers, which in turn interact with external services or CMS (e.g., Contentful) through utility functions.
– Indicate the build process where configuration files guide the bundling/deployment (e.g., via Vercel integration shown in the README and configuration files).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration & Build Tools
    subgraph "Configuration & Build Tools"
        I["next.config.js"]:::config
        J["tailwind.config.js"]:::config
        K["next-sitemap.config.js"]:::config
    end

    %% Frontend/UI Layer
    subgraph "Frontend/UI Layer"
        A["Next.js Pages"]:::frontend
        B["Reusable UI Components"]:::frontend
        C["Public Assets"]:::frontend
    end

    %% API/Backend Layer
    subgraph "API/Backend Layer"
        D["GraphQL API"]:::backend
        L["GraphQL Architecture"]:::backend
        E["API: og.tsx"]:::backend
        F["API: verifyPassword.ts"]:::backend
    end

    %% Utility & Integration Layer
    subgraph "Utility & Integration Layer"
        G["Utility Functions"]:::utility
        H["External Services"]:::external
    end

    %% Connections from Configuration to Frontend and API
    I -->|"configures"| A
    J -->|"configures"| A
    K -->|"configures"| A
    I -->|"configures"| D
    J -->|"configures"| D
    K -->|"configures"| D

    %% Frontend Interactions
    A -->|"composes"| B
    A -->|"renders"| C
    A -->|"calls"| D
    A -->|"calls"| E
    A -->|"calls"| F
    A -->|"fetches"| G

    %% API Interactions
    D -->|"includes"| L
    D -->|"uses"| G

    %% Utility Interactions
    G -->|"integrates"| H

    %% Class Definitions for Colors
    classDef frontend fill:#FFF8DC,stroke:#333,stroke-width:2px;
    classDef backend fill:#B0E0E6,stroke:#333,stroke-width:2px;
    classDef utility fill:#98FB98,stroke:#333,stroke-width:2px;
    classDef config fill:#FFC0CB,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px;
    
    %% Click Events
    click A "https://github.com/fabe/site/tree/main/pages/"
    click B "https://github.com/fabe/site/tree/main/components/"
    click C "https://github.com/fabe/site/tree/main/public/"
    click D "https://github.com/fabe/site/blob/main/pages/api/graphql.ts"
    click E "https://github.com/fabe/site/blob/main/pages/api/og.tsx"
    click F "https://github.com/fabe/site/blob/main/pages/api/verifyPassword.ts"
    click G "https://github.com/fabe/site/tree/main/lib/"
    click I "https://github.com/fabe/site/blob/main/next.config.js"
    click J "https://github.com/fabe/site/blob/main/tailwind.config.js"
    click K "https://github.com/fabe/site/blob/main/next-sitemap.config.js"
    click L "https://github.com/fabe/site/tree/main/graphql/"
```
