# madz405/onet architecture

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

- Interactive diagram: https://gitdiagram.com/madz405/onet
- Repository: https://github.com/madz405/onet

## Overview

KOYEN combines social-media downloading, quick image/text tools, music search and playback, and an AI chat in a Next.js web app. Visitors use the corresponding pages and UI components; server API routes handle requests and contact external providers, keeping those calls off the browser. The graph preserves the documented platform fallbacks and major tool types. Several page and route implementations were not sampled, so some documented capability links are cited to the README rather than inferred from unsampled code.

Main entry points: [`app/api/tools`](https://github.com/madz405/onet/tree/master/app/api/tools) (Tool APIs), [`components/DownloaderSection.js`](https://github.com/madz405/onet/blob/master/components/DownloaderSection.js) (Downloader UI), [`app/api/chat/route.js`](https://github.com/madz405/onet/blob/master/app/api/chat/route.js) (Chat API), [`components/ToolsSection.js`](https://github.com/madz405/onet/blob/master/components/ToolsSection.js) (Tools interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_download_page["Downloader page<br/>[page.js]"]
  node_download_ui["Downloader UI"]
  node_media_result["Media results<br/>[MediaResult.js]"]
  node_photo_lightbox["Photo lightbox<br/>[PhotoLightbox.js]"]
  node_theme_ui["Theme controls<br/>[ThemeSwitcher.js]"]
  node_theme_catalog["Theme catalog<br/>[themes.js]"]
  node_background["Site background<br/>[SiteBackground.js]"]
end

subgraph group_download["Media downloader"]
  node_download_api["Download API<br/>[route.js]"]
  node_scrapers["Platform scrapers"]
  node_platform_catalog["Platform catalog<br/>[platforms.js]"]
  node_fetch_media["Download proxy<br/>[route.js]"]
end

subgraph group_tools["Creative tools"]
  node_tool_page["Tools page<br/>[page.js]"]
  node_tools_ui["Tools interface<br/>[ToolsSection.js]"]
  node_tool_modal["Tool forms<br/>[ToolModal.js]"]
  node_tool_catalog["Tool definitions<br/>[tools.js]"]
  node_tool_routes["Tool APIs"]
  node_image_upload["Image hosting<br/>[uploadImage.js]"]
  node_media_proxy["Media proxy<br/>[proxyMedia.js]"]
end

subgraph group_music["Music"]
  node_music_page["Music page<br/>[page.js]"]
  node_music_ui["Music search<br/>[MusicSection.js]"]
  node_music_api["Music API<br/>[route.js]"]
  node_music_scrapers["Music sources"]
  node_player_state["Player state"]
  node_music_history[("Search history<br/>[musicHistory.js]")]
  node_mini_player["Mini player<br/>[MiniPlayer.js]"]
end

subgraph group_chat["AI chat"]
  node_chat_page["Chat page<br/>[page.js]"]
  node_chat_ui["Chat panel<br/>[ChatPanel.js]"]
  node_chat_api["Chat API<br/>[route.js]"]
  node_chat_persona["Bot persona<br/>[chatPersona.js]"]
end

node_visitor(("Visitor"))
node_gemini["Gemini service"]
node_logic_bell["Logic Bell service"]
node_media_providers["Media providers"]

node_visitor -->|"opens"| node_download_page
node_download_page -.->|"renders"| node_download_ui
node_download_ui -.->|"requests downloads"| node_download_api
node_download_api -->|"dispatches to"| node_scrapers
node_download_ui -.->|"uses platform list"| node_platform_catalog
node_download_ui -.->|"shows results"| node_media_result
node_media_result -->|"opens"| node_photo_lightbox
node_visitor -->|"opens"| node_tool_page
node_tool_page -->|"renders"| node_tools_ui
node_tools_ui -.->|"opens forms"| node_tool_modal
node_tools_ui -.->|"uses definitions"| node_tool_catalog
node_tool_modal -.->|"submits tool request"| node_tool_routes
node_tool_routes -->|"proxies media"| node_media_proxy
node_tool_routes -->|"uploads images"| node_image_upload
node_tool_routes -->|"requests generated media"| node_media_providers
node_tool_routes -->|"uses image processors"| node_scrapers
node_visitor -->|"opens"| node_music_page
node_music_page -->|"renders"| node_music_ui
node_music_ui -.->|"searches tracks"| node_music_api
node_music_api -->|"dispatches to"| node_music_scrapers
node_music_ui -->|"starts playback"| node_player_state
node_player_state -->|"persists history"| node_music_history
node_player_state -->|"feeds player state"| node_mini_player
node_visitor -->|"opens"| node_chat_page
node_chat_page -->|"renders"| node_chat_ui
node_chat_ui -.->|"sends messages"| node_chat_api
node_chat_api -->|"uses prompt"| node_chat_persona
node_chat_api -->|"tries first"| node_logic_bell
node_chat_api -->|"falls back to"| node_gemini
node_theme_ui -->|"reads themes"| node_theme_catalog
node_theme_catalog -.->|"selects background"| node_background

click node_download_page "https://github.com/madz405/onet/blob/master/app/page.js"
click node_download_ui "https://github.com/madz405/onet/blob/master/components/DownloaderSection.js"
click node_media_result "https://github.com/madz405/onet/blob/master/components/MediaResult.js"
click node_photo_lightbox "https://github.com/madz405/onet/blob/master/components/PhotoLightbox.js"
click node_theme_ui "https://github.com/madz405/onet/blob/master/components/ThemeSwitcher.js"
click node_theme_catalog "https://github.com/madz405/onet/blob/master/lib/themes.js"
click node_background "https://github.com/madz405/onet/blob/master/components/SiteBackground.js"
click node_download_api "https://github.com/madz405/onet/blob/master/app/api/download/route.js"
click node_scrapers "https://github.com/madz405/onet/tree/master/lib/scrapers"
click node_platform_catalog "https://github.com/madz405/onet/blob/master/lib/platforms.js"
click node_fetch_media "https://github.com/madz405/onet/blob/master/app/api/fetch-media/route.js"
click node_tool_page "https://github.com/madz405/onet/blob/master/app/tools/page.js"
click node_tools_ui "https://github.com/madz405/onet/blob/master/components/ToolsSection.js"
click node_tool_modal "https://github.com/madz405/onet/blob/master/components/ToolModal.js"
click node_tool_catalog "https://github.com/madz405/onet/blob/master/lib/tools.js"
click node_tool_routes "https://github.com/madz405/onet/tree/master/app/api/tools"
click node_image_upload "https://github.com/madz405/onet/blob/master/lib/uploadImage.js"
click node_media_proxy "https://github.com/madz405/onet/blob/master/lib/proxyMedia.js"
click node_music_page "https://github.com/madz405/onet/blob/master/app/musik/page.js"
click node_music_ui "https://github.com/madz405/onet/blob/master/components/MusicSection.js"
click node_music_api "https://github.com/madz405/onet/blob/master/app/api/music/route.js"
click node_music_scrapers "https://github.com/madz405/onet/tree/master/lib/scrapers"
click node_player_state "https://github.com/madz405/onet/blob/master/components/MusicPlayerProvider.js"
click node_music_history "https://github.com/madz405/onet/blob/master/lib/musicHistory.js"
click node_mini_player "https://github.com/madz405/onet/blob/master/components/MiniPlayer.js"
click node_chat_page "https://github.com/madz405/onet/blob/master/app/chat/page.js"
click node_chat_ui "https://github.com/madz405/onet/blob/master/components/ChatPanel.js"
click node_chat_api "https://github.com/madz405/onet/blob/master/app/api/chat/route.js"
click node_chat_persona "https://github.com/madz405/onet/blob/master/lib/chatPersona.js"

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_download_page,node_download_ui,node_media_result,node_photo_lightbox,node_theme_ui,node_theme_catalog,node_background toneBlue
class node_download_api,node_scrapers,node_platform_catalog,node_fetch_media toneAmber
class node_tool_page,node_tools_ui,node_tool_modal,node_tool_catalog,node_tool_routes,node_image_upload,node_media_proxy toneMint
class node_music_page,node_music_ui,node_music_api,node_music_scrapers,node_player_state,node_music_history,node_mini_player toneRose
class node_chat_page,node_chat_ui,node_chat_api,node_chat_persona,node_visitor,node_gemini,node_logic_bell,node_media_providers toneIndigo
```

## Components

### Web experience

- [Downloader page](https://github.com/madz405/onet/blob/master/app/page.js): `app/page.js`
- [Downloader UI](https://github.com/madz405/onet/blob/master/components/DownloaderSection.js): `components/DownloaderSection.js`
- [Media results](https://github.com/madz405/onet/blob/master/components/MediaResult.js): `components/MediaResult.js`
- [Photo lightbox](https://github.com/madz405/onet/blob/master/components/PhotoLightbox.js): `components/PhotoLightbox.js`
- [Theme controls](https://github.com/madz405/onet/blob/master/components/ThemeSwitcher.js): `components/ThemeSwitcher.js`
- [Theme catalog](https://github.com/madz405/onet/blob/master/lib/themes.js): `lib/themes.js`
- [Site background](https://github.com/madz405/onet/blob/master/components/SiteBackground.js): `components/SiteBackground.js`

### Media downloader

- [Download API](https://github.com/madz405/onet/blob/master/app/api/download/route.js): `app/api/download/route.js`
- [Platform scrapers](https://github.com/madz405/onet/tree/master/lib/scrapers): `lib/scrapers`
- [Platform catalog](https://github.com/madz405/onet/blob/master/lib/platforms.js): `lib/platforms.js`
- [Download proxy](https://github.com/madz405/onet/blob/master/app/api/fetch-media/route.js): `app/api/fetch-media/route.js`

### Creative tools

- [Tools page](https://github.com/madz405/onet/blob/master/app/tools/page.js): `app/tools/page.js`
- [Tools interface](https://github.com/madz405/onet/blob/master/components/ToolsSection.js): `components/ToolsSection.js`
- [Tool forms](https://github.com/madz405/onet/blob/master/components/ToolModal.js): `components/ToolModal.js`
- [Tool definitions](https://github.com/madz405/onet/blob/master/lib/tools.js): `lib/tools.js`
- [Tool APIs](https://github.com/madz405/onet/tree/master/app/api/tools): `app/api/tools`
- [Image hosting](https://github.com/madz405/onet/blob/master/lib/uploadImage.js): `lib/uploadImage.js`
- [Media proxy](https://github.com/madz405/onet/blob/master/lib/proxyMedia.js): `lib/proxyMedia.js`

### Music

- [Music page](https://github.com/madz405/onet/blob/master/app/musik/page.js): `app/musik/page.js`
- [Music search](https://github.com/madz405/onet/blob/master/components/MusicSection.js): `components/MusicSection.js`
- [Music API](https://github.com/madz405/onet/blob/master/app/api/music/route.js): `app/api/music/route.js`
- [Music sources](https://github.com/madz405/onet/tree/master/lib/scrapers): `lib/scrapers`
- [Player state](https://github.com/madz405/onet/blob/master/components/MusicPlayerProvider.js): `components/MusicPlayerProvider.js`
- [Search history](https://github.com/madz405/onet/blob/master/lib/musicHistory.js): `lib/musicHistory.js`
- [Mini player](https://github.com/madz405/onet/blob/master/components/MiniPlayer.js): `components/MiniPlayer.js`

### AI chat

- [Chat page](https://github.com/madz405/onet/blob/master/app/chat/page.js): `app/chat/page.js`
- [Chat panel](https://github.com/madz405/onet/blob/master/components/ChatPanel.js): `components/ChatPanel.js`
- [Chat API](https://github.com/madz405/onet/blob/master/app/api/chat/route.js): `app/api/chat/route.js`
- [Bot persona](https://github.com/madz405/onet/blob/master/lib/chatPersona.js): `lib/chatPersona.js`

### Other components

- **Visitor**
- **Gemini service**
- **Logic Bell service**
- **Media providers**

## Connections

- Visitor → Downloader page: opens
- Downloader page → Downloader UI: renders
- Downloader UI → Download API: requests downloads
- Download API → Platform scrapers: dispatches to (evidence: `app/api/download/route.js`)
- Downloader UI → Platform catalog: uses platform list
- Downloader UI → Media results: shows results
- Media results → Photo lightbox: opens (evidence: `components/MediaResult.js`)
- Visitor → Tools page: opens
- Tools page → Tools interface: renders (evidence: `app/tools/page.js`)
- Tools interface → Tool forms: opens forms
- Tools interface → Tool definitions: uses definitions
- Tool forms → Tool APIs: submits tool request
- Tool APIs → Media proxy: proxies media (evidence: `app/api/tools/iqc/route.js`)
- Tool APIs → Image hosting: uploads images (evidence: `app/api/tools/process/route.js`)
- Tool APIs → Media providers: requests generated media (evidence: `app/api/tools/brathd/route.js`)
- Tool APIs → Platform scrapers: uses image processors (evidence: `app/api/tools/process/route.js`)
- Visitor → Music page: opens
- Music page → Music search: renders (evidence: `app/musik/page.js`)
- Music search → Music API: searches tracks
- Music API → Music sources: dispatches to (evidence: `app/api/music/route.js`)
- Music search → Player state: starts playback (evidence: `components/MusicSection.js`)
- Player state → Search history: persists history (evidence: `components/MusicPlayerProvider.js`)
- Player state → Mini player: feeds player state (evidence: `components/MiniPlayer.js`)
- Visitor → Chat page: opens
- Chat page → Chat panel: renders (evidence: `app/chat/page.js`)
- Chat panel → Chat API: sends messages
- Chat API → Bot persona: uses prompt (evidence: `app/api/chat/route.js`)
- Chat API → Logic Bell service: tries first (evidence: `app/api/chat/route.js`)
- Chat API → Gemini service: falls back to (evidence: `app/api/chat/route.js`)
- Theme controls → Theme catalog: reads themes
- Theme catalog → Site background: selects background
