Suno-style web UI for a self-hosted MiniMax-Music3 inference server
TypeScript ai-musicdiffusersdockerexpressminimaxminimax-musicmusic-generationreactself-hostedsgl-omnisunotailwindcsstext-to-musictypescriptvite
docs: README with banner, screenshot, badges; add MIT license
Adam Benhassen5a9c412fec2a
diff --git a/LICENSE b/LICENSEnew file mode 100644index 0000000..f0152db--- /dev/null+++ b/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 Adam Benhassen++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/README.md b/README.mdindex 4af3734..40d46f9 100644--- a/README.md+++ b/README.md@@ -1,48 +1,122 @@-# minimax-music-ui+<p align="center">+ <img src="docs/assets/banner.svg" alt="MiniMax Music UI" width="100%">+</p>-Suno-style local web UI for a self-hosted [MiniMax-Music3](https://huggingface.co/MiniMaxAI/MiniMax-Music3) inference server.+<p align="center">+ A Suno-style web interface for a self-hosted <a href="https://huggingface.co/MiniMaxAI/MiniMax-Music3">MiniMax-Music3</a> inference server.<br>+ Write a style prompt and lyrics, queue takes, watch them render, and keep a local library with a waveform player.+</p>-- **web/** — Vite + React + Tailwind SPA (create form, take queue with live progress, library, waveform player)-- **server/** — Express 5 server that proxies generation to the inference box, polls jobs, downloads finished audio into `data/tracks/` and keeps metadata in `data/library.json`. Serves the built SPA.+<p align="center">+ <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-ff5c8a.svg"></a>+ <img alt="Node 20+" src="https://img.shields.io/badge/node-%E2%89%A520-339933?logo=node.js&logoColor=white">+ <img alt="React 19" src="https://img.shields.io/badge/react-19-149eca?logo=react&logoColor=white">+ <img alt="Vite 8" src="https://img.shields.io/badge/vite-8-646cff?logo=vite&logoColor=white">+ <img alt="Tailwind CSS 4" src="https://img.shields.io/badge/tailwind-4-06b6d4?logo=tailwindcss&logoColor=white">+</p>-## Run+<p align="center">+ <img src="docs/assets/screenshot.png" alt="MiniMax Music UI — create panel, track feed and player" width="100%">+</p>++## Features++- **Create panel** — Simple or Custom mode, song title, style description, lyrics editor with `[Verse]` / `[Chorus]` / … tag chips, instrumental toggle, duration 5–360 s, 1–4 takes per submit (each take gets `seed + i`), advanced seed / steps / output format.+- **Templates** — a built-in default plus your own saved templates (style, lyrics, duration, steps, format), stored server-side.+- **Live queue** — cards show stage, progress bar and ETA straight from the inference server; cancel while queued, retry on error.+- **Library** — every finished render is downloaded into `data/tracks/` with its metadata (prompt, lyrics, seed, peak level…) so it survives the inference box pruning its own job list. Search, download, delete, "reuse settings".+- **Player** — sticky bottom bar with waveform (decoded client-side), seek, prev/next, keyboard space to play/pause.+- **Health pill** — offline / loading model / idle / rendering · N queued.+- Responsive down to phone width. No external services; everything runs on your machine or tailnet.++## Architecture++```+browser ──/api/*──▶ server/ (Express 5) ──HTTP──▶ MiniMax-Music3 inference server (:7862)+ │ polls /jobs/{id} every 1 s+ │ downloads /jobs/{id}/audio when done+ └─▶ data/library.json · data/templates.json · data/tracks/*.flac|wav|mp3+```++| Package | What |+|---|---|+| `web/` | Vite + React 19 + TypeScript + Tailwind 4 single-page app. Talks only to `/api/*`. |+| `server/` | Express 5 + TypeScript. Owns the library, proxies generation, serves the built SPA. |++## Requirements++- Node.js 20 or newer+- A running MiniMax-Music3 inference server exposing `POST /generate`, `GET /jobs/{id}`, `GET /jobs/{id}/audio`, `DELETE /jobs/{id}`, `GET /health` (see [Upstream API](#upstream-api))++## Quick start```bash+git clone https://github.com/adambenhassen/minimax-music-ui.git+cd minimax-music-uinpm installnpm run build-MUSIC_API=http://100.105.185.107:7862 npm start # → http://localhost:8787+MUSIC_API=http://<inference-host>:7862 npm start+# → http://localhost:8787```-Env vars (server):+### Configuration++All configuration is via environment variables on the server process.-| Var | Default | Notes |+| Variable | Default | Description ||---|---|---|-| `MUSIC_API` | `http://127.0.0.1:7862` | inference server base URL |-| `MUSIC_API_KEY` | – | sent as `Authorization: Bearer` if the server was started with `--api-key` |-| `PORT` | `8787` | UI server port |-| `DATA_DIR` | `./data` | library JSON + audio files |-| `STATIC_DIR` | `web/dist` if present | built SPA to serve |+| `MUSIC_API` | `http://127.0.0.1:7862` | Base URL of the inference server |+| `MUSIC_API_KEY` | – | Sent as `Authorization: Bearer …` if the inference server was started with `--api-key` |+| `PORT` | `8787` | Port for the UI server |+| `DATA_DIR` | `./data` | Where `library.json`, `templates.json` and `tracks/` live |+| `STATIC_DIR` | `web/dist` (if built) | Directory of the built SPA to serve |-## Develop+## Development```bash-npm run dev # server :8787 (tsx watch) + vite :5173 with /api proxy-npm run dev:fake # same, plus a fake inference API on :7999 (no GPU needed)-npm test # server unit/integration tests (vitest)-npm run typecheck+npm run dev # server on :8787 (tsx watch) + Vite on :5173 with /api proxied+npm run dev:fake # same, plus a fake inference API on :7999 — no GPU needed+npm test # server tests (vitest) against the fake upstream+npm run typecheck # both packages```-`FAKE_AUDIO=/path/to/file.wav FAKE_ADVANCE_MS=1500 npm run fake -w server` makes the fake serve a real, playable file and progress faster.+The fake upstream (`server/test/fakeUpstream.ts`) walks each job through `queued → running → done`. Options for the standalone runner:++```bash+FAKE_AUDIO=/path/to/real.wav FAKE_ADVANCE_MS=1500 npm run fake -w server+```## UI server API+| Method | Path | Description |+|---|---|---|+| `GET` | `/api/health` | Upstream `/health` plus `upstreamReachable` |+| `GET` | `/api/library` | Tracks, newest first |+| `POST` | `/api/generate` | `{title?, prompt, lyrics?, duration, seed?, steps?, format, takes}` → created tracks |+| `GET` | `/api/tracks/:id/audio` | Stream audio (`?download` for an attachment) |+| `DELETE` | `/api/tracks/:id` | Cancel upstream if in flight, delete file and entry |+| `GET` | `/api/templates` | Saved templates |+| `POST` | `/api/templates` | `{name, prompt, lyrics?, duration?, steps?, format?}` — same name overwrites |+| `DELETE` | `/api/templates/:id` | Remove a template |++## Upstream API++The server expects the inference box to speak this contract:+| Method | Path | ||---|---|---|-| GET | `/api/health` | upstream `/health` + `upstreamReachable` |-| GET | `/api/library` | tracks, newest first |-| POST | `/api/generate` | `{title?, prompt, lyrics?, duration, seed?, steps?, format, takes}` → created tracks (one per take; `seed+i` per take when a seed is given) |-| GET | `/api/tracks/:id/audio` | stream audio (`?download` for attachment) |-| DELETE | `/api/tracks/:id` | cancel upstream if queued/running, delete file + entry |-| GET | `/api/templates` | saved templates (`data/templates.json`) |-| POST | `/api/templates` | `{name, prompt, lyrics?, duration?, steps?, format?}` — same name overwrites |-| DELETE | `/api/templates/:id` | remove a template |+| `POST` | `/generate` | `{prompt, lyrics="[Instrumental]", duration=60 (5–360), seed?, steps? (10–100), format="wav"\|wav16\|wav32f\|flac\|mp3, wait=false}` → `{job_id}` |+| `GET` | `/jobs/{id}` | `{status: queued\|running\|done\|error, progress, stage, eta, seed, error?, audio_url?, sampling_rate?, peak_dbfs?, clipped?}` |+| `GET` | `/jobs/{id}/audio` | Finished render |+| `DELETE` | `/jobs/{id}` | Cancel if queued / delete file |+| `GET` | `/health` | `{ready, busy, queued, formats[], sampling_rate}` |++Only one job renders at a time upstream; additional submissions queue. Rendering is roughly 2.5–3× slower than realtime.++## Contributing++Issues and pull requests are welcome. Run `npm test` and `npm run typecheck` before opening a PR.++## License++[MIT](LICENSE)diff --git a/docs/assets/banner.svg b/docs/assets/banner.svgnew file mode 100644index 0000000..0c6ce5a--- /dev/null+++ b/docs/assets/banner.svg@@ -0,0 +1,48 @@+<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="320" viewBox="0 0 1280 320" role="img" aria-label="MiniMax Music UI">+ <defs>+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">+ <stop offset="0" stop-color="#0a0a0f"/>+ <stop offset="1" stop-color="#181822"/>+ </linearGradient>+ <linearGradient id="accent" x1="0" y1="0" x2="1" y2="0">+ <stop offset="0" stop-color="#ff5c8a"/>+ <stop offset="1" stop-color="#a855f7"/>+ </linearGradient>+ <radialGradient id="glow1" cx="0.15" cy="0.2" r="0.5">+ <stop offset="0" stop-color="#ff5c8a" stop-opacity="0.35"/>+ <stop offset="1" stop-color="#ff5c8a" stop-opacity="0"/>+ </radialGradient>+ <radialGradient id="glow2" cx="0.9" cy="0.9" r="0.55">+ <stop offset="0" stop-color="#a855f7" stop-opacity="0.35"/>+ <stop offset="1" stop-color="#a855f7" stop-opacity="0"/>+ </radialGradient>+ <clipPath id="r"><rect width="1280" height="320" rx="24"/></clipPath>+ </defs>+ <g clip-path="url(#r)">+ <rect width="1280" height="320" fill="url(#bg)"/>+ <rect width="1280" height="320" fill="url(#glow1)"/>+ <rect width="1280" height="320" fill="url(#glow2)"/>+ <!-- waveform -->+ <g fill="url(#accent)" opacity="0.9" transform="translate(860 160)">+ <rect x="0" y="-12" width="6" height="24" rx="3"/><rect x="10" y="-28" width="6" height="56" rx="3"/><rect x="20" y="-46" width="6" height="92" rx="3"/><rect x="30" y="-20" width="6" height="40" rx="3"/><rect x="40" y="-60" width="6" height="120" rx="3"/><rect x="50" y="-34" width="6" height="68" rx="3"/><rect x="60" y="-80" width="6" height="160" rx="3"/><rect x="70" y="-52" width="6" height="104" rx="3"/><rect x="80" y="-24" width="6" height="48" rx="3"/><rect x="90" y="-70" width="6" height="140" rx="3"/><rect x="100" y="-40" width="6" height="80" rx="3"/><rect x="110" y="-96" width="6" height="192" rx="3"/><rect x="120" y="-58" width="6" height="116" rx="3"/><rect x="130" y="-30" width="6" height="60" rx="3"/><rect x="140" y="-74" width="6" height="148" rx="3"/><rect x="150" y="-44" width="6" height="88" rx="3"/><rect x="160" y="-16" width="6" height="32" rx="3"/><rect x="170" y="-62" width="6" height="124" rx="3"/><rect x="180" y="-88" width="6" height="176" rx="3"/><rect x="190" y="-36" width="6" height="72" rx="3"/><rect x="200" y="-54" width="6" height="108" rx="3"/><rect x="210" y="-22" width="6" height="44" rx="3"/><rect x="220" y="-68" width="6" height="136" rx="3"/><rect x="230" y="-42" width="6" height="84" rx="3"/><rect x="240" y="-14" width="6" height="28" rx="3"/>+ </g>+ <g fill="#4a4a5f" opacity="0.7" transform="translate(1110 160)">+ <rect x="0" y="-30" width="6" height="60" rx="3"/><rect x="10" y="-50" width="6" height="100" rx="3"/><rect x="20" y="-18" width="6" height="36" rx="3"/><rect x="30" y="-64" width="6" height="128" rx="3"/><rect x="40" y="-38" width="6" height="76" rx="3"/><rect x="50" y="-12" width="6" height="24" rx="3"/><rect x="60" y="-46" width="6" height="92" rx="3"/><rect x="70" y="-72" width="6" height="144" rx="3"/><rect x="80" y="-26" width="6" height="52" rx="3"/><rect x="90" y="-56" width="6" height="112" rx="3"/><rect x="100" y="-34" width="6" height="68" rx="3"/><rect x="110" y="-16" width="6" height="32" rx="3"/><rect x="120" y="-48" width="6" height="96" rx="3"/><rect x="130" y="-28" width="6" height="56" rx="3"/><rect x="140" y="-60" width="6" height="120" rx="3"/><rect x="150" y="-20" width="6" height="40" rx="3"/><rect x="160" y="-40" width="6" height="80" rx="3"/><rect x="170" y="-10" width="6" height="20" rx="3"/><rect x="180" y="-32" width="6" height="64" rx="3"/><rect x="190" y="-52" width="6" height="104" rx="3"/><rect x="200" y="-24" width="6" height="48" rx="3"/><rect x="210" y="-14" width="6" height="28" rx="3"/><rect x="220" y="-36" width="6" height="72" rx="3"/><rect x="230" y="-8" width="6" height="16" rx="3"/><rect x="240" y="-20" width="6" height="40" rx="3"/>+ </g>+ <!-- logo -->+ <rect x="80" y="104" width="112" height="112" rx="28" fill="url(#accent)"/>+ <g transform="translate(136 160)" fill="none" stroke="#fff" stroke-width="6" stroke-linecap="round" stroke-linejoin="round">+ <path d="M-14 24V-24l40-8V16"/>+ <circle cx="-26" cy="24" r="12"/>+ <circle cx="14" cy="16" r="12"/>+ </g>+ <text x="224" y="150" font-family="Inter, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="56" font-weight="700" fill="#f4f4f5" letter-spacing="-1">MiniMax Music UI</text>+ <text x="226" y="196" font-family="Inter, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="22" fill="#a1a1aa">Suno-style interface for a self-hosted MiniMax-Music3 server</text>+ <g font-family="Inter, -apple-system, Segoe UI, Helvetica, Arial, sans-serif" font-size="14" font-weight="600" fill="#e4e4e7">+ <rect x="226" y="222" width="86" height="30" rx="15" fill="#22222f"/><text x="269" y="242" text-anchor="middle">React 19</text>+ <rect x="320" y="222" width="70" height="30" rx="15" fill="#22222f"/><text x="355" y="242" text-anchor="middle">Vite 8</text>+ <rect x="398" y="222" width="96" height="30" rx="15" fill="#22222f"/><text x="446" y="242" text-anchor="middle">Tailwind 4</text>+ <rect x="502" y="222" width="94" height="30" rx="15" fill="#22222f"/><text x="549" y="242" text-anchor="middle">Express 5</text>+ </g>+ </g>+</svg>diff --git a/docs/assets/screenshot.png b/docs/assets/screenshot.pngnew file mode 100644index 0000000..2436437Binary files /dev/null and b/docs/assets/screenshot.png differ