# tesfadan/portfolio architecture

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

## Overview

##### Project Type & Purpose
- This is a front-end portfolio website built using Next.js. According to the README, it’s built with Next.js and deployed on Vercel. Its purpose is to showcase Tesfa Demissie’s projects, resume, portfolio, and additional content like mini-games.

##### File Structure
- Top-level files like package.json, next.config.js, and tsconfig.json indicate project configuration for a Next.js/TypeScript project.
- The presence of the pages folder shows the Next.js file-based routing system. Within 'pages', there are subdirectories (e.g., about, portfolio, projects) and dynamic routes (e.g., portfolio/[id].tsx) that serve as main entry points for the website.
- The 'src' directory holds:
- @types: Type definitions for custom types (e.g., CaseStudy.tsx).
- content: JSON and TypeScript files providing data (Portfolio.json, Projects.json, aboutContent.ts, miniGameContent.ts) that feed into pages or components.
- context: Likely for managing global state (e.g., theme or other shared states) using React’s Context API.
- head: Custom head scripts for analytics (like gtag.ts) and meta tags.
- helpers: Utility functions and components (e.g., getLocalTheme.ts for theme fetching, BlockRender.tsx for dynamic content rendering).

##### Key Components
a. Main Components:
- Frontend Pages: The 'pages' directory representing the site’s various routes (homepage, about, portfolio, projects, 404).
- Content/Data: Files in 'src/content' that provide structured data (e.g., JSON definitions for projects/portfolio items) which power dynamic pages.
- Context/State Management: Implemented in 'src/context' to provide global state (e.g., theme switching, user interface states).
- Styling & Themes: Styles are defined in SCSS files under 'src/styles' and 'styles', and theme configuration is in 'src/theme'.
- Static Assets: Managed in the 'public' directory.
- Configuration & Setup: Next.js configuration files (next.config.js, next-env.d.ts) and build artifacts (package.json, .babelrc) to manage the application’s build and runtime behavior.

b. Relationships & Interactions:
- The pages layer (Next.js file routing) orchestrates which components (from 'src/components') to render.
- Each page fetches or references content from the 'src/content' to dynamically render data.
- Global styles and themes provide consistent visual appearance via 'src/styles' & 'src/theme'.
- The context files wrap the app (_app.tsx) to pass global state to various UI components.
- Static assets (images, videos, documents) referenced by pages/components are served directly from the 'public' directory.
- Third-party integrations (analytics via src/head/gtag.ts) are integrated into the head of pages.

c. Architectural Patterns & Design Principles:
- File-based routing provided by Next.js is the backbone of the navigation structure.
- Component-based UI design promotes reuse and separation of concerns.
- Separation between content (data) and presentation, with content stored in JSON and textual files.
- Use of contexts for global state management (e.g., theming).
- The project follows a modular and organized structure to keep concerns separate (e.g., components, helpers, context, styling).

d. Technologies, Frameworks, & Libraries:
- Next.js (React framework) for rendering and routing.
- TypeScript for type safety as evidenced by .tsx and .ts files.
- SCSS for styling.
- Possibly other libraries/components for analytics (Google Analytics via gtag.ts) and theme management.
- Deployment is handled by Vercel, so hosting integration is a part of the architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Configuration & Build Setup"
        Config["\"Configuration & Build Setup\""]:::config
    end

    subgraph "Routing & Pages"
        Pages["\"Next.js Pages\""]:::pages
    end

    subgraph "UI Layer"
        Components["\"UI Components\""]:::ui
    end

    subgraph "Data & Content"
        Content["\"Content/Data Layer\""]:::content
    end

    subgraph "Global State"
        Context["\"Global Context/State\""]:::context
    end

    subgraph "Head & Analytics"
        Head["\"Head & Analytics Scripts\""]:::head
    end

    subgraph "Helper & Utilities"
        Helpers["\"Helper Utilities\""]:::helper
    end

    subgraph "Styling & Themes"
        Styles["\"Styling & Themes\""]:::styles
    end

    subgraph "Static Assets"
        Assets["\"Static Assets\""]:::assets
    end

    subgraph "Deployment"
        Vercel["\"Vercel Deployment\""]:::external
    end

    %% Connections
    Config -->|"configures"| Pages
    Pages -->|"renders"| Components
    Pages -->|"fetches"| Content
    Pages -->|"wrapped_by"| Context
    Pages -->|"injects"| Head
    Pages -->|"references"| Assets
    Components -->|"utilizes"| Helpers
    Components -->|"styled_by"| Styles
    Components -->|"consumes"| Content
    Components -->|"reads_state"| Context
    Context -->|"provides_theme"| Styles
    Vercel -->|"deploys"| Pages

    %% Click Events
    click Pages "https://github.com/tesfadan/portfolio/tree/production/pages"
    click Components "https://github.com/tesfadan/portfolio/tree/production/src/components"
    click Content "https://github.com/tesfadan/portfolio/tree/production/src/content"
    click Context "https://github.com/tesfadan/portfolio/tree/production/src/context"
    click Head "https://github.com/tesfadan/portfolio/tree/production/src/head"
    click Helpers "https://github.com/tesfadan/portfolio/tree/production/src/helpers"
    click Styles "https://github.com/tesfadan/portfolio/tree/production/src/styles"
    click Assets "https://github.com/tesfadan/portfolio/tree/production/public"
    click Config "https://github.com/tesfadan/portfolio/blob/production/package.json"

    %% Styles
    classDef config fill:#7FDBFF,stroke:#000,stroke-width:2px;
    classDef pages fill:#0074D9,stroke:#000,color:#fff,stroke-width:2px;
    classDef ui fill:#2ECC40,stroke:#000,stroke-width:2px;
    classDef content fill:#FF851B,stroke:#000,stroke-width:2px;
    classDef context fill:#FFDC00,stroke:#000,stroke-width:2px;
    classDef head fill:#B10DC9,stroke:#000,stroke-width:2px;
    classDef helper fill:#39CCCC,stroke:#000,stroke-width:2px;
    classDef styles fill:#F012BE,stroke:#000,stroke-width:2px;
    classDef assets fill:#AAAAAA,stroke:#000,stroke-width:2px;
    classDef external fill:#001f3f,stroke:#000,stroke-width:2px,color:#fff;
```
