# charliechauri/charliechauri-web architecture

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

- Interactive diagram: https://gitdiagram.com/charliechauri/charliechauri-web
- Repository: https://github.com/charliechauri/charliechauri-web

## Overview

##### Project type and purpose
- This is a single‐page application (SPA) built with React and TypeScript, bootstrapped via Create-React-App and extended with a custom boilerplate (“cra-extended”).
- Its primary goals are to serve as Charlie Chauri’s personal website and as a reference/demo of best practices in React front-end development (testing, i18n, theming, code quality, CI/CD, etc.).

##### File structure
- Top-level config and tooling:
- .github/workflows/build.yml (GitHub Actions CI/CD)
- commitlint.config.js, .eslintrc, .prettierrc, Husky/git hooks
- package.json, tsconfig.json
- Public assets:
- public/index.html, manifest.json, robots.txt, fonts
- Source code (src/):
- App entrypoints (App.tsx, index.tsx, serviceWorker.ts)
- Context providers (ThemeContext.tsx, i18n.tsx)
- Components directory (Description, Heading, Select, etc.)
- Pages directory (Home.tsx)
- Styling (src/scss/*) and images (src/img)
- Testing setup (App.test.tsx, setupTests.ts, src/test/)
- Localization files (src/locales/en/translation.json, es/…)

##### README for technical stack and workflows
- Yarn scripts for start, build, test, lint, format
- Enforced code quality via ESLint, Prettier, commit lint, coverage thresholds
- CI: GitHub Actions runs build/test on push, deploys to Netlify
- Hosting: static build delivered via Netlify (with CDN)

##### Main components and their interactions
a. Components
- Developer workstation: IDE, Node.js/npm or Yarn, Git client
- Code repository on GitHub (with pull-request templates, branch protections)
- CI/CD pipeline (GitHub Actions)
- Static hosting & CDN (Netlify)
- Client runtime (Web browser)
- React app runtime: Context providers (i18n, Theme), component tree, service worker
b. Relationships and data flow
1. Developer writes code → commits & pushes to GitHub
2. GitHub Actions triggers: linter → tests → build
3. On success, Netlify picks up build artifacts → deploys to CDN
4. End user’s browser requests site → CDN serves index.html & JS/CSS bundles
5. React loads in browser → Contexts initialize (theme, locale) → renders component tree → fetches any dynamic/static assets
6. Service worker registers for offline support
c. Architectural patterns & design principles
- Component-driven UI with small, focused components (atomic design style)
- React Context API for cross-cutting concerns (theming, i18n)
- CSS/Sass modularization (SCSS partials, component-scoped styles)
- Absolute imports via TypeScript config for cleaner module paths
- Automated code quality: linters, formatters, commit hooks, coverage gates
- CI/CD as code via GitHub workflows and Netlify integration
d. Key technologies
- React, TypeScript, Create-React-App (Webpack, Babel)
- Sass (node-sass), CSS modules/global SCSS
- react-i18next for localization
- Jest & React Testing Library for unit tests
- ESLint, Prettier, Husky, Commitlint for quality
- GitHub Actions for CI
- Netlify for hosting & CDN

##### Essential details to capture
- The dual objectives: personal website + best-practices demo
- The zero-server/static hosting model (Netlify + CDN)
- The local dev → CI → deployment workflow
- The internal React architecture: contexts, styling, locales, tests

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Development Layer
    subgraph "Development Tools" 
        style DevTools fill:#dddddd,stroke:#888,stroke-width:1px
        DevTools["Developer Workstation"]:::devtools
        IDE["IDE"]:::devtools
        Node["Node.js/Yarn"]:::devtools
        GitClient["Git Client"]:::devtools
    end

    %% Code Repository
    GitHub["GitHub Repository"]:::cloud
    click GitHub "https://github.com/charliechauri/charliechauri-web/blob/main/.github"

    DevTools -->|writes code & pushes| GitHub
    IDE --> DevTools
    Node --> DevTools
    GitClient --> DevTools

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        style CICD fill:#cce5ff,stroke:#339,stroke-width:1px
        Actions["GitHub Actions"]:::cicd
        Linter["ESLint"]:::cicd
        Formatter["Prettier"]:::cicd
        CommitLint["Commitlint"]:::cicd
        Tests["Jest & RTL Tests"]:::cicd
        Build["Build (CRA)"]:::cicd
    end

    GitHub -->|on push CI triggers| Actions
    Actions -->|runs| Linter
    Actions -->|runs| Formatter
    Actions -->|runs| CommitLint
    Actions -->|runs| Tests
    Actions -->|runs| Build

    click Actions "https://github.com/charliechauri/charliechauri-web/blob/main/.github/workflows/build.yml"
    click Linter "https://github.com/charliechauri/charliechauri-web/blob/main/.eslintrc"
    click Formatter "https://github.com/charliechauri/charliechauri-web/blob/main/.prettierrc"
    click CommitLint "https://github.com/charliechauri/charliechauri-web/blob/main/commitlint.config.js"

    %% Hosting Layer
    subgraph "Hosting & CDN" 
        style Hosting fill:#d1f2eb,stroke:#088,stroke-width:1px
        Netlify["Netlify"]:::hosting
        CDN["CDN"]:::hosting
    end

    Build -->|artifacts| Netlify
    Netlify -->|deploy| CDN

    %% Runtime Layer
    Browser["End User Browser"]:::runtime
    CDN -->|serves index.html & bundles| Browser

    %% Browser Internal
    subgraph "Browser Runtime" 
        style BrowserSub fill:#e8f8f5,stroke:#088,stroke-width:1px
        HTML["public/index.html"]:::runtime
        ReactDOM["React DOM"]:::runtime
        subgraph "Context Providers"
            ThemeCtx["ThemeContext"]:::runtime
            I18nCtx["i18n Setup"]:::runtime
        end
        AppComp["Main App (App.tsx)"]:::runtime
        subgraph "Component Tree"
            Description["Description"]:::runtime
            Heading["Heading"]:::runtime
            Select["Select"]:::runtime
            LinkComp["Link"]:::runtime
            Loading["Loading"]:::runtime
            Logo["Logo"]:::runtime
            LangSel["LanguageSelector"]:::runtime
            ThemeSel["ThemeSelector"]:::runtime
            SocialNet["SocialNetworks"]:::runtime
            GlobalSel["GlobalSelectors"]:::runtime
            ErrorBoundary["ErrorBoundary"]:::runtime
        end
        subgraph "Styling & Localization"
            SCSS["_reset.scss"]:::runtime
            SCSS2["_variables.scss"]:::runtime
            SCSS3["_typography.scss"]:::runtime
            SCSS4["_palette.scss"]:::runtime
            SCSS5["_utility.scss"]:::runtime
            LocaleEn["en/translation.json"]:::runtime
            LocaleEs["es/translation.json"]:::runtime
        end
        SW["Service Worker"]:::runtime
    end

    Browser --> HTML
    HTML --> ReactDOM
    ReactDOM --> ThemeCtx
    ReactDOM --> I18nCtx
    ThemeCtx --> AppComp
    I18nCtx --> AppComp
    AppComp --> Description
    AppComp --> Heading
    AppComp --> Select
    AppComp --> LinkComp
    AppComp --> Loading
    AppComp --> Logo
    AppComp --> LangSel
    AppComp --> ThemeSel
    AppComp --> SocialNet
    AppComp --> GlobalSel
    AppComp --> ErrorBoundary
    AppComp --> SCSS
    AppComp --> SCSS2
    AppComp --> SCSS3
    AppComp --> SCSS4
    AppComp --> SCSS5
    AppComp --> LocaleEn
    AppComp --> LocaleEs
    AppComp --> SW

    click HTML "https://github.com/charliechauri/charliechauri-web/blob/main/public/index.html"
    click ReactDOM "https://github.com/charliechauri/charliechauri-web/blob/main/src/index.tsx"
    click AppComp "https://github.com/charliechauri/charliechauri-web/blob/main/src/App.tsx"
    click ThemeCtx "https://github.com/charliechauri/charliechauri-web/blob/main/src/ThemeContext.tsx"
    click I18nCtx "https://github.com/charliechauri/charliechauri-web/blob/main/src/i18n.tsx"
    click SW "https://github.com/charliechauri/charliechauri-web/blob/main/src/serviceWorker.ts"
    click SCSS "https://github.com/charliechauri/charliechauri-web/blob/main/src/scss/_reset.scss"
    click SCSS2 "https://github.com/charliechauri/charliechauri-web/blob/main/src/scss/_variables.scss"
    click SCSS3 "https://github.com/charliechauri/charliechauri-web/blob/main/src/scss/_typography.scss"
    click SCSS4 "https://github.com/charliechauri/charliechauri-web/blob/main/src/scss/_palette.scss"
    click SCSS5 "https://github.com/charliechauri/charliechauri-web/blob/main/src/scss/_utility.scss"
    click Description "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/Description/Description.tsx"
    click Heading "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/Heading/Heading.tsx"
    click Select "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/Select/Select.tsx"
    click LinkComp "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/Link/Link.tsx"
    click Loading "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/Loading/Loading.tsx"
    click Logo "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/Logo/Logo.tsx"
    click LangSel "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/LanguageSelector/LanguageSelector.tsx"
    click ThemeSel "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/ThemeSelector/ThemeSelector.tsx"
    click SocialNet "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/SocialNetworks/SocialNetworks.tsx"
    click GlobalSel "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/GlobalSelectors/GlobalSelectors.tsx"
    click ErrorBoundary "https://github.com/charliechauri/charliechauri-web/blob/main/src/components/ErrorBoundary/ErrorBoundary.tsx"
    click LocaleEn "https://github.com/charliechauri/charliechauri-web/blob/main/src/locales/en/translation.json"
    click LocaleEs "https://github.com/charliechauri/charliechauri-web/blob/main/src/locales/es/translation.json"

    classDef devtools fill:#eeeeee,stroke:#666,stroke-width:1px
    classDef cicd fill:#cce5ff,stroke:#339,stroke-width:1px
    classDef hosting fill:#d1f2eb,stroke:#088,stroke-width:1px
    classDef runtime fill:#e2f7e1,stroke:#2d862d,stroke-width:1px
    classDef cloud fill:#f0f8ff,stroke:#339,stroke-width:1px
```
