# imartindav/nextportfolio architecture

> Architecture diagram of the GitHub repository imartindav/nextportfolio, 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/imartindav/nextportfolio
- Repository: https://github.com/imartindav/nextportfolio

## Overview

##### Main Components
- Frontend Client: Represent the Next.js client running in user browsers. This includes pages built using the new Next.js App Router (the “app” directory with pages like home, about, resume, etc.) and rich UI components distributed under the “components” folder.
- Backend/API Layer: Although it’s all part of the Next.js framework, note the dedicated API routes in the “app/api” directory (e.g., routes for fetching GitHub stars, project posts, Umami stats/events). These endpoints encapsulate server-side logic and serve data to the UI.
- Component & UI Library: Highlight the extensive set of UI and animation components (in “components”, with subdivisions for About, Home, Projects, Resume, and “components/ui”) that provide the building blocks for the application’s pages.
- Utility & Data Layer: Include the “lib” directory that contains helper methods such as data fetchers, SEO metadata templates, and other utility functions used across the project.
- External Integrations/Services: Represent connections to third-party services like GitHub, Umami Analytics, PDF rendering tools, and the adjacent “projects.imartin.dev” instance used for detailed project showcases and blog content.

##### Out Relationships and Data Flow
- From the Next.js Server, branch into two main flows:
- The Page Routing Flow: Show how the “app” directory routes (layout.tsx, page.tsx, and sub-pages like about, resume, worldwide-reach) render components that call shared libraries (lib) and utilize UI components.
- Internal interactions, such as how the UI components call functions from the utilities (“lib”) and how SEO components in “components/SEO” help populate metadata dynamically.

##### Architectural Patterns and Technology Stack
- That the project leverages the Next.js App Router and React Server Components, so separate client-side interactive components from server-rendered content.
- That styles are handled with TailwindCSS and that UI accessibility is enhanced using Radix UI as well as interactive animations using Framer Motion and custom “magicui” components.
- Mention the integration of performance optimizations (Turbopack, optimized asset loading) and real-time analytics via Umami.
- Frontend (pages, UI components)
- Server/API layer (Next.js API routes)
- External integrations (GitHub, Umami, projects.imartin.dev)
- Shared libraries and utilities

##### Specific Elements
- Clear labels: Ensure every component (e.g., “Home Page (app/page.tsx)”, “About Section (components/About/*)”, “GitHub Stars API (app/api/fetch-github-stars/route.ts)”) is clearly marked.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level: Client
    Browser("Browser (Client)"):::client

    %% Next.js Server
    NextjsServer("Next.js Server"):::server

    Browser -->|"renders"| NextjsServer

    %% UI Rendering Branch: Next.js App Router
    subgraph "Next.js App Router"
        AppRouter("App Router (app directory)"):::server
        HomePage("Home Page (app/page.tsx)"):::pages
        AboutPage("About Page (app/about/page.tsx)"):::pages
        ResumePage("Resume Page (app/resume/page.tsx)"):::pages
        TechnologiesPage("Technologies Page (app/technologies/page.tsx)"):::pages
        WorldwidePage("Worldwide Reach Page (app/worldwide-reach/page.tsx)"):::pages
    end

    NextjsServer -->|"handles UI routing"| AppRouter
    AppRouter --> HomePage
    AppRouter --> AboutPage
    AppRouter --> ResumePage
    AppRouter --> TechnologiesPage
    AppRouter --> WorldwidePage

    %% UI Components Subgraph
    subgraph "UI Component Library"
        AboutComponents("About Components (components/About)"):::ui
        HomeComponents("Home Components (components/Home)"):::ui
        ProjectsComponents("Projects Components (components/Projects)"):::ui
        ResumeComponents("Resume Components (components/Resume)"):::ui
        SEOComponents("SEO Components (components/SEO)"):::ui
        UIKit("UI Library (components/ui)"):::ui
        MagicUI("Magic UI Components (components/magicui)"):::ui
    end

    HomePage -->|"renders"| HomeComponents
    AboutPage -->|"renders"| AboutComponents
    ResumePage -->|"renders"| ResumeComponents
    TechnologiesPage -->|"may use"| UIKit
    WorldwidePage -->|"may use"| MagicUI
    AppRouter -->|"includes"| SEOComponents
    ProjectsComponents -->|"populated by"| SEOComponents

    %% Utility & Data Layer Subgraph
    subgraph "Utility & Data Layer"
        DataUtil("Data Functions (lib/data.ts)"):::util
        FetchersUtil("Fetchers (lib/fetchers.ts)"):::util
        UtilsUtil("Utility Functions (lib/utils.ts)"):::util
        SEOMetadataUtil("SEO Metadata Templates (lib/seo/metadata-templates.ts)"):::util
    end

    %% Interaction from UI Components to Utilities
    UIKit -->|"calls"| FetchersUtil
    AboutComponents -->|"uses"| UtilsUtil
    SEOComponents -->|"populated by"| SEOMetadataUtil

    %% API/Service Branch: API Endpoints
    subgraph "API Endpoints"
        GitHubStarsAPI("GitHub Stars API (app/api/fetch-github-stars/route.ts)"):::api
        ProjectPostsAPI("Project Posts API (app/api/fetch-project-posts/route.ts)"):::api
        UmamiEventsAPI("Umami Events API (app/api/fetch-umami-events/route.ts)"):::api
        UmamiStatsAPI("Umami Stats API (app/api/fetch-umami-stats/route.ts)"):::api
    end

    NextjsServer -->|"exposes APIs"| GitHubStarsAPI
    NextjsServer --> ProjectPostsAPI
    NextjsServer --> UmamiEventsAPI
    NextjsServer --> UmamiStatsAPI

    %% External Integrations Subgraph
    subgraph "External Integrations"
        ExternalGitHub("GitHub"):::integr
        ExternalUmami("Umami Analytics"):::integr
        ExternalProjects("Projects & Blog Platform (projects.imartin.dev)"):::integr
    end

    GitHubStarsAPI -->|"fetches"| ExternalGitHub
    ProjectPostsAPI -->|"fetches"| ExternalProjects
    UmamiEventsAPI -->|"sends event data to"| ExternalUmami
    UmamiStatsAPI -->|"fetches"| ExternalUmami

    %% Deployment & Configuration Subgraph
    subgraph "Deployment & Configuration"
        NextConfig("Next Config (next.config.mjs)"):::config
        TailwindConfig("Tailwind Config (tailwind.config.ts)"):::config
        SiteConfig("Site Config (config/site.ts)"):::config
    end

    NextjsServer ---|"configured by"| NextConfig
    NextjsServer --- TailwindConfig
    NextjsServer --- SiteConfig

    %% Click Events for App Pages
    click HomePage "https://github.com/imartindav/nextportfolio/blob/main/app/page.tsx"
    click AboutPage "https://github.com/imartindav/nextportfolio/blob/main/app/about/page.tsx"
    click ResumePage "https://github.com/imartindav/nextportfolio/blob/main/app/resume/page.tsx"
    click TechnologiesPage "https://github.com/imartindav/nextportfolio/blob/main/app/technologies/page.tsx"
    click WorldwidePage "https://github.com/imartindav/nextportfolio/blob/main/app/worldwide-reach/page.tsx"

    %% Click Events for UI Components
    click AboutComponents "https://github.com/imartindav/nextportfolio/tree/main/components/About"
    click HomeComponents "https://github.com/imartindav/nextportfolio/tree/main/components/Home"
    click ProjectsComponents "https://github.com/imartindav/nextportfolio/tree/main/components/Projects"
    click ResumeComponents "https://github.com/imartindav/nextportfolio/tree/main/components/Resume"
    click SEOComponents "https://github.com/imartindav/nextportfolio/tree/main/components/SEO"
    click UIKit "https://github.com/imartindav/nextportfolio/tree/main/components/ui"
    click MagicUI "https://github.com/imartindav/nextportfolio/tree/main/components/magicui"

    %% Click Events for API Endpoints
    click GitHubStarsAPI "https://github.com/imartindav/nextportfolio/blob/main/app/api/fetch-github-stars/route.ts"
    click ProjectPostsAPI "https://github.com/imartindav/nextportfolio/blob/main/app/api/fetch-project-posts/route.ts"
    click UmamiEventsAPI "https://github.com/imartindav/nextportfolio/blob/main/app/api/fetch-umami-events/route.ts"
    click UmamiStatsAPI "https://github.com/imartindav/nextportfolio/blob/main/app/api/fetch-umami-stats/route.ts"

    %% Click Events for Utility & Data Layer
    click DataUtil "https://github.com/imartindav/nextportfolio/blob/main/lib/data.ts"
    click FetchersUtil "https://github.com/imartindav/nextportfolio/blob/main/lib/fetchers.ts"
    click UtilsUtil "https://github.com/imartindav/nextportfolio/blob/main/lib/utils.ts"
    click SEOMetadataUtil "https://github.com/imartindav/nextportfolio/blob/main/lib/seo/metadata-templates.ts"

    %% Click Events for Deployment & Configuration
    click NextConfig "https://github.com/imartindav/nextportfolio/blob/main/next.config.mjs"
    click TailwindConfig "https://github.com/imartindav/nextportfolio/blob/main/tailwind.config.ts"
    click SiteConfig "https://github.com/imartindav/nextportfolio/blob/main/config/site.ts"

    %% Styles
    classDef client fill:#ccf,stroke:#333,stroke-width:2px;
    classDef server fill:#fcf,stroke:#333,stroke-width:2px;
    classDef pages fill:#cff,stroke:#333,stroke-width:2px;
    classDef api fill:#fc9,stroke:#333,stroke-width:2px;
    classDef integr fill:#cfc,stroke:#333,stroke-width:2px;
    classDef ui fill:#ffc,stroke:#333,stroke-width:2px;
    classDef util fill:#aff,stroke:#333,stroke-width:2px;
    classDef config fill:#fdd,stroke:#333,stroke-width:2px;
```
