# scheffchuk/my-site architecture

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

- Interactive diagram: https://gitdiagram.com/scheffchuk/my-site
- Repository: https://github.com/scheffchuk/my-site

## Overview

##### Project type and purpose
- From the file tree, this is a Next.js full-stack application (using the `app` directory convention) that serves a multilingual personal/portfolio website with interactive features (e.g., AI chat and contact form).
- Key indicators:
- `src/app/[locale]/…` folder structure → i18n routing
- `src/app/api/chat/route.ts` → serverless API endpoint (chat)
- `src/actions/sendEmail.ts` → serverless email send action
- `src/lib/astradb.ts` → integration with Astra DB or similar datastore

##### File structure
Top-level files
- .eslintrc.json, .prettierrc, tsconfig.json → code quality and TypeScript config
- next.config.ts, postcss.config.mjs, tailwind.config.ts → Next.js & styling configuration
- package.json, pnpm-lock.yaml → dependencies and package manager

Key directories
- src/app/[locale]/…
– layout.tsx, page.tsx, globals.css → Next.js App Router layout/pages per locale
– api/chat/route.ts → serverless function for AI chat
- src/components → React UI components (header, footer, sections, UI primitives)
- src/actions → “backend” action functions (e.g., sendEmail) invoked on form submits
- src/lib → shared utilities and data clients (Astra DB, hooks, types, utils)
- src/email → email template code for contact form
- src/context → React context providers (active section, theme)
- src/i18n & messages → translation dictionaries and routing/navigation i18n helpers
- scripts/generate.ts → likely codegen for translation or assets

##### README
- (Empty in this case—no additional architectural hints.)

##### Detail level
- Folder’s responsibility (e.g., `src/lib` as Utilities Layer).
- Grouping: UI components vs. context providers vs. API handler code.
- With key files or modules (e.g., route.ts under API).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser
    subgraph "User's Browser"
        Browser["Browser"]:::external
    end

    %% Frontend Layer
    subgraph "Next.js Frontend (App Router + UI)" 
        Router["App Router ([locale] routing)"]:::frontend
        Layout["Global Layout & Styles"]:::frontend
        Page["Locale-specific Page"]:::frontend
        Components["React UI Components"]:::frontend
        UIPrimitives["UI Primitives"]:::frontend
        Contexts["React Context Providers"]:::frontend
        i18nResources["i18n Resources"]:::frontend
    end

    %% Serverless Functions
    subgraph "Serverless Functions"
        ChatAPI["AI Chat API Route"]:::backend
        EmailAction["Contact Form Email Action"]:::backend
    end

    %% Utilities Layer
    subgraph "Utilities Layer"
        AstraClient["Astra DB Client"]:::data
        DataHelpers["Data Helpers"]:::data
        Hooks["Hooks"]:::data
        Types["Types"]:::data
        Utils["Utils"]:::data
    end

    %% Email Templates
    subgraph "Email Templates"
        ContactEmail["Contact Form Email Template"]:::backend
    end

    %% Codegen
    subgraph "Scripts"
        GenerateScript["Code Generation Script"]:::backend
    end

    %% Data Store
    subgraph "Data Layer"
        AstraDB["Astra DB"]:::database
    end

    %% External Services
    subgraph "External Services"
        OpenAI["OpenAI API"]:::external
        EmailProvider["Email Service Provider"]:::external
    end

    %% Connections
    Browser -->|"HTTP GET/SSR/CSR"| Router
    Router -->|"renders"| Layout
    Layout -->|"renders"| Page
    Page -->|"uses"| Components
    Components -->|"uses"| UIPrimitives
    Layout -->|"provides context"| Contexts
    Router -->|"loads translations"| i18nResources

    Components -->|"POST /api/chat"| ChatAPI
    Components -->|"submit contact form"| EmailAction

    ChatAPI -->|"calls"| OpenAI
    ChatAPI -->|"reads/writes"| AstraClient
    EmailAction -->|"uses template"| ContactEmail
    EmailAction -->|"sends via"| EmailProvider

    AstraClient -->|"connects"| AstraDB
    AstraClient -->|"imports helpers"| DataHelpers
    AstraClient -->|"imports hooks"| Hooks
    AstraClient -->|"imports types"| Types
    AstraClient -->|"imports utils"| Utils

    GenerateScript -->|"generates"| i18nResources

    %% Click Events
    click Router "https://github.com/scheffchuk/my-site/tree/master/src/app/[locale]"
    click Layout "https://github.com/scheffchuk/my-site/blob/master/src/app/[locale]/layout.tsx"
    click Layout "https://github.com/scheffchuk/my-site/blob/master/src/app/[locale]/globals.css"
    click Page "https://github.com/scheffchuk/my-site/blob/master/src/app/[locale]/page.tsx"
    click Components "https://github.com/scheffchuk/my-site/tree/master/src/components"
    click UIPrimitives "https://github.com/scheffchuk/my-site/tree/master/src/components/ui"
    click ChatAPI "https://github.com/scheffchuk/my-site/blob/master/src/app/api/chat/route.ts"
    click EmailAction "https://github.com/scheffchuk/my-site/blob/master/src/actions/sendEmail.ts"
    click AstraClient "https://github.com/scheffchuk/my-site/blob/master/src/lib/astradb.ts"
    click DataHelpers "https://github.com/scheffchuk/my-site/blob/master/src/lib/data.ts"
    click Hooks "https://github.com/scheffchuk/my-site/blob/master/src/lib/hooks.ts"
    click Types "https://github.com/scheffchuk/my-site/blob/master/src/lib/types.ts"
    click Utils "https://github.com/scheffchuk/my-site/blob/master/src/lib/utils.ts"
    click ContactEmail "https://github.com/scheffchuk/my-site/blob/master/src/email/contact-form-email.tsx"
    click Contexts "https://github.com/scheffchuk/my-site/blob/master/src/context/active-section-context.tsx"
    click Contexts "https://github.com/scheffchuk/my-site/blob/master/src/context/theme-context.tsx"
    click i18nResources "https://github.com/scheffchuk/my-site/blob/master/messages/en.json"
    click i18nResources "https://github.com/scheffchuk/my-site/blob/master/messages/ja.json"
    click i18nResources "https://github.com/scheffchuk/my-site/blob/master/src/i18n/navigation.ts"
    click i18nResources "https://github.com/scheffchuk/my-site/blob/master/src/i18n/routing.ts"
    click i18nResources "https://github.com/scheffchuk/my-site/blob/master/src/i18n/request.ts"
    click GenerateScript "https://github.com/scheffchuk/my-site/blob/master/scripts/generate.ts"

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef backend fill:#e8eaf6,stroke:#1a237e,color:#0d47a1
    classDef data fill:#fff3e0,stroke:#e65100,color:#bf360c
    classDef database fill:#fff9c4,stroke:#f57f17,color:#ff6f00
    classDef external fill:#fce4ec,stroke:#880e4f,color:#ad1457
```
