# bryan-cheong/bryan-portfolio architecture

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

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

## Overview

##### Project Type and Purpose
- This is a frontend-focused, component-based web application built with SvelteKit (initialized via the `sv` CLI).
- Its purpose is to render a personal portfolio/resume site, with pages like About, Experience, Education, Projects, and static assets (e.g., CV PDF, images).

##### File Structure
- Top-level files and dirs:
- `package.json`, `npmrc`, `eslint.config.js`, `svelte.config.js`, `vite.config.js` – define dependencies, linting, build and server configuration.
- `src/` – the heart of the application:
– `src/routes/` – SvelteKit filesystem-based router:
- `+layout.svelte` / `+layout.js` define shared layout and load-logic.
- `+page.svelte` – the home page entry point.
– `src/components/` – reusable UI components (Header, Footer, TitleSection, EducationList, etc.).
– `src/lib/` – utility modules or shared code.
– `src/app.html` and `src/app.css` – HTML template and global CSS.
- `static/` – assets served as-is (PDFs, images, project attachments).
- Build and Dev Tools:
- Vite dev server (`npm run dev`) for HMR.
- SvelteKit’s adapter and prerender pipeline (`npm run build`).

##### README for Additional Insights
- Confirms it’s scaffolded with `npx sv create`.
- Standard dev/build/preview scripts pointing at SvelteKit + Vite.
- Mentions adapters for deployment targets (e.g., static-site hosting or serverless).

a. Main Components
- Developer Machine
– IDE, Git, CLI tools (`sv`, Node.js, npm/yarn)
– Vite Dev Server
– SvelteKit Compiler/Builder
- Application Layers
– Router Layer (`src/routes`) – maps URLs to Svelte pages
– UI Components (`src/components`)
– Data/Utils (`src/lib`)
- Build Output
– Static HTML/CSS/JS bundles
– Prerendered pages (if configured)
- Static Assets
– PDFs, images under `static/assets`
- Hosting Environment
– CDN or Static-Site Host (e.g., Vercel, Netlify)
– (Optionally) Serverless Functions or Node server if SSR adapter used
- Client (Browser)

b. Relationships & Interactions
– Developer invokes `npm run dev` → Vite serves unbundled modules + HMR
– On build: SvelteKit compiles `.svelte` components → JS/CSS bundles + prerendered HTML
– Hosting serves static files + bundles to the browser
– Browser requests `/` → CDN/host returns HTML → loads JS/CSS → hydrates into a SPA
– Internal navigation uses client-side router to swap pages and fetch assets on-demand

c. Architectural Patterns & Design Principles
– Component-Based Architecture (reusable Svelte components)
– File-based Routing (SvelteKit convention)
– Static-Site Generation / Prerendering (for optimal performance/SEO)
– Separation of Concerns: UI, routing, data/utils, static assets

d. Key Technologies, Frameworks, Libraries
– SvelteKit (SSR/SSG framework)
– Vite (dev server, bundler)
– Node.js (build tool runtime)
– npm/Yarn (dependency manager)

## Diagram (Mermaid)

```mermaid
graph TB

    subgraph "Developer Machine"
        DEV_CLI("CLI Tools (sv, Node.js, npm)"):::dev
        IDE("IDE & Git"):::dev
    end

    subgraph "Development Pipeline"
        VITE_DEV("Vite Dev Server"):::dev
        SVELTE_COMP("SvelteKit Compiler/Builder"):::dev
    end

    subgraph "Build Output"
        BUILD("Build Output<br>Static HTML/CSS/JS Bundles"):::artifact
    end

    subgraph "Application Template"
        HTMLT("HTML Template (app.html)"):::template
        CSS("Global Stylesheet (app.css)"):::template
    end

    subgraph "Configuration Files"
        SVELTE_CFG("SvelteKit Config (svelte.config.js)"):::config
        VITE_CFG("Vite Config (vite.config.js)"):::config
        ESLINT_CFG("ESLint Config (eslint.config.js)"):::config
        PKG("package.json"):::config
    end

    subgraph "Application Layers"
        ROUTER("Router Layer (src/routes/)"):::app
        LAYOUT_COMP("Root Layout Component (+layout.svelte)"):::app
        LAYOUT_LOAD("Layout Load Logic (+layout.js)"):::app
        HOME("Home Page Component (+page.svelte)"):::app

        subgraph "UI Components"
            ABOUT("About Section"):::ui
            BTN("Button"):::ui
            EDULIST("Education List"):::ui
            EXPLIST("Experience List"):::ui
            FOOTER("Footer"):::ui
            HEADER("Header"):::ui
            INTEREST("Interests Section"):::ui
            INTRO("Intro Section"):::ui
            MAINWRAP("Main Wrapper"):::ui
            PROJLIST("Project List"):::ui
            STICKY("Sticky Title Section"):::ui
            TITLE("Title Section"):::ui
            UNDERLINK("Underline Link"):::ui
        end

        UTILS("Utility Modules (src/lib/index.js)"):::app
    end

    subgraph "Static Assets"
        ASSETS("static/assets/"):::static
        PDF("CVs & PDFs"):::static
        PROJ_ASSETS("Project Attachments"):::static
    end

    subgraph "Hosting & CDN"
        HOST("Static-Site Host/CDN"):::host
        SERVERLESS("Serverless Functions (optional)"):::host
    end

    BROWSER("Browser (Client)"):::client

    %% Development flow
    DEV_CLI --> VITE_DEV
    IDE --> VITE_DEV
    VITE_DEV --> SVELTE_COMP

    %% Build flow
    SVELTE_COMP --> BUILD
    HTMLT --> BUILD
    CSS --> BUILD
    BUILD --> HOST

    %% Config influences
    SVELTE_CFG --> SVELTE_COMP
    VITE_CFG --> VITE_DEV
    ESLINT_CFG --> DEV_CLI
    PKG --> DEV_CLI

    %% Application Layers flow
    ROUTER --> LAYOUT_COMP
    LAYOUT_COMP --> LAYOUT_LOAD
    ROUTER --> HOME
    HOME -->|uses| ABOUT
    HOME --> BTN
    HOME --> EDULIST
    HOME --> EXPLIST
    HOME --> FOOTER
    HOME --> HEADER
    HOME --> INTEREST
    HOME --> INTRO
    HOME --> MAINWRAP
    HOME --> PROJLIST
    HOME --> STICKY
    HOME --> TITLE
    HOME --> UNDERLINK
    HOME --> UTILS

    %% Assets flow
    ASSETS --> PDF
    ASSETS --> PROJ_ASSETS
    HOST --> ASSETS

    %% Hosting to client
    HOST -->|GET /index.html| BROWSER
    BROWSER -->|Client-side Navigation| ROUTER

    %% Optional serverless
    HOST --> SERVERLESS

    %% Click Events
    click ROUTER "https://github.com/bryan-cheong/bryan-portfolio/tree/main/src/routes/"
    click LAYOUT_COMP "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/routes/+layout.svelte"
    click LAYOUT_LOAD "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/routes/+layout.js"
    click HOME "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/routes/+page.svelte"
    click ABOUT "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/About.svelte"
    click BTN "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/Button.svelte"
    click EDULIST "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/EducationList.svelte"
    click EXPLIST "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/ExperienceList.svelte"
    click FOOTER "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/Footer.svelte"
    click HEADER "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/Header.svelte"
    click INTEREST "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/Interests.svelte"
    click INTRO "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/Intro.svelte"
    click MAINWRAP "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/Main.svelte"
    click PROJLIST "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/ProjectList.svelte"
    click STICKY "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/StickyTitleSection.svelte"
    click TITLE "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/TitleSection.svelte"
    click UNDERLINK "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/components/UnderLineLink.svelte"
    click UTILS "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/lib/index.js"
    click HTMLT "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/app.html"
    click CSS "https://github.com/bryan-cheong/bryan-portfolio/blob/main/src/app.css"
    click SVELTE_CFG "https://github.com/bryan-cheong/bryan-portfolio/blob/main/svelte.config.js"
    click VITE_CFG "https://github.com/bryan-cheong/bryan-portfolio/blob/main/vite.config.js"
    click ESLINT_CFG "https://github.com/bryan-cheong/bryan-portfolio/blob/main/eslint.config.js"
    click PKG "https://github.com/bryan-cheong/bryan-portfolio/blob/main/package.json"

    %% Styles
    classDef dev fill:#D0E8FF,stroke:#0366d6
    classDef app fill:#DFFFE0,stroke:#28a745
    classDef ui fill:#EBF4FF,stroke:#0366d6
    classDef static fill:#F0F0F0,stroke:#777
    classDef host fill:#FFEFD5,stroke:#FF8C00
    classDef client fill:#FFF0F5,stroke:#C71585
    classDef artifact fill:#FFFACD,stroke:#DAA520
    classDef config fill:#E6E6FA,stroke:#9370DB
    classDef template fill:#FAF0E6,stroke:#CD853F
```
