# egarrisxn/swaybaeofficial architecture

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

- Interactive diagram: https://gitdiagram.com/egarrisxn/swaybaeofficial
- Repository: https://github.com/egarrisxn/swaybaeofficial

## Overview

##### Main Components
- Frontend – This consists of pages and UI components:
- The “app” directory follows Next.js conventions with pages (e.g., page.jsx, blog/*) and special files for error handling, layout, loading states, etc.
- The “components” directory holds reusable UI components (including a subfolder, “components/ui”, for common UI elements) that build individual sections of pages.
- Backend/API – The “app/api” directory shows API routes for endpoints (e.g., contact and spotify). These are server-side functionalities handling specific operations like contact form submissions and Spotify interactions.
- External Integrations – Besides Sanity, external APIs are integrated, e.g., via “utils/spotify.js” and the “app/api/spotify/route.js”. Mark these integrations under a distinct external services section.
- Configuration and Build Tools – Include build scripts/configurations such as “next.config.mjs”, “tailwind.config.mjs”, “eslint.config.mjs”, “postcss.config.mjs”, and package management files that guide the project build and deployment.

##### Interactions and Relationships
- User Interaction: Users access the frontend pages that are rendered via Next.js. The static and dynamic pages (blog, calendar, subathon, etc.) are composed using the components.
- API Communication: Certain components or pages may invoke server-side API routes (located under “app/api”) for specific operations such as handling contact requests or fetching Spotify data.
- Asset Delivery: The public folder assets are served directly to the client, so illustrate the static asset delivery mechanism.

##### Architectural Patterns and Design Principles
- Full-Stack Separation: Although Next.js integrates frontend and backend code in the same repository, show separation by clearly marking API endpoints versus client-side components.
- Modular Design: The project structure (separation into “app”, “components”, “lib”, “utils”) indicates a modular approach. Represent these as distinct modules that interconnect.
- Dynamic Routing and Folder-Based Conventions: Note that the “app/blog” directory includes nested, dynamic routing for posts and tags, an important pattern of Next.js.
- UI/UX Focus: With a dedicated “components/ui” folder and significant use of Tailwind CSS, it’s important to highlight the front-end presentation layer and reusable design elements.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User Browser"):::frontend

    subgraph "Frontend Layer"
        PL("Pages & Layouts"):::frontend
        UI("Reusable UI Components"):::frontend
        SA("Static Assets"):::static
    end

    subgraph "Backend/API Layer"
        CA("Contact API"):::backend
        SPA("Spotify API"):::backend
    end

    subgraph "Content Management"
        CMS("Sanity CMS"):::backend
    end

    subgraph "External Services"
        SS("Spotify Service"):::external
    end

    subgraph "Configuration & Build Tools"
        NC("next.config.mjs"):::static
        TC("tailwind.config.mjs"):::static
        PC("postcss.config.mjs"):::static
        EC("eslint.config.mjs"):::static
        PK("package.json"):::static
    end

    U -->|"requests"| PL
    PL -->|"composes"| UI
    PL -->|"loads"| SA
    PL -->|"fetchesContent"| CMS
    PL -->|"contactCall"| CA
    PL -->|"spotifyCall"| SPA
    SPA -->|"getsData"| SS
    NC -->|"builds"| PL
    TC -->|"builds"| PL
    PC -->|"builds"| PL
    EC -->|"builds"| PL
    PK -->|"managesDeps"| PL

    click PL "https://github.com/egarrisxn/swaybaeofficial/tree/main/app"
    click UI "https://github.com/egarrisxn/swaybaeofficial/tree/main/components"
    click CA "https://github.com/egarrisxn/swaybaeofficial/blob/main/app/api/contact/route.js"
    click SPA "https://github.com/egarrisxn/swaybaeofficial/blob/main/app/api/spotify/route.js"
    click CMS "https://github.com/egarrisxn/swaybaeofficial/tree/main/utils/sanity"
    click SS "https://github.com/egarrisxn/swaybaeofficial/blob/main/utils/spotify.js"
    click SA "https://github.com/egarrisxn/swaybaeofficial/tree/main/public"
    click NC "https://github.com/egarrisxn/swaybaeofficial/blob/main/next.config.mjs"
    click TC "https://github.com/egarrisxn/swaybaeofficial/blob/main/tailwind.config.mjs"
    click PC "https://github.com/egarrisxn/swaybaeofficial/blob/main/postcss.config.mjs"
    click EC "https://github.com/egarrisxn/swaybaeofficial/blob/main/eslint.config.mjs"
    click PK "https://github.com/egarrisxn/swaybaeofficial/blob/main/package.json"

    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef backend fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef external fill:#FFDAB9,stroke:#333,stroke-width:2px;
    classDef static fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
