# toukoum/portfolio architecture

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

## Overview

##### Project Type and Purpose
- This is a full-stack web application built with Next.js.
- The project uses Next.js’s App Router to handle both UI and API routes. There are custom API endpoints (for “chat” functionality) along with a rich set of UI components.
- It appears to serve as an interactive application (perhaps a portfolio or chat/interactive demo site) with components for chat, contact info, projects, resumes, and other personalized features.

##### Analyzing the File Structure
- Top-Level Files: Configuration files including ESLint, Prettier, Next.js config, and package files indicate that standard code quality and build processes are in place.
- Public Directory: Contains static assets (video files, PDFs) that are served directly.
- src/app:
- Contains page and layout definitions (page.tsx, layout.tsx, globals.css), as well as the “api” folder for custom server-side endpoints.
- The “api/chat” folder shows endpoints and tools for chat-related functionality (e.g., prompt handling, and several helper “getX” tools).
- src/components:
- Contains numerous UI subcomponents (chat interfaces, UI elements like buttons, dialogs, avatars, etc.).
- There are clearly designated directories for different domains (chat, projects, magicui, etc.) which indicate separation of visual concerns.
- src/hooks and src/lib:
- Houses reusable hooks and utility functions which support the application logic.

##### Key Architectural Components
a. Frontend / User Interface:
- Pages and Layouts under “src/app” that construct the visual and navigational structure.
- A large set of React components (in “src/components”) for building the user interface such as chat views, project displays, and themed UI elements.
- Global CSS files and custom hooks that manage UI behavior.
b. API / Server-Side:
- API endpoints located in “src/app/api” (especially under “api/chat”) for handling data processing or business logic related to chat interactions.
- Helper tools (in “api/chat/tools”) that assist with retrieving various types of data (contact info, presentation details, projects, skills, etc.).
c. Public / Static Assets:
- The “public” directory serves as the repository for static files (media, PDFs) that are directly served to the client.
d. Configuration and Build Tools:
- Various config files (eslintrc, prettier, next.config.ts, postcss) indicate standard modern best practices for code style, linting, and build optimizations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    Client["Client Browser"]:::client

    %% Next.js Server Container
    subgraph "Next.js Server"
        %% UI Rendering Layer
        subgraph "UI Rendering Layer"
            Pages["UI Pages & Layouts"]:::frontend
            ChatUI["Chat UI Components"]:::frontend
            subgraph "Other UI Components"
                Contact["Contact Component"]:::frontend
                Resume["Resume Component"]:::frontend
                Projects["Projects Component"]:::frontend
                Skills["Skills Component"]:::frontend
                Sport["Sport Component"]:::frontend
                Presentation["Presentation Component"]:::frontend
            end
            UILibrary["UI Component Library"]:::frontend
        end
        %% API Layer
        subgraph "API Layer"
            ChatAPI["Chat API Endpoints"]:::api
            APIHelper["Chat API Helper Tools"]:::api
        end
    end

    %% Utility Layer
    subgraph "Utility Layer"
        Hooks["Custom Hooks"]:::utility
        Utils["Utility Functions"]:::utility
    end

    %% Public / Static Assets
    Public["Public / Static Assets"]:::public

    %% Connections
    Client -->|"HTTP_Request"| Pages
    Client -->|"API_Call"| ChatAPI
    Pages -->|"Fetch_Assets"| Public
    ChatAPI -->|"calls_tools"| APIHelper
    ChatAPI -->|"returns_data"| ChatUI
    ChatUI -->|"uses_hook"| Hooks
    Contact -->|"uses_hook"| Hooks
    Resume -->|"uses_hook"| Hooks
    Projects -->|"uses_hook"| Hooks
    Skills -->|"uses_hook"| Hooks
    Sport -->|"uses_hook"| Hooks
    Presentation -->|"uses_hook"| Hooks
    ChatUI -->|"renders_with"| UILibrary
    Contact -->|"renders_with"| UILibrary
    Resume -->|"renders_with"| UILibrary
    Projects -->|"renders_with"| UILibrary
    Skills -->|"renders_with"| UILibrary
    Sport -->|"renders_with"| UILibrary
    Presentation -->|"renders_with"| UILibrary

    %% Click Events
    click Pages "https://github.com/toukoum/portfolio/tree/main/src/app"
    click ChatAPI "https://github.com/toukoum/portfolio/tree/main/src/app/api/chat"
    click APIHelper "https://github.com/toukoum/portfolio/tree/main/src/app/api/chat/tools"
    click ChatUI "https://github.com/toukoum/portfolio/tree/main/src/components/chat"
    click Contact "https://github.com/toukoum/portfolio/blob/main/src/components/contact.tsx"
    click Resume "https://github.com/toukoum/portfolio/blob/main/src/components/resume.tsx"
    click Projects "https://github.com/toukoum/portfolio/tree/main/src/components/projects"
    click Skills "https://github.com/toukoum/portfolio/blob/main/src/components/skills.tsx"
    click Sport "https://github.com/toukoum/portfolio/blob/main/src/components/sport.tsx"
    click Presentation "https://github.com/toukoum/portfolio/blob/main/src/components/presentation.tsx"
    click UILibrary "https://github.com/toukoum/portfolio/tree/main/src/components/ui"
    click Hooks "https://github.com/toukoum/portfolio/tree/main/src/hooks"
    click Utils "https://github.com/toukoum/portfolio/tree/main/src/lib"
    click Public "https://github.com/toukoum/portfolio/tree/main/public"

    %% Styles
    classDef client fill:#FFF8B3,stroke:#BDA500,stroke-width:2px;
    classDef frontend fill:#B3E5FC,stroke:#0288D1,stroke-width:2px;
    classDef api fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef utility fill:#FFCDD2,stroke:#D32F2F,stroke-width:2px;
    classDef public fill:#E0E0E0,stroke:#757575,stroke-width:2px;
```
