# tj2904/portfolio architecture

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

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

## Overview

##### Main Components
- Frontend/UI Layer: Represented by the NextJS app. Include the main pages in the src/app directory, distinguishing between layouts (e.g., src/app/layout.tsx, src/app/(main)/layout.tsx) and pages (src/app/(main)/page.tsx, [project] pages).
- API Layer: Highlight the API endpoints located in src/app/api. In this case, the Open Graph (OG) API is defined (e.g., src/app/api/og/route.tsx).
- Components & Lib Modules: The src/components folder holds UI components (AboutSection, Container, Waveform, etc.) and src/lib provides helper code (projects.ts). Include these as foundational building blocks.
- Static Assets & Styles: The public directory (assets like screenshots, fonts, PDFs) and src/styles (Tailwind styles) should be shown. They serve for theming, branding, and visual content.
- Configuration & Build: Files like next.config.js, tailwind.config.ts, tsconfig.json, and others indicate the project's configuration and build settings.

##### Interactions & Data Flow
- How the pages render dynamic content by importing components, using functions from the lib (e.g., projects.ts), and fetching data if applicable.
- Static assets folder as a resource that is served directly (images, PDFs, etc.).
- Point out that the API endpoint (for OG images) is invoked when dynamic social media previews are needed in the portfolio.

##### Architectural Patterns & Technologies
- NextJS Routing: Emphasize the NextJS new app directory and dynamic routes (e.g., [project]) that are used for rendering portfolio items.
- Serverless Functions: Note that API endpoints (such as OG image generation) follow NextJS serverless functions patterns.
- Frontend Componentization: Indicate the separation in the UI layer between reusable components in src/components and layout/page components.
- Styling: TailwindCSS is integral to styling. Include its configuration as part of the visual design system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    U["User Browser"]:::user

    %% NextJS Frontend Components
    N1["Main Layout"]:::frontend
    N3["Nested Layout"]:::frontend
    N2["Main Page"]:::frontend
    N4["Project Page"]:::frontend

    %% API Layer
    API["OG API Endpoint"]:::api

    %% Components & Helper Libraries
    UIC["UI Components"]:::component
    HL["Helper Library (projects.ts)"]:::component

    %% Static Assets & Styles
    SA["Static Assets"]:::asset
    TS["TailwindCSS Styles"]:::asset

    %% Configuration & Build Files
    NConfig["next.config.js"]:::config
    TConfig["tailwind.config.ts"]:::config
    TSConfig["tsconfig.json"]:::config
    ESLINT[".eslintrc.json"]:::config
    PostCSS["postcss.config.js"]:::config
    Prettier["prettier.config.js"]:::config

    %% Deployment
    Vercel["Vercel (Deployment)"]:::deployment

    %% Flow from User to Frontend
    U -->|"request"| N1
    N1 -->|"wraps"| N3
    N3 -->|"renders"| N2
    N3 -->|"renders"| N4

    %% User API Request Flow
    U -->|"requestsOG"| API
    API -->|"returnsOG"| N2
    API -->|"returnsOG"| N4

    %% Dependency of Pages on Components & Helper Library
    N2 -->|"imports"| UIC
    N2 -->|"uses"| HL
    N4 -->|"imports"| UIC
    N4 -->|"uses"| HL

    %% Static Assets & Styles used by Frontend
    N1 -->|"includes"| SA
    N1 -->|"styledBy"| TS

    %% Configuration influences Frontend
    NConfig -->|"configures"| N1
    TConfig -->|"configures"| N1
    TSConfig -->|"configures"| N1
    ESLINT -->|"enforces"| N1
    PostCSS -->|"processes"| N1
    Prettier -->|"formats"| N1

    %% Deployment connections
    N1 -->|"deployedTo"| Vercel
    API -->|"deployedTo"| Vercel

    %% Styling Classes
    classDef user fill:#f8e9a1,stroke:#333,stroke-width:2px;
    classDef frontend fill:#fce38a,stroke:#333,stroke-width:2px;
    classDef api fill:#95e1d3,stroke:#333,stroke-width:2px;
    classDef component fill:#f38181,stroke:#333,stroke-width:2px;
    classDef asset fill:#a8d0e6,stroke:#333,stroke-width:2px;
    classDef config fill:#eaffd0,stroke:#333,stroke-width:2px;
    classDef deployment fill:#c7e9b4,stroke:#333,stroke-width:2px;

    %% Click Events
    click N1 "https://github.com/tj2904/portfolio/blob/main/src/app/layout.tsx"
    click N3 "https://github.com/tj2904/portfolio/blob/main/src/app/(main)/layout.tsx"
    click N2 "https://github.com/tj2904/portfolio/blob/main/src/app/(main)/page.tsx"
    click N4 "https://github.com/tj2904/portfolio/blob/main/src/app/(main)/[project]/page.tsx"
    click API "https://github.com/tj2904/portfolio/blob/main/src/app/api/og/route.tsx"
    click UIC "https://github.com/tj2904/portfolio/tree/main/src/components"
    click HL "https://github.com/tj2904/portfolio/blob/main/src/lib/projects.ts"
    click SA "https://github.com/tj2904/portfolio/tree/main/public"
    click TS "https://github.com/tj2904/portfolio/blob/main/src/styles/tailwind.css"
    click NConfig "https://github.com/tj2904/portfolio/blob/main/next.config.js"
    click TConfig "https://github.com/tj2904/portfolio/blob/main/tailwind.config.ts"
    click TSConfig "https://github.com/tj2904/portfolio/blob/main/tsconfig.json"
    click ESLINT "https://github.com/tj2904/portfolio/blob/main/.eslintrc.json"
    click PostCSS "https://github.com/tj2904/portfolio/blob/main/postcss.config.js"
    click Prettier "https://github.com/tj2904/portfolio/blob/main/prettier.config.js"
```
