# synguyen98/my-portfolio architecture

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

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

## Overview

##### Main Components
- Frontend Application:
- Index.html and public folder: These files and assets (like the .lottie file, PDFs, images, etc.) represent the static assets that are loaded by the UI.
- src folder: Contains all the React components (organized into subfolders for different views like about, achievements, contact, footer, introduction, projects, project-detail, and tech-stacks) along with application logic (App.tsx) and shared constants/models.
- Styling and configuration: Files such as index.css, vite.config.ts, tsconfig files, and ESLint configurations form a part of the development infrastructure.

- CI/CD & DevOps:
- .github folder (workflows and dependabot): Contains GitHub Action workflows (for Azure Static App Deploy, Terraform deploy) and automated dependency management.
- staticwebapp.config.json: Likely governs how the static web app is deployed.

- Infrastructure as Code:
- terraform folder: Contains deployment scripts (main.tf, variables.tf) which define the actual infrastructure the application deploys to.

##### Relationships and Interactions
- The Browser loads the index.html, which in turn invokes the React application (bootstrapped by main.tsx).
- The React components (organized within src/components) interact to deliver the UI/UX. For instance, components like Navbar, WelcomeScreen, and various project/tech components work together to form the pages.
- Public assets (stored in public/) are loaded as needed by several components (e.g., the achievements PDF, project media files).
- The CI/CD pipeline (as defined in the .github/workflows directory) automates tests, builds, and ultimately the deployment of the application.
- Terraform scripts integrate with the CI/CD workflow to ensure that the infrastructure is provisioned or updated before deployment.

##### Important Architectural Patterns and Technologies
- Component-Based Architecture: The project is divided into reusable UI components based on their respective functionalities (about, achievements, contact, etc.).
- Separation of concerns: Clear distinction between the presentation layer (React components), static assets, and infrastructure/deployment configuration.
- DevOps Integration: Use of GitHub Actions for automating deployments and Terraform for managing infrastructure code.
- Technologies: React (with TypeScript), Vite (for fast development and HMR), ESLint (for code quality), GitHub Actions, Azure-specific deployment workflows, and Terraform.

##### Instructing the Principal Software Engineer
- Use clear and distinct labels for each major component:
- Frontend Layer: “UI – React Components” (with subgroups like About, Projects, etc.), “Static Assets”.
- Build/Development Tools: “Vite Bundler”, “ESLint/TypeScript Configuration”.
- Infrastructure: “Terraform Scripts” leading to “Provisioned Cloud Resources” (e.g. Azure services).
- From the browser (client) to index.html / public assets.
- Data flow from index.html to the React application.
- Rectangles for UI and code components.
- Even if it means drawing separate clusters for each layer, this will ensure that every element (from static files to deployment workflows) is captured.
- Do not hesitate to mark subcomponents within the frontend (for example, breaking down the projects or tech stacks into finer UI modules).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Browser Layer"
        Browser("Browser (Client)"):::browser
    end

    subgraph "Frontend Layer"
        indexHtml("index.html"):::frontend
        publicAssets("Public Assets"):::frontend
        mainTs("main.tsx"):::frontend
        appTs("App.tsx"):::frontend
        components("Components"):::frontend
        indexCss("index.css"):::frontend
        viteConfig("vite.config.ts"):::frontend
        tsconfig("tsconfig.json"):::frontend
        eslintConfig("eslint.config.js"):::frontend
    end

    subgraph "CI/CD Pipeline"
        azureWorkflow("Azure Static App Workflow"):::cicd
        terraformWorkflow("Terraform Deploy Workflow"):::cicd
        dependabot("Dependabot"):::cicd
        deploymentConfig("Deployment Config"):::cicd
    end

    subgraph "Infrastructure Layer"
        mainTf("main.tf"):::infra
        variablesTf("variables.tf"):::infra
        provisioned("Provisioned Cloud Resources"):::infra
    end

    %% Connections within Frontend Layer and from Browser
    Browser -->|"loads"| indexHtml
    Browser -->|"loads"| publicAssets
    indexHtml -->|"bootstraps"| mainTs
    mainTs -->|"initializes"| appTs
    appTs -->|"renders"| components
    components -->|"applies"| indexCss
    components -->|"references"| tsconfig
    components -->|"uses"| eslintConfig
    components -->|"configures"| viteConfig

    %% Triggering CI/CD from Frontend Code
    components -->|"triggers"| azureWorkflow
    components -->|"triggers"| terraformWorkflow

    %% CI/CD Flow connections
    azureWorkflow -->|"deploys via"| deploymentConfig
    dependabot -->|"updates"| azureWorkflow

    %% Terraform integration with CI/CD and Infrastructure
    terraformWorkflow -->|"executes"| mainTf
    terraformWorkflow -->|"executes"| variablesTf
    mainTf -->|"provisions"| provisioned
    variablesTf -->|"provisions"| provisioned
    deploymentConfig -->|"finalizes"| provisioned

    %% Class definitions for color coding
    classDef browser fill:#FBE7C6,stroke:#d62728,stroke-width:2px;
    classDef frontend fill:#EDF8FF,stroke:#1f77b4,stroke-width:2px;
    classDef cicd fill:#FFEDCC,stroke:#ff7f0e,stroke-width:2px;
    classDef infra fill:#E8F5E9,stroke:#2ca02c,stroke-width:2px;

click indexHtml "https://github.com/synguyen98/my-portfolio/blob/master/index.html"
click publicAssets "https://github.com/synguyen98/my-portfolio/tree/master/public/"
click mainTs "https://github.com/synguyen98/my-portfolio/blob/master/src/main.tsx"
click appTs "https://github.com/synguyen98/my-portfolio/blob/master/src/App.tsx"
click components "https://github.com/synguyen98/my-portfolio/tree/master/src/components/"
click indexCss "https://github.com/synguyen98/my-portfolio/blob/master/src/index.css"
click viteConfig "https://github.com/synguyen98/my-portfolio/blob/master/vite.config.ts"
click tsconfig "https://github.com/synguyen98/my-portfolio/blob/master/tsconfig.json"
click eslintConfig "https://github.com/synguyen98/my-portfolio/blob/master/eslint.config.js"
click azureWorkflow "https://github.com/synguyen98/my-portfolio/blob/master/.github/workflows/azure-static-app-deploy.yml"
click terraformWorkflow "https://github.com/synguyen98/my-portfolio/blob/master/.github/workflows/terraform-deploy.yml"
click dependabot "https://github.com/synguyen98/my-portfolio/blob/master/.github/dependabot.yml"
click deploymentConfig "https://github.com/synguyen98/my-portfolio/blob/master/staticwebapp.config.json"
click mainTf "https://github.com/synguyen98/my-portfolio/blob/master/terraform/main.tf"
click variablesTf "https://github.com/synguyen98/my-portfolio/blob/master/terraform/variables.tf"
```
