# hochu-shunsuke/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/hochu-shunsuke/portfolio
- Repository: https://github.com/hochu-shunsuke/portfolio

## Overview

##### Main Components
- App Layer (Next.js Application):
– Located in the “app” directory.
– Contains layout.tsx, page.tsx, providers.tsx and globals.css which together set up the overall page structure, layout, and context providers.
- Components Library:
– Numerous portfolio-specific components (e.g., hero-section, profile-card, project-card, and various sections) found under the “components” directory.
– UI-specific reusable components are further organized in the “components/ui” subdirectory containing controls (buttons, alerts, dialog, etc.).
- Hooks and Utilities:
– Custom hooks in the “hooks” directory (e.g., for mobile responsiveness and toast notifications).
– Shared utility functions in “lib” (such as utils.ts) to assist various parts of the application.
- Styling and Configuration:
– Global styles are found in “styles” and “app/globals.css”.
– Tailwind configuration files (tailwind.config.ts) and PostCSS config (postcss.config.mjs) control styling behavior.
- Public Assets:
- Project Infrastructure and Configuration Files:
– Next.js configuration (next.config.mjs and tsconfig.json) and package management files (package.json, pnpm-lock.yaml, package-lock.json) define build and deployment settings.

##### Relationships and Interactions
- The App Layer is at the core of the project:
– Next.js’s app/page.tsx acts as the entry point and layout.tsx provides the general page structure and wraps pages in providers (from providers.tsx).
– This layer connects directly with both the Components Library and external assets (styles, images).
- Components Library:
– The portfolio-specific section components (hero-section, about/profile sections, projects, etc.) are integrated into the main pages from the App Layer.
– These components, depending on the page, may also leverage components from the UI sublibrary for common interface elements (like buttons, dialogs, etc.).
– Each component is modular and can depend on specific hooks (e.g., mouse-follower, use-toast, use-mobile) for enhanced interactivity.
- Hooks and Lib:
– Custom hooks interact with various components to provide behavioral aspects (e.g., responsiveness or notifications), while the lib directory contains helper functions used across multiple components.
- Configuration and Styling:
– The Tailwind configuration influences the styling of the entire application which is reflected in both app-level CSS files and individual component styles.
- Public Assets:
– These are served by Next.js as static resources and are referenced in components/images, styling files, or configuration.

##### Architectural Patterns and Design Principles
- Component-Based Architecture:
– The project emphasizes a modular approach where UI elements, portfolio sections, and layout wrappers are all encapsulated as components.
- Separation of Concerns:
– The “app” folder handles routing and layout, the “components” folder provides discrete UI/portfolio elements, “hooks” concentrate on logic and state management, and “lib” focuses on utility functions.
- Reusability and Extensibility:
– The dedicated UI components and the clear separation between custom portfolio sections and generic UI parts allow for easy reuse and future expansion.
- Integration with Next.js Specific Patterns:
– By using the new “app” directory and layout patterns provided by Next.js, the project takes advantage of built-in page routing, dynamic loading, and server-side rendering where needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Infrastructure & Config Files"
        INF1["next.config.mjs"]:::config
        INF2["tsconfig.json"]:::config
        INF3["package.json"]:::config
        INF4["pnpm-lock.yaml"]:::config
        INF5["package-lock.json"]:::config
        INF6[".gitignore"]:::config
        INF7["README.md"]:::config
    end

    subgraph "Global Styles & Config"
        STYLES1["styles/globals.css"]:::config
        STYLES2["tailwind.config.ts"]:::config
        STYLES3["postcss.config.mjs"]:::config
    end

    subgraph "App Layer (Routing & Layout)"
        A1["app"]:::app
        A2["layout.tsx"]:::app
        A4["providers.tsx"]:::app
        A3["page.tsx"]:::app
        A5["globals.css (app)"]:::app
    end

    subgraph "Portfolio Components"
        P1["hero-section.tsx"]:::component
        P2["profile-card.tsx"]:::component
        P3["project-card.tsx"]:::component
        P4["contact-section.tsx"]:::component
        P5["footer.tsx"]:::component
        P6["skills-section.tsx"]:::component
    end

    subgraph "UI Library Components"
        U1["button.tsx"]:::component
        U2["dialog.tsx"]:::component
        U3["toast.tsx"]:::component
    end

    subgraph "Custom Hooks"
        H1["use-mobile.tsx"]:::utility
        H2["use-toast.ts"]:::utility
    end

    subgraph "Utilities (Lib)"
        L1["utils.ts"]:::utility
    end

    subgraph "Public Assets"
        PA1["public"]:::assets
        PA2["public/icons"]:::assets
        PA3["public/images"]:::assets
    end

    %% Connections
    INF1 --> STYLES1
    STYLES1 --> A5

    A1 --> A2
    A2 --> A4
    A4 --> A3

    A3 -->|"integrates"| P1
    A3 -->|"integrates"| U1
    A3 -->|"serves"| PA1

    STYLES2 -->|"styles"| P1
    STYLES3 -->|"styles"| U1

    P1 -->|"uses"| H1
    P1 -->|"calls"| L1
    U1 -->|"triggers"| H2

    %% Class Definitions
    classDef app fill:#a2d9ce,stroke:#333,stroke-width:2px;
    classDef component fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef utility fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef config fill:#f5cba7,stroke:#333,stroke-width:2px;
    classDef assets fill:#aed6f1,stroke:#333,stroke-width:2px;

    %% Click Events for Infrastructure & Config Files
    click INF1 "https://github.com/hochu-shunsuke/portfolio/blob/main/next.config.mjs"
    click INF2 "https://github.com/hochu-shunsuke/portfolio/blob/main/tsconfig.json"
    click INF3 "https://github.com/hochu-shunsuke/portfolio/blob/main/package.json"
    click INF4 "https://github.com/hochu-shunsuke/portfolio/blob/main/pnpm-lock.yaml"
    click INF5 "https://github.com/hochu-shunsuke/portfolio/blob/main/package-lock.json"
    click INF6 "https://github.com/hochu-shunsuke/portfolio/blob/main/.gitignore"
    click INF7 "https://github.com/hochu-shunsuke/portfolio/blob/main/README.md"

    %% Click Events for Global Styles & Config
    click STYLES1 "https://github.com/hochu-shunsuke/portfolio/blob/main/styles/globals.css"
    click STYLES2 "https://github.com/hochu-shunsuke/portfolio/blob/main/tailwind.config.ts"
    click STYLES3 "https://github.com/hochu-shunsuke/portfolio/blob/main/postcss.config.mjs"

    %% Click Events for App Layer (Next.js Application)
    click A1 "https://github.com/hochu-shunsuke/portfolio/tree/main/app"
    click A2 "https://github.com/hochu-shunsuke/portfolio/blob/main/app/layout.tsx"
    click A3 "https://github.com/hochu-shunsuke/portfolio/blob/main/app/page.tsx"
    click A4 "https://github.com/hochu-shunsuke/portfolio/blob/main/app/providers.tsx"
    click A5 "https://github.com/hochu-shunsuke/portfolio/blob/main/app/globals.css"

    %% Click Events for Portfolio Components
    click P1 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/hero-section.tsx"
    click P2 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/profile-card.tsx"
    click P3 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/project-card.tsx"
    click P4 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/contact-section.tsx"
    click P5 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/footer.tsx"
    click P6 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/skills-section.tsx"

    %% Click Events for UI Library Components
    click U1 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/ui/button.tsx"
    click U2 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/ui/dialog.tsx"
    click U3 "https://github.com/hochu-shunsuke/portfolio/blob/main/components/ui/toast.tsx"

    %% Click Events for Custom Hooks
    click H1 "https://github.com/hochu-shunsuke/portfolio/blob/main/hooks/use-mobile.tsx"
    click H2 "https://github.com/hochu-shunsuke/portfolio/blob/main/hooks/use-toast.ts"

    %% Click Event for Utilities (Lib)
    click L1 "https://github.com/hochu-shunsuke/portfolio/blob/main/lib/utils.ts"

    %% Click Events for Public Assets
    click PA1 "https://github.com/hochu-shunsuke/portfolio/tree/main/public"
    click PA2 "https://github.com/hochu-shunsuke/portfolio/tree/main/public/icons"
    click PA3 "https://github.com/hochu-shunsuke/portfolio/tree/main/public/images"
```
