# mahdixd/mahdi-portfolio architecture

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

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

## Overview

This project is a front-end portfolio template built with React that serves as a personal or developer portfolio website. The goal is to provide a visually appealing and modular interface where developers can display their skills, background, projects, and social media profiles. The codebase follows a component-based design with a clear separation between UI components, containers (which arrange sections), assets (images, fonts, Lottie animations), configuration files, and external integrations (like GitHub, Medium, and Twitter).

##### Main Components (Nodes)
- Browser/Client – The end-user interface that runs the React application.
- React Application (SPA) – Central node representing the entire app, powered by create‑react‑app.
- App Container – The “src/App.js” that acts as the entry point, integrating various components and setting up routing/layout.
- UI Containers – Each section of the portfolio is encapsulated in its own container (e.g., Greeting, Skills, Education, Experience, Projects, Blogs, Talks, Podcast, and Contact). Represent each container as separate nodes.
- Reusable Components – Within “src/components”, include smaller UI building blocks such as Header, Footer, Button, ToggleSwitch, BlogCard, AchievementCard, etc.
- Context and State Management – Represent the “src/contexts/StyleContext.js” and any hooks (like “useLocalStorage”) that control global state and theming.
- Assets – The “public” folder and “src/assets” directory house static resources (HTML, CSS, images, fonts, and Lottie animations) that the UI components reference.
- Configuration & Environment – Files such as “env.example” and the optional “.env” (configured by the user) provide runtime variables like GitHub tokens and Medium usernames for fetching external data.
- External Data Sources – GitHub APIs (to load GitHub repositories, profile, and pinned projects), Medium blogs, and Twitter timeline embedded via components. Represent these as external nodes that interact with the React application.

##### Relationships & Data Flow
- Within the React Application, show a hierarchical layout:
- The App Container (src/App.js) sits at the top, passing props and state to UI Containers.
- Each UI Container (greeting, skills, blogs, etc.) incorporates several Reusable Components.
- Connections between the configuration/environment node and the React Application to indicate that the app uses environment variables (e.g., REACT_APP_GITHUB_TOKEN) for external API calls.
- CI/CD pipeline:
- From source code (Git repository) through workflows (GitHub Actions and Docker Build) leading to the deployment target (Netlify, GitHub Pages, or Docker container).

##### Architectural Patterns & Design Principles
- Component-Based Architecture – Emphasize separation of UI components and containers based on responsibility.
- Single Page Application (SPA) Design – The entire portfolio runs as an SPA, which simplifies routing and state management.
- Separation of Concerns – Static assets, styles (“*.scss” and “*.css”), and configuration files are placed in their dedicated folders.
- Integration via Environment Variables – External API tokens and settings are loaded through a .env configuration file, clearly decoupling sensitive data from the code.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser/Client"]:::view
    subgraph "View Layer"
        ReactApp["React Application (SPA) & App Container"]:::view
        subgraph "UI Containers"
            Greetings["Greeting Container"]:::view
            Skills["Skills Container"]:::view
            Education["Education Container"]:::view
            Experience["Experience Container"]:::view
            Projects["Projects Container"]:::view
            Blogs["Blogs Container"]:::view
            Talks["Talks Container"]:::view
            Podcast["Podcast Container"]:::view
            Contact["Contact Container"]:::view
        end
        subgraph "Reusable Components"
            Header["Header Component"]:::view
            Footer["Footer Component"]:::view
            Button["Button Component"]:::view
            ToggleSwitch["ToggleSwitch Component"]:::view
            BlogCard["BlogCard Component"]:::view
            AchievementCard["AchievementCard Component"]:::view
        end
        subgraph "Context & State Management"
            StyleContext["Style Context"]:::view
            LocalStorage["useLocalStorage Hook"]:::view
        end
    end

    subgraph "Assets"
        PublicAssets["Static Assets (public)"]:::asset
        AdditionalAssets["Additional Assets (src/assets)"]:::asset
    end

    subgraph "Configuration & Deployment"
        Env["Environment Variables (env.example)"]:::config
        Docker["Deployment Config (Dockerfile)"]:::config
        Workflow["Workflow Config (.github/workflows/deploy.yml)"]:::config
        subgraph "CI/CD Pipeline"
            SourceCode["Source Code"]:::config
            GitHubActions["GitHub Actions"]:::config
            DockerBuild["Docker Build"]:::config
            DeploymentTarget["Deployment Target"]:::config
        end
    end

    subgraph "External Services"
        GitHubAPI["GitHub API"]:::external
        MediumAPI["Medium API"]:::external
        TwitterAPI["Twitter API"]:::external
    end

    Browser --> ReactApp
    ReactApp --> Greetings
    ReactApp --> Skills
    ReactApp --> Education
    ReactApp --> Experience
    ReactApp --> Projects
    ReactApp --> Blogs
    ReactApp --> Talks
    ReactApp --> Podcast
    ReactApp --> Contact

    ReactApp --> StyleContext
    ReactApp --> LocalStorage

    Env --> ReactApp
    GitHubAPI -- "fetch" --> ReactApp
    MediumAPI -- "fetch" --> ReactApp
    TwitterAPI -- "fetch" --> ReactApp

    SourceCode --> GitHubActions
    GitHubActions --> DockerBuild
    DockerBuild --> DeploymentTarget
    DeploymentTarget --> ReactApp

    PublicAssets --> ReactApp
    AdditionalAssets --> ReactApp

    %% Illustrative links between UI Containers and Reusable Components
    Greetings --> Header
    Experience --> Footer
    Blogs --> BlogCard

    %% Additional dashed links to indicate usage of reusable components across the app
    ReactApp --- Header
    ReactApp --- Footer
    ReactApp --- Button
    ReactApp --- ToggleSwitch
    ReactApp --- BlogCard
    ReactApp --- AchievementCard

    classDef view fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef config fill:#ABEBC6,stroke:#196F3D,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef asset fill:#F5CBA7,stroke:#B03A2E,stroke-width:2px;

    click Browser "https://github.com/mahdixd/mahdi-portfolio/blob/master/public/index.html"
    click ReactApp "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/App.js"
    click Greetings "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/greeting/Greeting.js"
    click Skills "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/skills/Skills.js"
    click Education "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/education/Education.js"
    click Experience "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/workExperience/WorkExperience.js"
    click Projects "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/projects/Projects.js"
    click Blogs "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/blogs/Blogs.js"
    click Talks "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/talks/Talks.js"
    click Podcast "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/podcast/Podcast.js"
    click Contact "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/containers/contact/Contact.js"
    click Header "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/components/header/Header.js"
    click Footer "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/components/footer/Footer.js"
    click Button "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/components/button/Button.js"
    click ToggleSwitch "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/components/ToggleSwitch/ToggleSwitch.js"
    click BlogCard "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/components/blogCard/BlogCard.js"
    click AchievementCard "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/components/achievementCard/AchievementCard.js"
    click StyleContext "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/contexts/StyleContext.js"
    click LocalStorage "https://github.com/mahdixd/mahdi-portfolio/blob/master/src/hooks/useLocalStorage.js"
    click PublicAssets "https://github.com/mahdixd/mahdi-portfolio/tree/master/public"
    click AdditionalAssets "https://github.com/mahdixd/mahdi-portfolio/tree/master/src/assets"
    click Env "https://github.com/mahdixd/mahdi-portfolio/blob/master/env.example"
    click Docker "https://github.com/mahdixd/mahdi-portfolio/tree/master/Dockerfile"
    click Workflow "https://github.com/mahdixd/mahdi-portfolio/blob/master/.github/workflows/deploy.yml"
```
