summaryrefslogtreecommitdiffhomepage
path: root/yt-music-dl-backend/README.md
blob: e088f88872ac9786ea148f7138dfbaa2a909f932 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# yt-music-dl-backend

Bun + TypeScript backend for downloading, splitting, tagging, and organizing
YouTube audio. Mirrors the `dispatch-backend` architecture (pure core / injected
shell / typed contracts).

See `../.research/` for the full design rationale and `AGENTS.md` for the rules.

## Stack

- **Bun** (runtime + `bun:sqlite`)
- **TypeScript** (strict, project references via `tsc -b`)
- **Biome** (tabs, double quotes, semicolons, width 100)
- **Vitest**
- **yt-dlp** standalone binary (subprocess, not a Python import)

## Commands

```sh
bun install            # install deps (first run)
bun run typecheck      # tsc -b --pretty
bun run test           # vitest
bun run check          # biome lint + format
bun run dev            # bun --watch packages/host-bin/src/main.ts
```

## System dependencies

The backend shells out to `yt-dlp` and `ffmpeg`:

```sh
sudo pacman -S yt-dlp ffmpeg
```

Or fetch the yt-dlp standalone binary via `../bin/install-yt-dlp`.

## Packages

| Package | Layer | Role |
|---|---|---|
| `contract` | shared | typed contracts (consumed by frontend as a `file:` dep) |
| `job-store` | pure core | download state machine, cut-plan logic |
| `downloader` | edge | yt-dlp subprocess wrapper |
| `host-bin` | composition | boots the server |