# omkarok2510/omkar_portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/omkarok2510/omkar_portfolio
- Repository: https://github.com/omkarok2510/omkar_portfolio

## Overview

##### Project Type and Purpose
- This is a single‐page React application (Create React App) used to generate a developer portfolio site. It runs entirely in the browser as a static SPA but fetches dynamic data (GitHub repos, Medium posts, Twitter timeline) at runtime. It also includes a Dockerfile and GitHub Actions workflows for CI/CD and deployment to GitHub Pages or Netlify.

##### File Structure
- Top‐level files & folders:
- Dockerfile – containerizes the build & serve process
- .github/workflows – CI/CD definitions (deploy, prettier checks)
- public/ – static HTML, manifest, robots.txt
- src/ – all React code
– components/ – reusable UI widgets (buttons, cards, toggles)
– containers/ – page‐level composites (About, Blogs, Contact, etc.)
– contexts/ – React Context for theming (StyleContext)
– hooks/ – custom hooks (useLocalStorage)
– assets/ – fonts, images, Lottie animations
– serviceWorker.js, setupTests.js – CRA support files
- Configuration: .env for API tokens, .prettierrc, .github workflows.

##### README for Insights
- Project description: customizable, themeable portfolio; dynamic GitHub, Medium, Twitter integration.
- Deployment: supports Docker, GitHub Actions, GH Pages, Netlify.
- Tech Stack: React, SCSS, Apollo GraphQL (github), react-twitter-embed, Lottie.

##### Main Components & Their Relationships
a. Frontend SPA (User’s Browser)
- React App (App.js) renders containers & components.
- Custom hook (useLocalStorage) persists dark/light mode.
b. Data Layer & External Services
- GitHub GraphQL API (via fetch.js or apollo-boost) → pinned repos, profile, contributions
- Medium (via REST fetch) → latest blog posts
- Twitter Embed → live Twitter timeline widget
c. Static Asset Store
- Served from public/ and compiled into build (images, Lottie, fonts)
d. Build & CI/CD Pipeline
- Source repository on GitHub
- GitHub Actions workflows
- prettier.yml → lint & format check
- deploy.yml → builds Docker image, runs npm build, publishes to GH Pages or pushes to Netlify
- Docker build (Dockerfile) → containerizes `npm install` & `npm run build` / `serve -s build`
- Deployment target: GitHub Pages CDN or Netlify CDN

##### Architectural Patterns & Design Principles
- Component‐based UI: small, reusable, stateless/stately React components
- Container/presentation separation: containers orchestrate business logic, components handle rendering
- Context API for cross‐cutting concerns (theme)
- Single GraphQL client for GitHub data
- Single SPA served statically (no backend server beyond static host)

##### Essential Elements
- Labels: React App, StyleContext, useLocalStorage, Containers, Components

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Browser"
        Browser["User's Browser"]:::gray
    end

    subgraph "React SPA"
        direction TB
        Index["src/index.js"]:::frontend
        App["src/App.js"]:::frontend
        StyleContext["StyleContext"]:::frontend
        Hook["useLocalStorage"]:::frontend

        subgraph "Containers"
            direction TB
            Main["Main.js"]:::frontend
            Blogs["Blogs.js"]:::frontend
            Contact["Contact.js"]:::frontend
            TwitterEmbed["twitter.js"]:::frontend
        end

        subgraph "Components"
            direction TB
            Toggle["ToggleSwitch"]:::frontend
            BlogCard["BlogCard"]:::frontend
            RepoCard["GithubRepoCard"]:::frontend
        end

        Fetch["fetch.js"]:::frontend
        SW["serviceWorker.js"]:::frontend
        Tests["setupTests.js"]:::frontend
    end

    Browser -->|serves build| App
    App -->|provides theme via| StyleContext
    App -->|uses| Hook
    App -->|renders| Containers
    Containers --> Components
    App -->|fetches data| Fetch

    subgraph "External Services"
        direction TB
        GitHub((GitHub GraphQL API)):::external
        Medium((Medium API)):::external
        Twitter((Twitter Embed)):::external
    end

    App -->|GraphQL queries| GitHub
    App -->|REST fetch| Medium
    App -->|widget embed| Twitter

    AssetStore([/public/]):::asset
    Assets([src/assets]):::asset
    App -->|static assets| AssetStore
    App -->|load media| Assets

    subgraph "CI/CD Pipeline"
        direction TB
        Prettier["prettier.yml"]:::ci
        Deploy["deploy.yml"]:::ci
        Docker["Dockerfile"]:::ci
        GitHubActions[(GitHub Actions)]:::ci
    end

    GitHubRepo[("GitHub Repo")]:::gray
    GitHubRepo --> GitHubActions
    GitHubActions --> Prettier
    GitHubActions --> Deploy
    Deploy --> Docker
    Docker -->|build & serve| CDN

    subgraph "CDN/Hosting"
        CDN["CDN Hosting"]:::gray
    end

    Browser -->|loads from| CDN

    click Index "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/index.js"
    click App "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/App.js"
    click StyleContext "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/contexts/StyleContext.js"
    click Hook "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/hooks/useLocalStorage.js"
    click Toggle "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/components/ToggleSwitch/ToggleSwitch.js"
    click BlogCard "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/components/blogCard/BlogCard.js"
    click RepoCard "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/components/githubRepoCard/GithubRepoCard.js"
    click Main "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/containers/Main.js"
    click Blogs "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/containers/blogs/Blogs.js"
    click Contact "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/containers/contact/Contact.js"
    click TwitterEmbed "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/containers/twitter-embed/twitter.js"
    click Fetch "https://github.com/omkarok2510/omkar_portfolio/blob/main/fetch.js"
    click AssetStore "https://github.com/omkarok2510/omkar_portfolio/tree/main/public/"
    click Assets "https://github.com/omkarok2510/omkar_portfolio/tree/main/src/assets/"
    click SW "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/serviceWorker.js"
    click Tests "https://github.com/omkarok2510/omkar_portfolio/blob/main/src/setupTests.js"
    click Docker "https://github.com/omkarok2510/omkar_portfolio/tree/main/Dockerfile"
    click Prettier "https://github.com/omkarok2510/omkar_portfolio/blob/main/.github/workflows/prettier.yml"
    click Deploy "https://github.com/omkarok2510/omkar_portfolio/blob/main/.github/workflows/deploy.yml"

    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef external fill:#d4edda,stroke:#155724,color:#155724
    classDef asset fill:#fff3cd,stroke:#856404,color:#856404
    classDef ci fill:#e2e3e5,stroke:#d6d8db,color:#383d41
    classDef gray fill:#f8f9fa,stroke:#6c757d,color:#6c757d
```
