# libersoft-org/yellow-os architecture

> Architecture diagram of the GitHub repository libersoft-org/yellow-os, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/libersoft-org/yellow-os
- Repository: https://github.com/libersoft-org/yellow-os

## Overview

1. **High-level shape**
   Yellow OS is a browser-based desktop environment, with the **frontend doing almost all of the real work**. The repo is split into a Svelte UI application and a small Bun backend scaffold. The architecture is therefore **client-heavy**, with the browser acting as the OS runtime and persistent storage layer.

2. **Application shell and entrypoints**
   The frontend uses a **Svelte/SvelteKit-style route structure** (`src/routes/+layout.svelte`, `+page.svelte`, `+layout.ts`) as the top-level shell. `app.html` and `app.css` define the document and global styling. The first-screen experience is a desktop-like UI rather than a conventional website page.

3. **Desktop environment subsystem**
   The core of the product is the desktop shell in `src/components/Desktop`, `Taskbar`, `WindowManager`, `AppSwitcher`, `Statusbar`, `Notification`, `Dialog`, and related pieces. These components form the OS chrome: desktop icons, taskbar/start menu, window controls, virtual desktops, notifications, drag overlays, and modal dialogs. This is the main interaction boundary that all apps plug into.

4. **Windowing and interaction state**
   Window behavior is managed by dedicated client-side logic in `src/scripts/window` and paired window components. This layer handles **window context, resizing, shortcuts, snapping, and window state stores**. It is the coordination layer between app content and the shell, and it is what makes app panes behave like desktop windows instead of ordinary page sections.

5. **App model and registration**
   Individual apps live under `src/apps`, each with its own Svelte component and sometimes companion TypeScript modules. `src/scripts/system/app-registry.ts` suggests a registry-based model for discovering and launching apps. The architecture treats apps as **pluggable modules** that are launched inside the shell rather than as separate routes or pages.

6. **App Player as a special runtime boundary**
   `AppPlayer` is distinct from the built-in apps: it is intended to run **custom apps inside Yellow OS**. The presence of `Doom.yapp`, `app-player-api.ts`, and `app-player.ts` indicates a file/package-based app format with a dedicated API surface. This is an important boundary because it separates first-party shell capabilities from user-provided or externally packaged app logic.

7. **File system and storage layer**
   The file subsystem is centered on **browser OPFS (Origin Private File System)**. The logic in `src/scripts/fs` covers file entries, actions, clipboard, links, downloads, file type handling, conflict resolution, progress reporting, and OPFS initialization/notifications. The storage UI under `src/components/Storage` provides browsing, properties, rename, new item creation, and drive-level dialogs. This is the main persistence layer for files, folders, and user data.

8. **System state and settings**
   Global OS state lives in `src/scripts/system` and is exposed through Svelte stores. This includes **desktop settings, taskbar behavior, notifications, factory reset, product metadata, printing/format helpers**, and system-wide app/session state. The Settings app is split into desktop, notifications, taskbar, and reset sections, mirroring the same system boundaries in the UI.

9. **Shared UI component library**
   The `src/components` tree is a reusable design system for the whole OS: buttons, inputs, lists, toolbars, menus, icons, progress indicators, spinners, breadcrumbs, pie charts, and more. These are not app-specific; they are the **presentation primitives** used by the shell and all bundled applications.

10. **Bundled applications**
   The included apps show the intended OS-like scope: **File Browser**, **File Manager**, **Image Viewer**, **Media Player**, **Text Editor**, **Calculator**, **Pong**, **Snake**, and **About**. Most of these apps are thin UI wrappers over shared shell and file APIs rather than isolated services, which means they rely heavily on the common desktop/window/file subsystems.

11. **Backend boundary**
   The `backend/` directory exists but is explicitly described as **“not used yet”** in the README. It is a Bun application scaffold with its own build script and TypeScript config, but the current architecture does not depend on backend services for core functionality. For diagramming purposes, it should be shown as an inactive/prepared server-side boundary rather than a live dependency.

12. **Build and runtime model**
   The repo is organized as a monorepo with separate frontend/backend package roots, shared Bun tooling, and scripts for building, testing, formatting, and dev startup. The production behavior is primarily a **single-page desktop web app running in the browser**, with browser storage and client-side state managing the OS experience.

Main entry points: [`frontend/src/components/Desktop/Desktop.svelte`](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/Desktop/Desktop.svelte) (Desktop shell), [`frontend/src/components/WindowManager/WindowManager.svelte`](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/WindowManager/WindowManager.svelte) (Window manager), [`frontend/src/components`](https://github.com/libersoft-org/yellow-os/tree/main/frontend/src/components) (Shared UI), [`frontend/src/apps`](https://github.com/libersoft-org/yellow-os/tree/main/frontend/src/apps) (Bundled apps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_routes["App shell<br/>Svelte routes<br/>[+layout.svelte]"]
  node_desktop["Desktop shell<br/>OS chrome<br/>[Desktop.svelte]"]
  node_taskbar["Taskbar<br/>launcher bar<br/>[Taskbar.svelte]"]
  node_windowing["Window manager<br/>windowing"]
  node_appswitcher["App switcher<br/>switcher state"]
  node_apps["Bundled apps<br/>first-party apps"]
  node_appplayer["App Player<br/>custom app runtime<br/>[AppPlayer.svelte]"]
  node_appregistry["App registry<br/>app discovery<br/>[app-registry.ts]"]
  node_filesystem[("File system<br/>OPFS storage<br/>[opfs.ts]")]
  node_storageui["Storage UI<br/>file manager UI"]
  node_settings["Settings<br/>[Settings.svelte]"]
  node_systemstate["System state<br/>global stores<br/>[settings.svelte.ts]"]
  node_sharedui["Shared UI<br/>component library"]
  node_notifications["Notifications<br/>ui state"]
  node_dragstate["Drag state<br/>ui state"]
end

subgraph group_backend["Backend"]
  node_backendapp["Backend app<br/>Bun scaffold<br/>[app.ts]"]
end

node_routes -->|"renders"| node_desktop
node_routes -->|"uses"| node_sharedui
node_desktop -->|"contains"| node_taskbar
node_desktop -->|"hosts"| node_windowing
node_desktop -->|"shows"| node_notifications
node_windowing -->|"coordinates"| node_appswitcher
node_appregistry -->|"launches"| node_apps
node_appregistry -->|"launches"| node_appplayer
node_apps -->|"run in"| node_windowing
node_apps -->|"use"| node_filesystem
node_appplayer -->|"uses"| node_filesystem
node_filesystem -->|"drives"| node_storageui
node_settings -->|"configures"| node_systemstate
node_settings -->|"uses"| node_sharedui
node_storageui -->|"uses"| node_sharedui
node_notifications -->|"uses"| node_sharedui
node_dragstate -->|"supports"| node_windowing
node_backendapp -.->|"not in core flow"| node_routes

click node_routes "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/routes/+layout.svelte"
click node_desktop "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/Desktop/Desktop.svelte"
click node_taskbar "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/Taskbar/Taskbar.svelte"
click node_windowing "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/WindowManager/WindowManager.svelte"
click node_appswitcher "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/system/app-switcher.svelte.ts"
click node_apps "https://github.com/libersoft-org/yellow-os/tree/main/frontend/src/apps"
click node_appplayer "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/apps/AppPlayer/AppPlayer.svelte"
click node_appregistry "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/system/app-registry.ts"
click node_filesystem "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/fs/opfs.ts"
click node_storageui "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/Storage/StorageBrowser.svelte"
click node_settings "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/apps/Settings/Settings.svelte"
click node_systemstate "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/system/settings.svelte.ts"
click node_sharedui "https://github.com/libersoft-org/yellow-os/tree/main/frontend/src/components"
click node_notifications "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/ui/notifications.svelte.ts"
click node_dragstate "https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/ui/drag-state.svelte.ts"
click node_backendapp "https://github.com/libersoft-org/yellow-os/blob/main/backend/src/app.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routes,node_desktop,node_taskbar,node_windowing,node_appswitcher,node_apps,node_appplayer,node_appregistry,node_filesystem,node_storageui,node_settings,node_systemstate,node_sharedui,node_notifications,node_dragstate toneBlue
class node_backendapp toneAmber
```

## Components

### Frontend

Browser-based desktop OS application and shared client logic

- [App shell](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/routes/+layout.svelte): Svelte routes · Top-level browser entry and layout for the desktop experience · `frontend/src/routes/+layout.svelte`
- [Desktop shell](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/Desktop/Desktop.svelte): OS chrome · Desktop, taskbar, statusbar, notifications, and window chrome · `frontend/src/components/Desktop/Desktop.svelte`
- [Taskbar](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/Taskbar/Taskbar.svelte): launcher bar · Taskbar, desktops, clock, and app list · `frontend/src/components/Taskbar/Taskbar.svelte`
- [Window manager](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/WindowManager/WindowManager.svelte): windowing · Window lifecycle, controls, titlebars, shortcuts, resize, and snap behavior · `frontend/src/components/WindowManager/WindowManager.svelte`
- [App switcher](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/system/app-switcher.svelte.ts): switcher state · Tracks running apps and active app switching · `frontend/src/scripts/system/app-switcher.svelte.ts`
- [Bundled apps](https://github.com/libersoft-org/yellow-os/tree/main/frontend/src/apps): first-party apps · Built-in desktop apps launched inside the shell · `frontend/src/apps`
- [App Player](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/apps/AppPlayer/AppPlayer.svelte): custom app runtime · Runs packaged custom apps through a dedicated API boundary · `frontend/src/apps/AppPlayer/AppPlayer.svelte`
- [App registry](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/system/app-registry.ts): app discovery · Registers and launches available apps inside the OS · `frontend/src/scripts/system/app-registry.ts`
- [File system](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/fs/opfs.ts): OPFS storage · Browser file operations, links, downloads, conflicts, and persistence initialization · `frontend/src/scripts/fs/opfs.ts`
- [Storage UI](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/components/Storage/StorageBrowser.svelte): file manager UI · Storage browser, properties, rename, create, and drive dialogs · `frontend/src/components/Storage/StorageBrowser.svelte`
- [Settings](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/apps/Settings/Settings.svelte): system settings · Desktop, notifications, taskbar, and reset configuration screens · `frontend/src/apps/Settings/Settings.svelte`
- [System state](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/system/settings.svelte.ts): global stores · Desktop settings, product metadata, formatting, printing, and reset state · `frontend/src/scripts/system/settings.svelte.ts`
- [Shared UI](https://github.com/libersoft-org/yellow-os/tree/main/frontend/src/components): component library · Reusable buttons, inputs, menus, lists, progress, and layout primitives · `frontend/src/components`
- [Notifications](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/ui/notifications.svelte.ts): ui state · Notification stack and dialog interactions · `frontend/src/scripts/ui/notifications.svelte.ts`
- [Drag state](https://github.com/libersoft-org/yellow-os/blob/main/frontend/src/scripts/ui/drag-state.svelte.ts): ui state · Pointer gestures, selection, and drag overlays used across the shell · `frontend/src/scripts/ui/drag-state.svelte.ts`

### Backend

Prepared Bun server scaffold, currently not used by the core app

- [Backend app](https://github.com/libersoft-org/yellow-os/blob/main/backend/src/app.ts): Bun scaffold · Server-side entrypoint present but not used by the current product flow · `backend/src/app.ts`

## Connections

- App shell → Desktop shell: renders · The app shell mounts the desktop experience
- App shell → Shared UI: uses · Global UI primitives are used throughout the shell
- Desktop shell → Taskbar: contains · Desktop shell includes the taskbar and related chrome
- Desktop shell → Window manager: hosts · Desktop coordinates window placement and controls
- Desktop shell → Notifications: shows · Desktop surfaces notifications and dialogs
- Window manager → App switcher: coordinates · Window manager participates in app activation and switching
- App registry → Bundled apps: launches · Registry resolves and starts bundled applications
- App registry → App Player: launches · Registry also exposes the custom app runtime
- Bundled apps → Window manager: run in · Bundled apps live inside managed windows
- Bundled apps → File system: use · Many apps depend on browser file and storage APIs
- App Player → File system: uses · Custom apps can access storage through the app runtime boundary
- File system → Storage UI: drives · File operations power the storage browsing and editing UI
- Settings → System state: configures · Settings screens update shared OS state
- Settings → Shared UI: uses · Settings is built from common UI primitives
- Storage UI → Shared UI: uses · Storage tools are assembled from shared components
- Notifications → Shared UI: uses · Notification presentation relies on shared UI pieces
- Drag state → Window manager: supports · Drag and selection state feeds window interactions
- Backend app → App shell: not in core flow · Backend scaffold exists but is not part of the main runtime path
