# imattdunbar/dunbar-web architecture

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

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

## Overview

##### Main Components

a) Client-Side Layer:
- Components for:
- SvelteKit Frontend Runtime
- Static Assets (PDF, Images)
- Client-side Utilities (/src/lib/util/client.ts)

b) Application Layer:
- Sub-components:
- Router (based on /src/routes structure)
- Layout Management (/src/routes/+layout)
- Page Components
- Shared Components (/src/lib/components)
- Server Hooks (/src/hooks.server.ts)

c) Data Layer:
- Include:
- Static JSON Data (/src/lib/data/portfolio.json)
- Data Utilities (/src/lib/util/data.ts)

d) Build/Configuration Layer:
- Configuration components:
- Vite Build System
- Tailwind CSS
- TypeScript Compilation

##### Relationship Flows

- Client requests flowing through the router
- Component composition and hierarchy
- Data flow from portfolio.json to components
- Static asset serving paths
- Build process flow

##### Specific Implementation Details

- Route Structure:
- Main page route
- Dynamic [page=main] route
- Error handling (+error.svelte)
- Component Architecture:
- Card.svelte
- Entry.svelte
- Layout hierarchy

##### Technical Stack Indicators

Technology badges or labels for:
- SvelteKit
- TypeScript
- Tailwind CSS
- Vite
- Bun (indicated by bun.lockb)

##### Important Notes

a) SvelteKit-specific architecture:
- Distinction between server and client components
- Routing system
- Where SSR occurs

b) Build-time vs runtime separation:
- How Tailwind processes CSS
- TypeScript compilation flow
- Static asset handling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Client Browser"]
        ClientRuntime["SvelteKit Frontend Runtime"]:::client
        ClientUtils["Client-Side Utilities"]:::client
        StaticAssets["Static Assets"]:::static
    end

    subgraph "SvelteKit Application"
        Router["Router"]:::app
        Layout["Layout Management"]:::app
        Pages["Page Components"]:::app
        SharedComp["Shared Components"]:::app
        ServerHooks["Server Hooks"]:::server
        ErrorHandler["Error Handling"]:::app
        ParamHandler["Parameter Handler"]:::app
        AppTemplate["Main App Template"]:::app
    end

    subgraph "Data Layer"
        PortfolioData["Portfolio JSON"]:::data
        DataUtils["Data Utilities"]:::data
    end

    subgraph "Build Configuration"
        Vite["Vite Config"]:::config
        Tailwind["Tailwind CSS Config"]:::config
        TypeScript["TypeScript Config"]:::config
        SvelteConfig["Svelte Config"]:::config
        GlobalStyles["Global Styles"]:::config
    end

    Browser --> ClientRuntime
    ClientRuntime --> Router
    Router --> Layout
    Router --> Pages
    Router --> ErrorHandler
    Layout --> SharedComp
    Pages --> SharedComp
    Pages --> ParamHandler
    ParamHandler --> DataUtils
    DataUtils --> PortfolioData
    ServerHooks --> Router
    ClientUtils --> Pages
    StaticAssets --> Browser

    Vite --> ClientRuntime
    Tailwind --> GlobalStyles
    TypeScript --> ClientRuntime
    SvelteConfig --> ClientRuntime
    GlobalStyles --> Layout

    %% Click Events
    click ClientUtils "https://github.com/imattdunbar/dunbar-web/blob/main/src/lib/util/client.ts"
    click StaticAssets "https://github.com/imattdunbar/dunbar-web/tree/main/static"
    click ServerHooks "https://github.com/imattdunbar/dunbar-web/blob/main/src/hooks.server.ts"
    click Layout "https://github.com/imattdunbar/dunbar-web/blob/main/src/routes/+layout.svelte"
    click SharedComp "https://github.com/imattdunbar/dunbar-web/tree/main/src/lib/components"
    click PortfolioData "https://github.com/imattdunbar/dunbar-web/blob/main/src/lib/data/portfolio.json"
    click DataUtils "https://github.com/imattdunbar/dunbar-web/blob/main/src/lib/util/data.ts"
    click Router "https://github.com/imattdunbar/dunbar-web/tree/main/src/routes"
    click GlobalStyles "https://github.com/imattdunbar/dunbar-web/blob/main/src/lib/styles/global.css"
    click Vite "https://github.com/imattdunbar/dunbar-web/blob/main/vite.config.ts"
    click Tailwind "https://github.com/imattdunbar/dunbar-web/blob/main/tailwind.config.js"
    click TypeScript "https://github.com/imattdunbar/dunbar-web/blob/main/tsconfig.json"
    click SvelteConfig "https://github.com/imattdunbar/dunbar-web/blob/main/svelte.config.js"
    click ParamHandler "https://github.com/imattdunbar/dunbar-web/blob/main/src/params/main.ts"
    click ErrorHandler "https://github.com/imattdunbar/dunbar-web/blob/main/src/routes/+error.svelte"
    click AppTemplate "https://github.com/imattdunbar/dunbar-web/blob/main/src/app.html"

    %% Styling
    classDef client fill:#2196F3,color:white
    classDef server fill:#4CAF50,color:white
    classDef app fill:#9C27B0,color:white
    classDef data fill:#FFC107,color:black
    classDef config fill:#607D8B,color:white
    classDef static fill:#FF5722,color:white

    %% Legend
    subgraph Legend
        L1["Client-Side"]:::client
        L2["Server-Side"]:::server
        L3["Application"]:::app
        L4["Data"]:::data
        L5["Configuration"]:::config
        L6["Static Assets"]:::static
    end
```
