# jpsamuelson/sc-gate-dl architecture

> Architecture diagram of the GitHub repository jpsamuelson/sc-gate-dl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jpsamuelson/sc-gate-dl
- Repository: https://github.com/jpsamuelson/sc-gate-dl

## Overview

sc-gate-dl accepts SoundCloud tracks through a CLI or local Web UI, resolves an unlock gate, performs any required browser-based verification, downloads audio, and prepares a tagged output. The README also documents track search, manual metadata correction, account cleanup, managed-account export, and a SoundCloud userscript. The graph preserves these distinct capabilities; several provider and job internals are represented at module level where source excerpts are incomplete.

Main entry points: [`src/server.ts`](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/server.ts) (HTTP job server), [`src/index.ts`](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/index.ts) (CLI workflow), [`src/browserLaunch.ts`](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/browserLaunch.ts) (Browser launcher), [`src/soundcloud.ts`](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/soundcloud.ts) (SoundCloud client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI workflow<br/>[index.ts]"]
  node_web["Web interface<br/>[App.tsx]"]
end

subgraph group_orchestration["Job orchestration"]
  node_server["HTTP job server<br/>[server.ts]"]
  node_queue["Job queue<br/>[jobQueue.ts]"]
  node_jobstate[("Job state<br/>[jobStore.ts]")]
  node_browser["Browser launcher<br/>[browserLaunch.ts]"]
end

subgraph group_gates["Gate and download"]
  node_hypeddit["Hypeddit gates<br/>[hypeddit.ts]"]
  node_droploud["Droploud gates<br/>[droploud.ts]"]
  node_gaterush["GateRush gates<br/>[gaterush.ts]"]
  node_downloadgater["DownloadGater gates<br/>[downloadgater.ts]"]
  node_stillhype["StillHype gates<br/>[stillhype.ts]"]
  node_pumpyoursound["PumpYourSound gates<br/>[pumpyoursound.ts]"]
  node_mypresskit["MyPressKit gates<br/>[mypresskit.ts]"]
  node_bandcamp["Bandcamp downloads<br/>[bandcampGate.ts]"]
  node_direct["Direct downloads<br/>[directDownload.ts]"]
  node_httpgate["Browserless gates<br/>[hypedditHttp.ts]"]
end

subgraph group_media["Audio and SoundCloud"]
  node_soundcloud["SoundCloud client<br/>[soundcloud.ts]"]
  node_search["Track search<br/>[search.ts]"]
  node_ytdlp["yt-dlp downloads<br/>[ytdlp.ts]"]
  node_audio["Audio processing<br/>[audioProcessor.ts]"]
  node_archive["Archive extraction<br/>[archiveAudio.ts]"]
  node_cleanup["Account cleanup<br/>[downloadCleanup.ts]"]
end

subgraph group_interfaces["Web and account tools"]
  node_userscript["SoundCloud userscript<br/>[sc-gate-dl.user.js]"]
  node_managed["Managed export<br/>[manage-acc.ts]"]
end

node_user(("User"))

node_user -->|"starts download"| node_cli
node_user -->|"uses interface"| node_web
node_cli -->|"fetches track"| node_soundcloud
node_cli -->|"runs gate"| node_hypeddit
node_cli -->|"runs gate"| node_droploud
node_cli -->|"runs gate"| node_gaterush
node_cli -->|"runs gate"| node_downloadgater
node_cli -->|"runs gate"| node_stillhype
node_cli -->|"runs gate"| node_pumpyoursound
node_cli -->|"runs gate"| node_mypresskit
node_cli -->|"runs gate"| node_bandcamp
node_cli -->|"downloads link"| node_direct
node_cli -->|"uses fast path"| node_httpgate
node_server -->|"queues jobs"| node_queue
node_server -->|"updates jobs"| node_jobstate
node_server -->|"serves search"| node_search
node_server -->|"fetches track"| node_soundcloud
node_server -->|"launches browser"| node_browser
node_server -->|"dispatches gate"| node_hypeddit
node_server -->|"downloads file"| node_direct
node_server -->|"processes audio"| node_audio
node_server -->|"extracts archive"| node_archive
node_server -->|"downloads track"| node_ytdlp
node_server -->|"offers cleanup"| node_cleanup
node_server -.->|"serves jobs"| node_web
node_search -->|"searches tracks"| node_soundcloud
node_hypeddit -->|"delegates gate"| node_bandcamp
node_droploud -->|"uses browser"| node_browser
node_gaterush -->|"uses browser"| node_browser
node_downloadgater -->|"uses browser"| node_browser
node_stillhype -->|"uses browser"| node_browser
node_pumpyoursound -->|"uses browser"| node_browser
node_mypresskit -->|"uses browser"| node_browser
node_bandcamp -->|"downloads media"| node_ytdlp
node_direct -->|"may unpack ZIP"| node_archive
node_audio -.->|"gets metadata"| node_soundcloud
node_user -->|"opens panel"| node_userscript
node_managed -->|"exports account data"| node_soundcloud

click node_cli "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/index.ts"
click node_web "https://github.com/jpsamuelson/sc-gate-dl/blob/master/webui/src/components/App.tsx"
click node_server "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/server.ts"
click node_queue "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/jobQueue.ts"
click node_jobstate "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/jobStore.ts"
click node_browser "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/browserLaunch.ts"
click node_hypeddit "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/hypeddit.ts"
click node_droploud "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/droploud.ts"
click node_gaterush "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/gaterush.ts"
click node_downloadgater "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/downloadgater.ts"
click node_stillhype "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/stillhype.ts"
click node_pumpyoursound "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/pumpyoursound.ts"
click node_mypresskit "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/mypresskit.ts"
click node_bandcamp "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/bandcampGate.ts"
click node_direct "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/directDownload.ts"
click node_httpgate "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/hypedditHttp.ts"
click node_soundcloud "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/soundcloud.ts"
click node_search "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/search.ts"
click node_ytdlp "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/ytdlp.ts"
click node_audio "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/audioProcessor.ts"
click node_archive "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/archiveAudio.ts"
click node_cleanup "https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/downloadCleanup.ts"
click node_userscript "https://github.com/jpsamuelson/sc-gate-dl/blob/master/userscript/sc-gate-dl.user.js"
click node_managed "https://github.com/jpsamuelson/sc-gate-dl/blob/master/manage-acc.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_cli,node_web,node_user toneBlue
class node_server,node_queue,node_jobstate,node_browser toneAmber
class node_hypeddit,node_droploud,node_gaterush,node_downloadgater,node_stillhype,node_pumpyoursound,node_mypresskit,node_bandcamp,node_direct,node_httpgate toneMint
class node_soundcloud,node_search,node_ytdlp,node_audio,node_archive,node_cleanup toneRose
class node_userscript,node_managed toneIndigo
```

## Components

### Entry points

- [CLI workflow](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/index.ts): `src/index.ts`
- [Web interface](https://github.com/jpsamuelson/sc-gate-dl/blob/master/webui/src/components/App.tsx): `webui/src/components/App.tsx`

### Job orchestration

- [HTTP job server](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/server.ts): `src/server.ts`
- [Job queue](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/jobQueue.ts): `src/jobQueue.ts`
- [Job state](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/jobStore.ts): `src/jobStore.ts`
- [Browser launcher](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/browserLaunch.ts): `src/browserLaunch.ts`

### Gate and download

- [Hypeddit gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/hypeddit.ts): `src/hypeddit.ts`
- [Droploud gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/droploud.ts): `src/droploud.ts`
- [GateRush gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/gaterush.ts): `src/gaterush.ts`
- [DownloadGater gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/downloadgater.ts): `src/downloadgater.ts`
- [StillHype gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/stillhype.ts): `src/stillhype.ts`
- [PumpYourSound gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/pumpyoursound.ts): `src/pumpyoursound.ts`
- [MyPressKit gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/mypresskit.ts): `src/mypresskit.ts`
- [Bandcamp downloads](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/bandcampGate.ts): `src/bandcampGate.ts`
- [Direct downloads](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/directDownload.ts): `src/directDownload.ts`
- [Browserless gates](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/hypedditHttp.ts): `src/hypedditHttp.ts`

### Audio and SoundCloud

- [SoundCloud client](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/soundcloud.ts): `src/soundcloud.ts`
- [Track search](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/search.ts): `src/search.ts`
- [yt-dlp downloads](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/ytdlp.ts): `src/ytdlp.ts`
- [Audio processing](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/audioProcessor.ts): `src/audioProcessor.ts`
- [Archive extraction](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/archiveAudio.ts): `src/archiveAudio.ts`
- [Account cleanup](https://github.com/jpsamuelson/sc-gate-dl/blob/master/src/downloadCleanup.ts): `src/downloadCleanup.ts`

### Web and account tools

- [SoundCloud userscript](https://github.com/jpsamuelson/sc-gate-dl/blob/master/userscript/sc-gate-dl.user.js): `userscript/sc-gate-dl.user.js`
- [Managed export](https://github.com/jpsamuelson/sc-gate-dl/blob/master/manage-acc.ts): `manage-acc.ts`

### Other components

- **User**

## Connections

- User → CLI workflow: starts download (evidence: `README.md`)
- User → Web interface: uses interface (evidence: `README.md`)
- CLI workflow → SoundCloud client: fetches track (evidence: `src/index.ts`)
- CLI workflow → Hypeddit gates: runs gate (evidence: `src/index.ts`)
- CLI workflow → Droploud gates: runs gate (evidence: `src/index.ts`)
- CLI workflow → GateRush gates: runs gate (evidence: `src/index.ts`)
- CLI workflow → DownloadGater gates: runs gate (evidence: `src/index.ts`)
- CLI workflow → StillHype gates: runs gate (evidence: `src/index.ts`)
- CLI workflow → PumpYourSound gates: runs gate (evidence: `src/index.ts`)
- CLI workflow → MyPressKit gates: runs gate (evidence: `src/index.ts`)
- CLI workflow → Bandcamp downloads: runs gate (evidence: `src/index.ts`)
- CLI workflow → Direct downloads: downloads link (evidence: `src/index.ts`)
- CLI workflow → Browserless gates: uses fast path (evidence: `src/index.ts`)
- HTTP job server → Job queue: queues jobs (evidence: `src/server.ts`)
- HTTP job server → Job state: updates jobs (evidence: `src/server.ts`)
- HTTP job server → Track search: serves search (evidence: `src/server.ts`)
- HTTP job server → SoundCloud client: fetches track (evidence: `src/server.ts`)
- HTTP job server → Browser launcher: launches browser (evidence: `src/server.ts`)
- HTTP job server → Hypeddit gates: dispatches gate (evidence: `src/server.ts`)
- HTTP job server → Direct downloads: downloads file (evidence: `src/server.ts`)
- HTTP job server → Audio processing: processes audio (evidence: `src/server.ts`)
- HTTP job server → Archive extraction: extracts archive (evidence: `src/server.ts`)
- HTTP job server → yt-dlp downloads: downloads track (evidence: `src/server.ts`)
- HTTP job server → Account cleanup: offers cleanup (evidence: `src/server.ts`)
- HTTP job server → Web interface: serves jobs
- Track search → SoundCloud client: searches tracks (evidence: `src/search.ts`)
- Hypeddit gates → Bandcamp downloads: delegates gate (evidence: `src/hypeddit.ts`)
- Droploud gates → Browser launcher: uses browser (evidence: `src/droploud.ts`)
- GateRush gates → Browser launcher: uses browser (evidence: `src/gaterush.ts`)
- DownloadGater gates → Browser launcher: uses browser (evidence: `src/downloadgater.ts`)
- StillHype gates → Browser launcher: uses browser (evidence: `src/stillhype.ts`)
- PumpYourSound gates → Browser launcher: uses browser (evidence: `src/pumpyoursound.ts`)
- MyPressKit gates → Browser launcher: uses browser (evidence: `src/mypresskit.ts`)
- Bandcamp downloads → yt-dlp downloads: downloads media (evidence: `src/bandcampGate.ts`)
- Direct downloads → Archive extraction: may unpack ZIP (evidence: `README.md`)
- Audio processing → SoundCloud client: gets metadata
- User → SoundCloud userscript: opens panel (evidence: `README.md`)
- Managed export → SoundCloud client: exports account data (evidence: `manage-acc.ts`)
