# martin226/v2 architecture

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

- Interactive diagram: https://gitdiagram.com/martin226/v2
- Repository: https://github.com/martin226/v2

## Overview

##### Project Type and Purpose
- This is a personal website featuring multiple sections (home, projects, writing) and custom content components.
- It makes use of Next.js for server-side rendering and routing and Tailwind CSS for styling.
- The project also contains MDX pages (e.g., for writing) and a variety of UI components (header, footer, navigation, etc.).

##### File Structure
- Top-Level Files: Configuration files for ESLint, Prettier, Tailwind, Next.js (next.config.mjs), and npm package files set up the project environment.
- The docs directory holds assets like the logo.
- The public directory stores static resources such as the resume PDF.
- The “assets” subdirectory for project-specific media.
- “components” which include presentational and interactive elements (e.g., Header, Footer, ProjectCard).
- “hooks” where reusable React hooks reside.
- “layouts” and a top-level layout.js which structure how pages render.
- Multiple page routes including home (page.js), “projects” and “writing” sections, plus MDX content under writing.

a. Main Components:
- Next.js Application: Representing the core framework handling server-side rendering and routing.
- Pages: Separate blocks for Home, Projects, and Writing; include the MDX pages as part of content rendering.
- Layouts: Global layout components that wrap the pages (e.g., MdxLayout, layout.js).
- UI Components: Blocks for reusable components such as Header, Footer, HorizontalNav, CommandPalette, etc.
- Hooks and Utilities: Encapsulate business logic and state management (e.g., custom hooks for detecting mobile devices or modifier keys).
- Static Assets and Configurations: Public files (like resume.pdf) and configuration setups (Tailwind CSS, ESLint).

b. Relationships and Interactions:
- How the Next.js routing system directs user requests to appropriate pages.
- How each page is wrapped by layout components that include navigational elements like Header, Footer, and HorizontalNav.
- That UI components (e.g., project cards, themed tweets) are nested within pages.
- Flow of static asset delivery from the public directory.
- That hooks are integrated into UI components to manage interactions.

c. Architectural Patterns & Design Principles:
- Separation of Concerns: The file structure clearly separates UI components, layouts, and assets.
- Component Reusability: Each UI element is modularized, and hooks encapsulate specific functionalities.
- Content-driven pages: The use of MDX for writing content denotes a strong emphasis on dynamic, markdown-based page generation.
- Modern Next.js Patterns: Leverage the App Router and file-based routing philosophy.

d. Relevant Technologies and Frameworks:
- Next.js for server/client rendering and routing.
- Tailwind CSS for styling.
- MDX integration for markdown-based content.
- Standard development tools like ESLint, Prettier, and PostCSS.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Next.js Application (Personal Website)"]:::app
    A --> AR["App Router"]:::router

    subgraph "Routing Layer"
        AR --> B["Home Page (src/app/page.js)"]:::page
        AR --> C["Projects Page (src/app/projects/page.js)"]:::page
        AR --> D["Writing Page (src/app/writing/page.js)"]:::page
        D --> D1["MDX: reflecting-on-2024 (src/app/writing/reflecting-on-2024/page.mdx)"]:::page
        D --> D2["MDX: shipping-presentation-generation-3-days (src/app/writing/shipping-presentation-generation-3-days/page.mdx)"]:::page
    end

    subgraph "Presentation Layer"
        L["Global Layout Components"]:::layout
        L --> L1["Main Layout (src/app/layout.js)"]:::layout
        L --> L2["MDX Layout (src/app/layouts/MdxLayout.js)"]:::layout
        L1 --> FC["UI Components"]:::ui
        L2 --> FC
        FC --> FC1["Header (src/app/components/Header.js)"]:::ui
        FC --> FC2["Footer (src/app/components/Footer.js)"]:::ui
        FC --> FC3["Horizontal Navigation (src/app/components/HorizontalNav.js)"]:::ui
        FC --> FC4["Command Palette (src/app/components/CommandPalette.js)"]:::ui
        FC --> FC5["Project Card (src/app/components/ProjectCard.js)"]:::ui
        FC --> FC6["Other UI Components (CurvedArrow,Link,Signature,ThemeProvider,ThemedTweet)"]:::ui
    end

    subgraph "Supportive Modules"
        H["Static Assets & Media"]:::assets
        H --> H1["Resume (public/resume.pdf)"]:::assets
        H --> H2["Project Assets (src/app/assets)"]:::assets

        CH["Custom Hooks"]:::hooks
        CH --> CH1["useMobileDevice (src/app/hooks/useMobileDevice.js)"]:::hooks
        CH --> CH2["useModifierKey (src/app/hooks/useModifierKey.js)"]:::hooks
        CH --> FC
    end

    %% Connections showing layout wrapping and asset delivery
    B -->|"wrapped_by"| L
    C -->|"wrapped_by"| L
    D -->|"wrapped_by"| L
    H --> L

    %% Styles
    classDef app fill:#f9e79f,stroke:#b9770e,stroke-width:2px;
    classDef router fill:#aed6f1,stroke:#2e86c1,stroke-width:2px;
    classDef page fill:#fad7a0,stroke:#e67e22,stroke-width:2px;
    classDef layout fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef ui fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef hooks fill:#d6eaf8,stroke:#3498db,stroke-width:2px;
    classDef assets fill:#ebdef0,stroke:#af7ac5,stroke-width:2px;

    %% Click Events
    click A "https://github.com/martin226/v2/tree/main/src/app"
    click B "https://github.com/martin226/v2/blob/main/src/app/page.js"
    click C "https://github.com/martin226/v2/blob/main/src/app/projects/page.js"
    click D "https://github.com/martin226/v2/blob/main/src/app/writing/page.js"
    click D1 "https://github.com/martin226/v2/blob/main/src/app/writing/reflecting-on-2024/page.mdx"
    click D2 "https://github.com/martin226/v2/blob/main/src/app/writing/shipping-presentation-generation-3-days/page.mdx"
    click L1 "https://github.com/martin226/v2/blob/main/src/app/layout.js"
    click L2 "https://github.com/martin226/v2/blob/main/src/app/layouts/MdxLayout.js"
    click FC1 "https://github.com/martin226/v2/blob/main/src/app/components/Header.js"
    click FC2 "https://github.com/martin226/v2/blob/main/src/app/components/Footer.js"
    click FC3 "https://github.com/martin226/v2/blob/main/src/app/components/HorizontalNav.js"
    click FC4 "https://github.com/martin226/v2/blob/main/src/app/components/CommandPalette.js"
    click FC5 "https://github.com/martin226/v2/blob/main/src/app/components/ProjectCard.js"
    click FC6 "https://github.com/martin226/v2/tree/main/src/app/components"
    click CH1 "https://github.com/martin226/v2/blob/main/src/app/hooks/useMobileDevice.js"
    click CH2 "https://github.com/martin226/v2/blob/main/src/app/hooks/useModifierKey.js"
    click H1 "https://github.com/martin226/v2/blob/main/public/resume.pdf"
    click H2 "https://github.com/martin226/v2/tree/main/src/app/assets"
```
