# shorteditor/drift architecture

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

- Interactive diagram: https://gitdiagram.com/shorteditor/drift
- Repository: https://github.com/shorteditor/drift

## Overview

Drift is a mobile-first music discovery app: users choose a genre, mood, search, or followed-artist feed, browse shuffled catalog tracks, and listen to 30-second previews. App coordinates feed loading, filtering, player state, likes, and navigation. Separate branches provide lyrics, listening links, artist follows, story sharing, and APK downloads. Catalog access spans browser adapters and same-origin Vercel relays; likes and preferences use local storage or optional Firebase. The graph reflects documented capabilities, but some relay and UI internals were not excerpted.

Main entry points: [`src/App.tsx`](https://github.com/shorteditor/drift/blob/main/src/App.tsx) (App coordinator), [`src/components/SongCard.tsx`](https://github.com/shorteditor/drift/blob/main/src/components/SongCard.tsx) (Track card), [`src/api/deezer.ts`](https://github.com/shorteditor/drift/blob/main/src/api/deezer.ts) (Deezer adapter), [`src/components/LikedList.tsx`](https://github.com/shorteditor/drift/blob/main/src/components/LikedList.tsx) (Liked tracks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["App coordinator<br/>[App.tsx]"]
  node_picker["Discovery picker<br/>[Picker.tsx]"]
  node_card["Track card<br/>[SongCard.tsx]"]
  node_likedlist["Liked tracks<br/>[LikedList.tsx]"]
  node_artists["Artist browser<br/>[Artists.tsx]"]
  node_listenlinks["Listening links<br/>[ListenLinks.tsx]"]
  node_lyrics["Preview lyrics<br/>[Lyrics.tsx]"]
end

subgraph group_discovery["Catalog discovery"]
  node_deezer["Deezer adapter<br/>[deezer.ts]"]
  node_catalog["Catalog mapping<br/>[catalog.ts]"]
  node_transport["Catalog transport<br/>[transport.ts]"]
  node_jsonp["JSONP transport<br/>[jsonp.ts]"]
  node_pool["Track pool<br/>[pool.ts]"]
  node_relay["Catalog relay<br/>[catalog.js]"]
  node_router["Source router<br/>[router.js]"]
end

subgraph group_playback["Preview experience"]
  node_audio["Audio controller<br/>[controller.ts]"]
  node_highlight["Highlight analysis<br/>[highlight.ts]"]
end

subgraph group_state["Saved state"]
  node_likes[("Likes store<br/>[store.ts]")]
  node_firebase["Firebase likes<br/>[firebase.ts]"]
  node_follows[("Follow store<br/>[store.ts]")]
end

subgraph group_platform["Platform services"]
  node_previewrelay["Preview relay<br/>[preview-audio.js]"]
  node_listenrelay["Listen-link relay<br/>[listen-links.js]"]
  node_download["APK download<br/>[DownloadApp.tsx]"]
  node_shareplugin["Android sharing"]
end

node_user(("Listener"))
node_deezer_service["Deezer catalog"]
node_jamendo_service["Jamendo catalog"]
node_firebase_service[("Firebase")]
node_preview_service["Preview source"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_picker
node_app -->|"loads tracks"| node_catalog
node_app -->|"loads genres"| node_deezer
node_app -->|"deduplicates"| node_pool
node_app -->|"controls playback"| node_audio
node_app -->|"analyzes preview"| node_highlight
node_app -->|"loads and saves"| node_likes
node_app -->|"creates store"| node_firebase
node_app -->|"reads and writes"| node_follows
node_app -->|"renders tracks"| node_card
node_app -->|"shows saved tracks"| node_likedlist
node_app -->|"shows artists"| node_artists
node_card -->|"renders"| node_listenlinks
node_card -->|"renders"| node_lyrics
node_likedlist -->|"renders"| node_listenlinks
node_likedlist -->|"resolves metadata"| node_catalog
node_artists -->|"searches artists"| node_deezer
node_artists -->|"reads follows"| node_follows
node_catalog -->|"requests tracks"| node_deezer
node_deezer -->|"sends requests"| node_transport
node_transport -->|"dispatches requests"| node_jsonp
node_pool -.->|"supplies feed"| node_user
node_app -->|"checks catalog status"| node_relay
node_relay -->|"routes catalog"| node_router
node_router -->|"queries provider"| node_deezer_service
node_router -->|"queries provider"| node_jamendo_service
node_app -->|"requests highlight audio"| node_previewrelay
node_previewrelay -->|"fetches preview"| node_preview_service
node_app -.->|"provides listen links"| node_listenrelay
node_firebase -->|"stores likes"| node_firebase_service
node_app -->|"offers APK"| node_download
node_card -->|"saves story card"| node_shareplugin
node_audio -->|"uses cached highlight"| node_highlight

click node_app "https://github.com/shorteditor/drift/blob/main/src/App.tsx"
click node_picker "https://github.com/shorteditor/drift/blob/main/src/components/Picker.tsx"
click node_card "https://github.com/shorteditor/drift/blob/main/src/components/SongCard.tsx"
click node_likedlist "https://github.com/shorteditor/drift/blob/main/src/components/LikedList.tsx"
click node_artists "https://github.com/shorteditor/drift/blob/main/src/components/Artists.tsx"
click node_listenlinks "https://github.com/shorteditor/drift/blob/main/src/components/ListenLinks.tsx"
click node_lyrics "https://github.com/shorteditor/drift/blob/main/src/components/Lyrics.tsx"
click node_deezer "https://github.com/shorteditor/drift/blob/main/src/api/deezer.ts"
click node_catalog "https://github.com/shorteditor/drift/blob/main/src/api/catalog.ts"
click node_transport "https://github.com/shorteditor/drift/blob/main/src/api/transport.ts"
click node_jsonp "https://github.com/shorteditor/drift/blob/main/src/api/jsonp.ts"
click node_pool "https://github.com/shorteditor/drift/blob/main/src/feed/pool.ts"
click node_relay "https://github.com/shorteditor/drift/blob/main/api/catalog.js"
click node_router "https://github.com/shorteditor/drift/blob/main/api/lib/router.js"
click node_audio "https://github.com/shorteditor/drift/blob/main/src/audio/controller.ts"
click node_highlight "https://github.com/shorteditor/drift/blob/main/src/audio/highlight.ts"
click node_likes "https://github.com/shorteditor/drift/blob/main/src/likes/store.ts"
click node_firebase "https://github.com/shorteditor/drift/blob/main/src/likes/firebase.ts"
click node_follows "https://github.com/shorteditor/drift/blob/main/src/follows/store.ts"
click node_previewrelay "https://github.com/shorteditor/drift/blob/main/api/preview-audio.js"
click node_listenrelay "https://github.com/shorteditor/drift/blob/main/api/listen-links.js"
click node_download "https://github.com/shorteditor/drift/blob/main/src/components/DownloadApp.tsx"
click node_shareplugin "https://github.com/shorteditor/drift/blob/main/android/app/src/main/java/app/drift/music/DriftSharePlugin.java"

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_app,node_picker,node_card,node_likedlist,node_artists,node_listenlinks,node_lyrics,node_preview_service toneBlue
class node_deezer,node_catalog,node_transport,node_jsonp,node_pool,node_relay,node_router,node_firebase_service toneAmber
class node_audio,node_highlight toneMint
class node_likes,node_firebase,node_follows toneRose
class node_previewrelay,node_listenrelay,node_download,node_shareplugin,node_user,node_deezer_service,node_jamendo_service toneIndigo
```

## Components

### App experience

- [App coordinator](https://github.com/shorteditor/drift/blob/main/src/App.tsx): `src/App.tsx`
- [Discovery picker](https://github.com/shorteditor/drift/blob/main/src/components/Picker.tsx): `src/components/Picker.tsx`
- [Track card](https://github.com/shorteditor/drift/blob/main/src/components/SongCard.tsx): `src/components/SongCard.tsx`
- [Liked tracks](https://github.com/shorteditor/drift/blob/main/src/components/LikedList.tsx): `src/components/LikedList.tsx`
- [Artist browser](https://github.com/shorteditor/drift/blob/main/src/components/Artists.tsx): `src/components/Artists.tsx`
- [Listening links](https://github.com/shorteditor/drift/blob/main/src/components/ListenLinks.tsx): `src/components/ListenLinks.tsx`
- [Preview lyrics](https://github.com/shorteditor/drift/blob/main/src/components/Lyrics.tsx): `src/components/Lyrics.tsx`

### Catalog discovery

- [Deezer adapter](https://github.com/shorteditor/drift/blob/main/src/api/deezer.ts): `src/api/deezer.ts`
- [Catalog mapping](https://github.com/shorteditor/drift/blob/main/src/api/catalog.ts): `src/api/catalog.ts`
- [Catalog transport](https://github.com/shorteditor/drift/blob/main/src/api/transport.ts): `src/api/transport.ts`
- [JSONP transport](https://github.com/shorteditor/drift/blob/main/src/api/jsonp.ts): `src/api/jsonp.ts`
- [Track pool](https://github.com/shorteditor/drift/blob/main/src/feed/pool.ts): `src/feed/pool.ts`
- [Catalog relay](https://github.com/shorteditor/drift/blob/main/api/catalog.js): `api/catalog.js`
- [Source router](https://github.com/shorteditor/drift/blob/main/api/lib/router.js): `api/lib/router.js`

### Preview experience

- [Audio controller](https://github.com/shorteditor/drift/blob/main/src/audio/controller.ts): `src/audio/controller.ts`
- [Highlight analysis](https://github.com/shorteditor/drift/blob/main/src/audio/highlight.ts): `src/audio/highlight.ts`

### Saved state

- [Likes store](https://github.com/shorteditor/drift/blob/main/src/likes/store.ts): `src/likes/store.ts`
- [Firebase likes](https://github.com/shorteditor/drift/blob/main/src/likes/firebase.ts): `src/likes/firebase.ts`
- [Follow store](https://github.com/shorteditor/drift/blob/main/src/follows/store.ts): `src/follows/store.ts`

### Platform services

- [Preview relay](https://github.com/shorteditor/drift/blob/main/api/preview-audio.js): `api/preview-audio.js`
- [Listen-link relay](https://github.com/shorteditor/drift/blob/main/api/listen-links.js): `api/listen-links.js`
- [APK download](https://github.com/shorteditor/drift/blob/main/src/components/DownloadApp.tsx): `src/components/DownloadApp.tsx`
- [Android sharing](https://github.com/shorteditor/drift/blob/main/android/app/src/main/java/app/drift/music/DriftSharePlugin.java): `android/app/src/main/java/app/drift/music/DriftSharePlugin.java`

### Other components

- **Listener**
- **Deezer catalog**
- **Jamendo catalog**
- **Firebase**
- **Preview source**

## Connections

- Listener → App coordinator: uses
- App coordinator → Discovery picker: renders (evidence: `src/App.tsx`)
- App coordinator → Catalog mapping: loads tracks (evidence: `src/App.tsx`)
- App coordinator → Deezer adapter: loads genres (evidence: `src/App.tsx`)
- App coordinator → Track pool: deduplicates (evidence: `src/App.tsx`)
- App coordinator → Audio controller: controls playback (evidence: `src/App.tsx`)
- App coordinator → Highlight analysis: analyzes preview (evidence: `src/App.tsx`)
- App coordinator → Likes store: loads and saves (evidence: `src/App.tsx`)
- App coordinator → Firebase likes: creates store (evidence: `src/App.tsx`)
- App coordinator → Follow store: reads and writes (evidence: `src/App.tsx`)
- App coordinator → Track card: renders tracks (evidence: `src/App.tsx`)
- App coordinator → Liked tracks: shows saved tracks (evidence: `src/App.tsx`)
- App coordinator → Artist browser: shows artists (evidence: `src/App.tsx`)
- Track card → Listening links: renders (evidence: `src/components/SongCard.tsx`)
- Track card → Preview lyrics: renders (evidence: `src/components/SongCard.tsx`)
- Liked tracks → Listening links: renders (evidence: `src/components/LikedList.tsx`)
- Liked tracks → Catalog mapping: resolves metadata (evidence: `src/components/LikedList.tsx`)
- Artist browser → Deezer adapter: searches artists (evidence: `src/components/Artists.tsx`)
- Artist browser → Follow store: reads follows (evidence: `src/components/Artists.tsx`)
- Catalog mapping → Deezer adapter: requests tracks (evidence: `src/api/catalog.ts`)
- Deezer adapter → Catalog transport: sends requests (evidence: `src/api/deezer.ts`)
- Catalog transport → JSONP transport: dispatches requests (evidence: `src/api/transport.ts`)
- Track pool → Listener: supplies feed
- App coordinator → Catalog relay: checks catalog status (evidence: `src/App.tsx`)
- Catalog relay → Source router: routes catalog (evidence: `api/catalog.js`)
- Source router → Deezer catalog: queries provider
- Source router → Jamendo catalog: queries provider
- App coordinator → Preview relay: requests highlight audio
- Preview relay → Preview source: fetches preview
- App coordinator → Listen-link relay: provides listen links
- Firebase likes → Firebase: stores likes
- App coordinator → APK download: offers APK (evidence: `src/App.tsx`)
- Track card → Android sharing: saves story card (evidence: `src/components/SongCard.tsx`)
- Audio controller → Highlight analysis: uses cached highlight (evidence: `src/audio/controller.ts`)
