# ujjwalvivek/portfolio architecture

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

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

## Overview

##### Project type and purpose
- This is a single‐page, client‐only portfolio website built with React.
- It uses Create React App (CRA) under the hood (overridden via `react-app-rewired` and `customize-cra`), styled with CSS Modules and PostCSS, and deployed as static assets to Firebase Hosting.
- It has a simple CI/CD setup using GitHub Actions to push to Firebase on PRs and merges.

##### File structure
- Top Level
- config‐overrides.js, postcss.config.js – custom CRA and PostCSS build configs
- firebase.json, .firebaserc – Firebase Hosting configuration
- .github/workflows/*.yml – CI/CD pipelines for deploying to Firebase
- package.json, package-lock.json – npm package config
- public/
- static assets, index.html, manifest.json, robots.txt
- src/
- React entrypoint (index.js), App component (App.js + App.module.css), tests, support files (reportWebVitals.js, setupTests.js)

##### README insights
- Core stack: React, CSS Modules, PostCSS plugins (import, preset-env, nested, autoprefixer, cssnano)
- Dev flow: `npm start` for local, `npm run build` → static bundle, `npm test`, CI via GitHub Actions

##### Components
a. Main components
1. Developer Environment
- Local machine with Node.js / npm
- React Dev Server (npm start)
- Test runner (npm test)
2. Build Pipeline
- react-app-rewired & customize-cra
- Webpack / Babel / PostCSS build steps
- Output: static files (JS/CSS/HTML) in `build/`
3. Source Code & Version Control
- Git repo on GitHub
- .github/workflows GitHub Actions for CI/CD
4. Continuous Integration / Deployment
- GitHub Actions workflows
- firebase-hosting-pull-request.yml (deploy preview)
- firebase-hosting-merge.yml (deploy production)
5. Hosting Infrastructure
- Firebase Hosting (as static site)
- .firebaserc connects to Firebase projects
6. End Users
- Web browsers requesting static assets

b. Relationships & interactions
- Developer commits code → pushes to GitHub
- On push/PR → GitHub Actions runs build & tests
- Successful build → Actions deploys to Firebase Hosting (preview or prod)
- Firebase serves static bundle to end users
- Local dev uses React Dev Server to serve dynamic app at localhost

c. Architectural patterns & design principles
- Single‐page application (SPA)
- Unidirectional data flow within React
- Build‐time asset pipeline (PostCSS + CSS Modules)
- GitOps via CI/CD: “infrastructure as code” (`firebase.json`, workflows)
- Separation of concerns: code (src/) vs public assets vs config vs CI

d. Technologies & frameworks
- React, React DOM
- react-app-rewired & customize-cra
- Webpack, Babel
- PostCSS plugins (import, preset-env, nested, autoprefixer, cssnano)
- CSS Modules
- Firebase CLI & Hosting
- GitHub Actions

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Local Development
    subgraph "Local Development"
        direction TB
        DevMachine["Developer Environment\n(Node.js/npm)"]:::dev
        PackageJSON["package.json"]:::artifact
        SrcCode["src/"]:::artifact
        ReactServer["React Dev Server\n(npm start)"]:::dev
        LocalBrowser["Browser\n(localhost)"]:::user
    end

    DevMachine -->|"npm start"| ReactServer
    ReactServer -->|"HTTP GET"| LocalBrowser

    DevMachine -->|uses| PackageJSON
    DevMachine -->|edits| SrcCode

    click PackageJSON "https://github.com/ujjwalvivek/portfolio/blob/main/package.json"
    click SrcCode "https://github.com/ujjwalvivek/portfolio/tree/main/src/"

    %% Version Control & CI
    subgraph "Version Control & CI"
        direction TB
        GitRepo["GitHub Repository"]:::ci
        GitIgnore[".gitignore"]:::artifact
        Readme["README.md"]:::artifact
        GitHubConfig[".github/"]:::artifact
        PRWorkflow["firebase-hosting-pull-request.yml"]:::ci
        MergeWorkflow["firebase-hosting-merge.yml"]:::ci
        BuildPipeline["Build Pipeline\n(react-app-rewired, Webpack, Babel, PostCSS)"]:::ci
        ConfigOverrides["config-overrides.js"]:::artifact
        PostCSSConfig["postcss.config.js"]:::artifact
        BuildOutput["build/"]:::artifact
    end

    DevMachine -->|"git push"| GitRepo
    SrcCode -->|includes| GitIgnore
    GitRepo -->|triggers on PR| PRWorkflow
    GitRepo -->|triggers on merge| MergeWorkflow
    PRWorkflow -->|"npm run build"| BuildPipeline
    MergeWorkflow -->|"npm run build"| BuildPipeline

    BuildPipeline -->|reads| ConfigOverrides
    BuildPipeline -->|reads| PostCSSConfig
    BuildPipeline -->|outputs| BuildOutput

    click GitIgnore "https://github.com/ujjwalvivek/portfolio/blob/main/.gitignore"
    click Readme "https://github.com/ujjwalvivek/portfolio/blob/main/README.md"
    click GitHubConfig "https://github.com/ujjwalvivek/portfolio/tree/main/.github/"
    click PRWorkflow "https://github.com/ujjwalvivek/portfolio/blob/main/.github/workflows/firebase-hosting-pull-request.yml"
    click MergeWorkflow "https://github.com/ujjwalvivek/portfolio/blob/main/.github/workflows/firebase-hosting-merge.yml"
    click ConfigOverrides "https://github.com/ujjwalvivek/portfolio/blob/main/config-overrides.js"
    click PostCSSConfig "https://github.com/ujjwalvivek/portfolio/blob/main/postcss.config.js"
    click BuildOutput "https://github.com/ujjwalvivek/portfolio/tree/main/build/"

    %% Hosting & Production
    subgraph "Hosting & Production"
        direction TB
        FirebaseCLI["Firebase CLI"]:::prod
        FirebaseConfigJSON["firebase.json"]:::artifact
        Firebaserc[".firebaserc"]:::artifact
        FirebaseCache[".firebase/hosting.YnVpbGQ.cache"]:::artifact
        FirebaseHosting["Firebase Hosting\n(static site)"]:::prod
        EndUser["End User\n(Web Browser)"]:::user
    end

    BuildOutput -->|"firebase deploy"| FirebaseCLI
    FirebaseCLI -->|reads| FirebaseConfigJSON
    FirebaseCLI -->|reads| Firebaserc
    FirebaseCLI -->|uses cache| FirebaseCache
    FirebaseCLI -->|deploys| FirebaseHosting
    EndUser -->|"HTTP GET"| FirebaseHosting

    click FirebaseConfigJSON "https://github.com/ujjwalvivek/portfolio/blob/main/firebase.json"
    click Firebaserc "https://github.com/ujjwalvivek/portfolio/blob/main/.firebaserc"
    click FirebaseCache "https://github.com/ujjwalvivek/portfolio/blob/main/.firebase/hosting.YnVpbGQ.cache"

    %% Classes
    classDef dev fill:#D0E8FF,stroke:#005B96,color:#003F63;
    classDef ci fill:#FFF4D1,stroke:#B58900,color:#5F370E;
    classDef prod fill:#E8FFE8,stroke:#2E8B57,color:#1A4D28;
    classDef artifact fill:#F0F0F0,stroke:#555,color:#333;
    classDef user fill:#FFEFD5,stroke:#CD853F,color:#8B4513;
```
