# renzel/portfolio_new architecture

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

- Interactive diagram: https://gitdiagram.com/renzel/portfolio_new
- Repository: https://github.com/renzel/portfolio_new

## Overview

##### Main Components
- **Developer Machine / Code Repository**
- Source files (src/, public/, portfolio.js, SCSS, assets)
- Configuration (.env, Dockerfile, CI workflows in .github/workflows)
- **Build & CI/CD Pipeline**
- npm scripts + Webpack (via create‑react‑app)
- Pre‑commit hooks (prettier, linting)
- GitHub Actions workflows (deploy.yml)
- Docker image build (optional)
- **Hosting / CDN Layer**
- GitHub Pages or Netlify (netlify.toml) serving static files (HTML, JS, CSS, assets)
- **Browser / Client**
- React SPA (App.js → containers/components)
- Service Worker (serviceWorker.js) for caching
- Context API (StyleContext) & custom hooks (useLocalStorage)
- **External API Services**
- GitHub GraphQL API (apollo‑boost) to fetch profile, repos, pinned projects
- Medium (RSS or API) for blog posts
- Twitter Embed (react‑twitter‑embed) for timeline
- Lottie (lottie‑react) for animations

##### Relationships & Data Flows
- Developer pushes code → CI triggers build & tests → artifacts deployed to CDN
- On page load: Browser GETs index.html & bundles → React mounts App
- React components use Apollo Client to query GitHub GraphQL (with REACT_APP_GITHUB_TOKEN)
- Conditional fetch: Medium blogs if MEDIUM_USERNAME set
- TwitterTimeline component fetches embed scripts
- Service Worker intercepts requests for offline caching

##### Architectural Patterns
- **SPA (Single Page Application)** with client‑side routing (if any)
- **Component‑Based Architecture** (src/components vs src/containers)
- **Context + Hooks** for global state (theme, localStorage)
- **External Data Layer** via Apollo Client (GraphQL) & REST/embeds
- **Static Hosting + CI/CD** for zero‑backend deployment

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Developer / Repo"
        Dev["Developer Machine / Code Repository"]:::code
        Env["env.example"]:::code
        Docker["Dockerfile"]:::code
        Package["package.json"]:::code
        GH1[".github/workflows/deploy.yml"]:::code
        GH2[".github/workflows/prettier.yml"]:::code
    end

    Dev -->|"push code"| CIP

    CIP["CI/CD Pipeline"]:::pipeline
    CIP -->|"run scripts"| NPM
    CIP -->|"pre-commit checks"| Precommit
    CIP -->|"actions workflows"| Actions
    CIP -->|"build docker (opt)"| DockerBuild

    NPM["npm scripts & Webpack"]:::pipeline
    Precommit["Pre-commit Hooks"]:::pipeline
    Actions["GitHub Actions Workflows"]:::pipeline
    DockerBuild["Docker Image Build (optional)"]:::pipeline

    CIP -->|"deploy artifacts"| Hosting

    subgraph "Hosting / CDN"
        Netlify["Netlify (.toml) / GitHub Pages"]:::pipeline
    end

    Hosting(("Hosting / CDN")):::pipeline
    CIP --> Hosting
    Hosting -->|"serves static files"| Browser

    subgraph "Browser / Client"
        subgraph "React SPA"
            Entry["src/index.js & index.css"]:::client
            App["src/App.js & App.scss"]:::client
            subgraph "Containers"
                MainC["Main.js"]:::client
                GreetingC["Greeting.js"]:::client
                ProfileC["Profile.js"]:::client
            end
            subgraph "Components"
                Toggle["ToggleSwitch.js"]:::client
            end
            subgraph "Contexts & Hooks"
                StyleCtx["StyleContext.js"]:::client
                LocalHook["useLocalStorage.js"]:::client
            end
            SW["serviceWorker.js"]:::client
        end
    end

    Browser(("Browser")):::client

    Browser -->|"GraphQL query"| GitHubAPI
    Browser -->|"REST/RSS fetch"| MediumAPI
    Browser -->|"Embed script load"| TwitterAPI

    subgraph "External Services"
        GitHubAPI["GitHub GraphQL API"]:::external
        MediumAPI["Medium API / RSS"]:::external
        TwitterAPI["Twitter Embed Service"]:::external
    end

    click Dev "https://github.com/renzel/portfolio_new/blob/master/."
    click Env "https://github.com/renzel/portfolio_new/blob/master/env.example"
    click Docker "https://github.com/renzel/portfolio_new/tree/master/Dockerfile"
    click Package "https://github.com/renzel/portfolio_new/blob/master/package.json"
    click GH1 "https://github.com/renzel/portfolio_new/blob/master/.github/workflows/deploy.yml"
    click GH2 "https://github.com/renzel/portfolio_new/blob/master/.github/workflows/prettier.yml"
    click NPM "https://github.com/renzel/portfolio_new/blob/master/package.json"
    click Precommit "https://github.com/renzel/portfolio_new/blob/master/.pre-commit-config.yaml"
    click Actions "https://github.com/renzel/portfolio_new/blob/master/.github/workflows/deploy.yml"
    click Netlify "https://github.com/renzel/portfolio_new/blob/master/netlify.toml"
    click Entry "https://github.com/renzel/portfolio_new/blob/master/src/index.js"
    click App "https://github.com/renzel/portfolio_new/blob/master/src/App.js"
    click MainC "https://github.com/renzel/portfolio_new/blob/master/src/containers/Main.js"
    click GreetingC "https://github.com/renzel/portfolio_new/blob/master/src/containers/greeting/Greeting.js"
    click ProfileC "https://github.com/renzel/portfolio_new/blob/master/src/containers/profile/Profile.js"
    click Toggle "https://github.com/renzel/portfolio_new/blob/master/src/components/ToggleSwitch/ToggleSwitch.js"
    click StyleCtx "https://github.com/renzel/portfolio_new/blob/master/src/contexts/StyleContext.js"
    click LocalHook "https://github.com/renzel/portfolio_new/blob/master/src/hooks/useLocalStorage.js"
    click SW "https://github.com/renzel/portfolio_new/blob/master/src/serviceWorker.js"

    classDef client fill:#c2f0c2,stroke:#000
    classDef external fill:#cde0f7,stroke:#000
    classDef pipeline fill:#f9cb9c,stroke:#000
    classDef code fill:#fce5cd,stroke:#000
```
