# silentsilas/playground architecture

> Architecture diagram of the GitHub repository silentsilas/playground, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/silentsilas/playground
- Repository: https://github.com/silentsilas/playground

## Overview

##### Main Components

a) Frontend Layer:
- SvelteKit Application
- Main App Routes ((app) directory)
- Legacy Routes ((legacy) directory)
- Editor Route
- Projects Route
- 3D Scene Components (src/lib/components/scenes)
- UI Components (src/lib/components)

b) Server Layer:
- API Routes (/api)
- Poetry Endpoint
- Thoughts Endpoint
- Search Endpoint
- RSS Feeds
- Server-side Routes

c) Data Layer:
- Markdown Posts
- Poetry Collection
- Thoughts Collection
- Vector Embeddings Store
- Static Assets (images, textures)

##### Component Relationships

**[Client Browser] ←→ [SvelteKit Frontend]**
- ↓
**[SvelteKit Frontend] ←→ [Server-Side Routes]**
- ↓
**[Server-Side Routes] ←→ [API Layer]**
- ↓
**[API Layer] ←→ [Data Layer (MD Files + Embeddings)]**

**[Markdown Files] → [Embeddings Generator] → [embeddings.json]**
**[Search Query] → [Vector Search] → [Results]**

**[.md files] → [SvelteKit SSR] → [Rendered Content]**

##### Important Elements to Highlight

- The 3D scene system (World.svelte, Planet.svelte, etc.)
- The search functionality with vector embeddings
- Content management system (poetry and thoughts)
- RSS feed generation
- Theme toggling system

##### Technical Stack Indicators

- SvelteKit
- TypeScript
- Tailwind CSS
- Three.js (implied by 3D components)
- Markdown Processing
- Vector Embeddings

##### Additional Notes

- Separation between app, legacy, and editor routes
- How the static assets are served
- Different content license zones (MIT vs CC BY-NC-SA-4.0)
- Relationship between the editor and content generation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph Frontend
        SK["SvelteKit Application"]
        AppRoutes["Main App Routes"]:::routes
        LegacyRoutes["Legacy Routes"]:::routes
        EditorRoute["Editor Route"]:::routes
        ProjectsRoute["Projects Route"]:::routes
        ThemeToggle["Theme System"]:::component
        Scenes["3D Scene Components"]:::component
        UIComponents["UI Components"]:::component
        World["World Component"]:::component
        Planet["Planet Component"]:::component
        ContentLayouts["Content Layouts"]:::component
    end

    subgraph Server
        SSR["Server-Side Rendering"]
        APILayer["API Layer"]:::api
        RSSFeeds["RSS Feeds"]:::api
        SearchAPI["Search API"]:::api
        PoetryAPI["Poetry API"]:::api
        ThoughtsAPI["Thoughts API"]:::api
    end

    subgraph Data
        MarkdownFiles["Markdown Files"]
        Poetry["Poetry Collection"]:::content
        Thoughts["Thoughts Collection"]:::content
        Embeddings["Vector Embeddings"]:::storage
        StaticAssets["Static Assets"]:::storage
    end

    subgraph Build
        EmbeddingsGen["Embeddings Generator"]
        SearchSystem["Search Implementation"]
    end

    %% Relationships
    Browser <--> SK
    SK --> AppRoutes & LegacyRoutes & EditorRoute & ProjectsRoute
    SK --> Scenes & UIComponents
    Scenes --> World & Planet
    World --> Planet
    SK --> ThemeToggle
    SK --> ContentLayouts
    
    AppRoutes & LegacyRoutes --> SSR
    SSR --> APILayer
    APILayer --> SearchAPI & PoetryAPI & ThoughtsAPI & RSSFeeds
    
    MarkdownFiles --> Poetry & Thoughts
    MarkdownFiles --> EmbeddingsGen
    EmbeddingsGen --> Embeddings
    SearchAPI --> SearchSystem
    SearchSystem --> Embeddings

    %% Click Events
    click AppRoutes "https://github.com/silentsilas/playground/tree/main/src/routes/(app)"
    click LegacyRoutes "https://github.com/silentsilas/playground/tree/main/src/routes/(legacy)"
    click EditorRoute "https://github.com/silentsilas/playground/tree/main/src/routes/editor"
    click ProjectsRoute "https://github.com/silentsilas/playground/tree/main/src/routes/projects"
    click Scenes "https://github.com/silentsilas/playground/tree/main/src/lib/components/scenes"
    click UIComponents "https://github.com/silentsilas/playground/tree/main/src/lib/components"
    click APILayer "https://github.com/silentsilas/playground/tree/main/src/routes/api"
    click RSSFeeds "https://github.com/silentsilas/playground/tree/main/src/routes/(app)/*/rss"
    click Poetry "https://github.com/silentsilas/playground/tree/main/src/posts/poetry"
    click Thoughts "https://github.com/silentsilas/playground/tree/main/src/posts/thoughts"
    click Embeddings "https://github.com/silentsilas/playground/blob/main/src/lib/utils/poetry/embeddings.json"
    click StaticAssets "https://github.com/silentsilas/playground/tree/main/static/imgs"
    click EmbeddingsGen "https://github.com/silentsilas/playground/blob/main/scripts/generate-embeddings.js"
    click SearchSystem "https://github.com/silentsilas/playground/blob/main/src/lib/utils/search.ts"
    click SearchAPI "https://github.com/silentsilas/playground/blob/main/src/routes/api/search/+server.ts"
    click ContentLayouts "https://github.com/silentsilas/playground/blob/main/src/lib/utils/ThoughtsLayout.svelte"
    click World "https://github.com/silentsilas/playground/blob/main/src/lib/components/scenes/app/World.svelte"
    click Planet "https://github.com/silentsilas/playground/blob/main/src/lib/components/scenes/app/Planet.svelte"
    click ThemeToggle "https://github.com/silentsilas/playground/blob/main/src/lib/components/ToggleTheme.svelte"

    %% Styles
    classDef routes fill:#4a9eff,stroke:#333,stroke-width:2px
    classDef component fill:#2d7ae5,stroke:#333,stroke-width:2px
    classDef api fill:#ff6b6b,stroke:#333,stroke-width:2px
    classDef storage fill:#ffd93d,stroke:#333,stroke-width:2px
    classDef content fill:#95d5b2,stroke:#333,stroke-width:2px
```
