# kafi350/portfolio-svelte architecture

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

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

## Overview

##### Project type and purpose
- This is a **single-page portfolio web app** built with **SvelteKit** and deployed as a **static site**.
- It serves personal data (projects, bio, interests) from a local data module and integrates with **EmailJS** for the contact form.

##### File structure
- **src/**
- app.html – HTML template
- data/data.js – portfolio content (bio, projects)
- lib/components – reusable Svelte UI components (Header, Footer, ProjectCard, etc.)
- routes – SvelteKit pages (+layout.svelte, +page.svelte, and per-route pages: about, contact, interests)
- styles/global.css – global styling
- **static/** – fonts and photos served as-is
- **config files** – svelte.config.js, vite.config.js, vercel.json for build & deployment
- **package.json** & **eslint.config.js** – dependencies and linting rules

##### README for additional insights
- Uses **Node.js + npm** for local development & build
- Run `npm run dev` for SvelteKit’s dev server
- Data customization via data.js
- EmailJS keys configured via environment variables

##### Main components
a. **Developer Machine** (local dev)
- Source code in Git repository
- npm / SvelteKit CLI
b. **CI/CD Pipeline / Hosting**
- GitHub (code storage) → Vercel (build & deploy)
- Vercel runs `npm run build`, outputs static assets
- CDN distributes content globally
c. **Client Browser**
- Requests HTML/CSS/JS from the CDN/Vercel
- Renders static site
- Loads data.js at runtime or build time (depending on SSG vs SSR configuration)
d. **External Service**
- EmailJS API for sending contact-form emails
e. **Static Assets**
- Fonts and photos served from the static folder via CDN

##### Relationships and data flows
- **Developer → GitHub** (code commit)

##### Architectural patterns & design principles
- **Component-based UI**: small, reusable Svelte components under lib/components
- **File-based routing**: SvelteKit’s routes directory
- **Static-first deployment**: leverage SSG / CDN for performance
- **Separation of concerns**: data.js for content, .env for secrets, components for UI

##### Technologies & frameworks
- **Frontend**: SvelteKit, Vite
- **Styling**: CSS (global.css)
- **Hosting**: Vercel + CDN
- **External API**: EmailJS
- **Build tools**: Node.js, npm

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Local Development Environment
    subgraph "Local Development Environment"
        direction TB
        DevRoot["Root Directory"]:::dev
        DataModule["data/data.js"]:::dev
        HTMLTemplate["src/app.html"]:::dev
        UIComponents["UI Component Library"]:::dev
        Routing["File-based Routing"]:::dev
        GlobalStyle["src/styles/global.css"]:::dev
        StaticFonts["static/fonts/"]:::dev
        StaticPhotos["static/photos/"]:::dev
        SvelteConfig["svelte.config.js"]:::dev
        ViteConfig["vite.config.js"]:::dev
        VercelJson["vercel.json"]:::dev
        PackageJSON["package.json"]:::dev
        ESLintConfig["eslint.config.js"]:::dev
    end

    %% Version Control and CI/CD
    DevRoot -->|git push| GitHub["GitHub Repo"]:::dev
    GitHub -->|trigger build| Vercel["Vercel (Build & Deploy)"]:::hosting

    %% CDN Distribution
    subgraph "Hosting & CDN"
        direction TB
        Vercel
        CDN["Global CDN"]:::hosting
    end
    Vercel -->|deploy static assets| CDN

    %% Client Interaction
    CDN -->|HTTP GET: HTML/CSS/JS/Assets| Client["Client Browser"]:::client
    Client -->|POST: EmailJS API call| EmailJS["EmailJS API"]:::external

    %% Click Events
    click DevRoot "https://github.com/kafi350/portfolio-svelte/blob/main/."
    click DataModule "https://github.com/kafi350/portfolio-svelte/blob/main/src/data/data.js"
    click HTMLTemplate "https://github.com/kafi350/portfolio-svelte/blob/main/src/app.html"
    click UIComponents "https://github.com/kafi350/portfolio-svelte/tree/main/src/lib/components/"
    click Routing "https://github.com/kafi350/portfolio-svelte/blob/main/src/routes/+layout.svelte"
    click GlobalStyle "https://github.com/kafi350/portfolio-svelte/blob/main/src/styles/global.css"
    click StaticFonts "https://github.com/kafi350/portfolio-svelte/tree/main/static/fonts/"
    click StaticPhotos "https://github.com/kafi350/portfolio-svelte/tree/main/static/photos/"
    click SvelteConfig "https://github.com/kafi350/portfolio-svelte/blob/main/svelte.config.js"
    click ViteConfig "https://github.com/kafi350/portfolio-svelte/blob/main/vite.config.js"
    click VercelJson "https://github.com/kafi350/portfolio-svelte/blob/main/vercel.json"
    click PackageJSON "https://github.com/kafi350/portfolio-svelte/blob/main/package.json"
    click ESLintConfig "https://github.com/kafi350/portfolio-svelte/blob/main/eslint.config.js"

    %% Styles
    classDef dev fill:#D0E7FF,stroke:#004A99,color:#000
    classDef hosting fill:#D0FFD0,stroke:#009900,color:#000
    classDef client fill:#FFE7B2,stroke:#CC7700,color:#000
    classDef external fill:#FFD0D0,stroke:#CC0000,color:#000
```
