MelodyMuse
Generate every asset you need for a Suno AI song from a free-text idea — titles, lyrics, style prompt, video prompts, and YouTube description — and download everything as a ZIP.
Overview
MelodyMuse generates every asset you need for a Suno AI song from a free-text idea — titles, lyrics, style prompt, video prompts (Abstract / Cinematic / Hybrid), and a YouTube description — then lets you edit, regenerate individual sections, and download everything as a single ZIP archive.
The app runs as a single Node.js process that serves both the built React SPA and the API the SPA calls. Your LLM provider's API key lives strictly on the server (environment variable), never in the browser.
[Browser] ──► [Node server :3000] ──► [LLM provider]
(no key) (holds the key)
Table of contents
- Overview
- Features
- How It Works & Tech Stack
- Prerequisites & Installation
- Configuration
- Usage
- Project Structure
- License
Features
- Full Suno Asset Suite: Generates 3 song titles, section-tagged lyrics, Suno style & negative style prompts, 3 video prompts (Abstract, Cinematic, Hybrid), and a ready-to-paste YouTube description with embedded lyrics and hashtags.
- Style Inspiration Buttons: Built-in Surprise me and Go crazy generators for instant Suno-compatible style prompts.
- Per-Section Regeneration & Inline Editing: Rewrite any single result card with full song context, edit freely, or click Revert to restore the last generated output.
- Server-Side History & Custom Prompts: Persists up to 500 recent generations (
history.json) and customizable system prompts (prompts.json) inDATA_DIR. - One-Click ZIP Export: Bundles
Style.txt,Text.txt,Videodescription.txt, andVideoprompt.txtusing JSZip. - Instant Cancellation: Abort long-running generations from the UI or via
Esc, propagating abort signals upstream to the LLM provider to avoid wasting tokens. - Configurable Video AI Quick Links & Bilingual UI: Supports custom Video AI tool links (
VIDEO_AI_LINKS), dark/light theme toggle, and English/German UI translations (src/lib/i18n.tsx).
Surprise me / Go crazy (style buttons)
Both buttons are in the Options → Music style row.
| Button | What the model is told |
|---|---|
| ✨ Surprise me | "Generate ONE short, cohesive, production-ready Suno style description. Comma-separated keywords. Max 25 words." |
| 🔥 Go crazy | "Generate ONE short style description that DELIBERATELY combines genres/eras/instruments that don't normally mix. Still parseable by Suno. Max 25 words." |
When you click a button:
- The button shows a spinner.
- The browser calls
POST /api/style/randomon the server. - The server calls the LLM with a small dedicated system prompt.
- The returned one-line style description replaces the value in the Music style textarea.
- The spinner stops.
You can keep clicking — each click fetches a new style. The field is overwritten, never appended. Both buttons are disabled while a request is in flight, so you can't double-fire.
If the field has a value when you click Generate Song Assets, that value is sent to the model as a style_hint and used as the basis for the full style field in the output.
Regenerate one section
Every card has a Regenerate button in its header.
- Click it to ask the model to rewrite that section only.
- The rest of the current song is passed as
contextso the new section stays consistent with the existing lyrics, mood, and vocabulary. - Only that card's spinner is active while it runs; the other cards stay fully usable.
Edit, then Revert
Every editable card compares its current value against the last generated value. If they differ, a Revert button appears in the card header. Click it to snap back to the last generated version.
This is great for "I'll tweak this one line and see if I like it better" without losing the original.
Recent generations
The last 500 successful generations are saved on the server. Click any entry to restore both the input form values AND the full generated assets — handy for comparing two generations of the same idea.
Individual entries have an ✕ button to remove them. There's a Clear history button at the bottom of the history panel.
Download the ZIP
Once you've picked a title (the first one is auto-selected on generation), a sticky bar appears at the bottom of the viewport showing 📁 [Title].zip and a Download ZIP button. Click it to download a ZIP with four files:
| File | Contents |
|---|---|
Style.txt |
STYLE PROMPT: … + NEGATIVE STYLE: … |
Text.txt |
The full lyrics |
Videodescription.txt |
The YouTube description |
Videoprompt.txt |
All three video prompts in order (Abstract, Cinematic, Hybrid), each with the negative line and tool recommendation |
The filename is the selected title, sanitized: spaces become _, anything that's not a letter, digit, underscore, or dash is removed. If the title sanitizes to an empty string, the file is named song.zip.
Cancel a long generation
While a generation is running:
- A Cancel generation button appears below the main generate button.
- A Cancel button appears in the sticky results header (top right of the right panel).
- The Generate button shows a live elapsed-time counter (e.g.
Generating… 8s). - Esc also works.
Cancellation aborts the in-flight HTTP request. The server also aborts its upstream request to the LLM, so no tokens are wasted.
How It Works & Tech Stack
The browser only ever talks to one server: the Node process in server.mjs. That server:
- Serves the built SPA from
dist/(with SPA fallback toindex.html) - Exposes JSON endpoints (
/api/health,/api/config,/api/generate,/api/style/random,/api/history,/api/system-prompts) - Holds the LLM credentials in
process.env - Strips
<think>...</think>blocks from reasoning models (likeMiniMax-M3orDeepSeek-R1) and extracts JSON with three progressively lenient fallbacks (extractJson), plus shape validation (validateShape/validateFullAssets).
The browser-side code is a thin wrapper around fetch. The system prompts, JSON extraction, and shape validation all live on the server in server/prompts.mjs and server.mjs. The browser never sees the provider, the key, or the prompts unless fetched from the settings endpoints.
| Component | Technology / Details |
|---|---|
| Frontend | React ^18.3.1, TypeScript ^5.6.2, React Router ^6.26.2, Tailwind CSS ^3.4.13, FontAwesome, JSZip ^3.10.1 |
| Build Tool | Vite ^5.4.8 (dev server on port 5173, proxies /api/* to :3000) |
| Backend | Single-file Node.js HTTP server (server.mjs, node:http & node:fs/promises, zero external runtime deps for the server) |
| Persistence | JSON files in DATA_DIR (history.json up to 500 entries, prompts.json for custom prompts) |
| Container | Multi-stage Dockerfile (node:22-alpine, runs as non-root node user) |
| Ports | Production server listens on 3000 (PORT); Vite dev server runs on 5173 |
Prerequisites & Installation
You need Node.js 18+ on your machine (or Docker / a server you can deploy to).
Quick start & Dev workflow (two terminals)
# 1. Clone
git clone https://git.orfel.de/Jannik/MelodyMuse.git
cd MelodyMuse
# 2. Install
npm install
# 3. Tell the server where your LLM lives and which key to use
export LLM_ENDPOINT="https://api.minimax.io/v1"
export LLM_API_KEY="sk-…"
# Optional:
export LLM_MODEL="MiniMax-M3" # default
Run the dev servers in two terminals:
# Terminal 1 — the API/proxy server (port 3000)
npm run dev:server
# Terminal 2 — the Vite dev server (port 5173, hot reload)
npm run dev
Open http://localhost:5173. The Vite dev server proxies /api/* to the Node server on :3000 (see vite.config.ts), so the SPA always talks to the same origin.
Production & Docker Deployment
Run directly on Node.js:
npm run build # writes the static SPA to dist/
npm start # node server.mjs, serves dist/ + /api/*
Then put a reverse proxy (Caddy, nginx, …) in front of localhost:3000.
This app follows a Docker-First workflow. The Docker image is built directly from this repository (Dockerfile) and pushed to the Gitea Container Registry (git.orfel.de/jannik/melodymuse). The production server (Jannik-Cloud) simply pulls the pre-built image and runs it.
Scripts
| Command | What it does |
|---|---|
npm run dev |
Vite dev server (port 5173) with HMR. Proxies /api/* to :3000. |
npm run dev:server |
The Node server in dev (no build step). |
npm run build |
Type-check + build the SPA to dist/. |
npm start |
Run the Node server (uses the existing dist/). |
npm run preview |
Vite preview server (no HMR). |
npm run lint |
Type-check only (tsc -b --noEmit). |
Configuration
The Node server (server.mjs) reads configuration from process.env and exits on startup if LLM_ENDPOINT or LLM_API_KEY is missing. See .env.example for full templates.
Environment variables (server)
| Var | Required | Default | Notes |
|---|---|---|---|
LLM_ENDPOINT |
✅ | — | Base URL of an OpenAI-compatible /chat/completions route (e.g. https://api.minimax.io/v1) |
LLM_API_KEY |
✅ | — | Provider secret (never sent to the browser) |
LLM_MODEL |
MiniMax-M3 |
Model name to send in each request | |
PORT |
3000 |
Listen port for server.mjs |
|
CORS_ORIGIN |
* |
Lock this down to a specific origin in production | |
DATA_DIR |
data |
Directory for persistent storage (history.json, prompts.json) |
|
VIDEO_AI_LINKS |
(built-in defaults) | Comma-separated Name=URL pairs (e.g. Kling AI=https://klingai.com,Luma=https://lumalabs.ai,Runway=https://runwayml.com) |
Provider examples
Copy one of the blocks from .env.example to switch providers:
- MiniMax (default):
LLM_ENDPOINT=https://api.minimax.io/v1,LLM_MODEL=MiniMax-M3 - OpenAI:
LLM_ENDPOINT=https://api.openai.com/v1,LLM_MODEL=gpt-4o-mini(orgpt-4o,gpt-4-turbo,o1-mini,o1) - OpenRouter (Claude, Llama, Mistral, Gemini, …):
LLM_ENDPOINT=https://openrouter.ai/api/v1, namespaced models such asanthropic/claude-3.5-sonnet,openai/gpt-4o,meta-llama/llama-3.1-405b-instruct,google/gemini-2.0-flash-exp - Poe:
LLM_ENDPOINT=https://api.poe.com/v1,LLM_MODEL=Claude-3.5-Sonnet(exact bot name) - Anthropic Claude (direct): Anthropic's native
POST /v1/messagesAPI is not OpenAI-compatible; use OpenRouter above or add a request/response adapter toserver.mjs.
Environment variables (Vite, dev only)
| Var | Default | Notes |
|---|---|---|
VITE_API_BASE_URL |
empty | Override the API base URL. Leave empty in dev (Vite's proxy handles it) and in same-origin production deployments. |
Docker and History Persistence
The application saves recent generations (history) to history.json and custom system prompts to prompts.json inside the directory specified by DATA_DIR (defaults to data in the project root).
If you are running the application using Docker, any files written inside the container will be lost when the container is rebuilt or restarted. To ensure your history survives a Docker rebuild, you must set up a Docker volume mapped to DATA_DIR.
Example using docker run:
docker run -d \
-p 3000:3000 \
-e LLM_ENDPOINT="https://api.minimax.io/v1" \
-e LLM_API_KEY="sk-..." \
-e DATA_DIR="/app/data" \
-v melodymuse-data:/app/data \
melodymuse-image
Example using docker-compose.yml:
services:
melodymuse:
image: melodymuse-image
ports:
- "3000:3000"
environment:
- LLM_ENDPOINT=https://api.minimax.io/v1
- LLM_API_KEY=sk-...
- DATA_DIR=/app/data
volumes:
- melodymuse-data:/app/data
volumes:
melodymuse-data:
This ensures history.json and prompts.json are securely stored on your host machine and persist across rebuilds.
Security notes
- The API key is held by the Node process via
process.env. It's never sent to the browser in any response, not even in the health check. - The
localStoragekeys the SPA writes:melodymuse-draft— current unsaved input draftmelodymuse-theme—'dark'or'light'melodymuse-config— reserved, currently unused (kept for future client-side server-URL override)
- You can wipe local browser data from Settings → Local data, or programmatically with the browser's DevTools.
Usage
The main page
Two columns on desktop, stacked on mobile.
Left — the input panel
- Music idea — describe what you want. The more concrete, the better the result. Press ⌘/Ctrl + Enter to generate.
- Try an example — fills the input with a random starter idea.
- Options — click to expand:
- Language — lyrics language. Choose "Other" to type a custom one.
- Music style — an optional style description. Two buttons:
- Surprise me — generates a normal, Suno-friendly style.
- Go crazy — generates an unusual genre mashup.
- Mood (optional) — an emotional hint, e.g. "melancholic".
- Vocals — 🎤 Vocals or 🎹 Instrumental.
- Generate Song Assets — main button. Spinner + elapsed time during generation. Cancel generation button appears next to it.
- Recent generations (below the form) — saved generations fetched from the server.
Right — the results panel
Shows the five result cards once a generation completes. Each card is editable and individually regenerable. The sticky results header has a Regenerate All button. Once you've picked a title, the Download ZIP bar appears at the bottom of the viewport.
The five result cards
| Card | What it does | Editable? | Regenerate? |
|---|---|---|---|
| 🏷️ Song Titles | 3 short title suggestions. Click to select. | select only | yes |
| 📝 Lyrics | Full lyrics with Suno section tags. | yes | yes |
| 🎵 Style | Style prompt and negative style. | yes | yes (both at once) |
| 🎬 Video Prompts | Abstract / Cinematic / Hybrid tabs. | yes | yes |
| 📺 YouTube Description | Full description with embedded lyrics + hashtags. | yes | yes |
Each editable card has a Revert button (top-right) that appears the moment you change the value. Click it to restore the last generated version.
The settings page
Click Settings (under the generate button) or navigate to /settings.
- Server status — green check if the API server is reachable and configured. Click Re-check to refresh. Shows the model name and endpoint so you know which LLM the server is using.
- Video AI Links — view, add, edit, or override quick-launch Video AI tool links locally (or reset to server defaults from
VIDEO_AI_LINKS). - System Prompts — inspect, customize, save (
POST /api/system-prompts), or reset (DELETE /api/system-prompts) the LLM system prompts per section. - Local data — inspect and clear browser-stored draft/history/local data.
- Theme — toggle the moon/sun icon in the header.
The API key is not here — it lives on the server in the LLM_API_KEY environment variable.
Keyboard shortcuts
| Key | Action |
|---|---|
| ⌘/Ctrl + Enter in the idea textarea | Generate |
| Esc while a generation is in flight | Cancel it |
Tips & tricks
- Be specific in the idea. "Melancholic lo-fi house beat for a rainy Sunday morning" produces better results than "make a song". Mood, tempo, era, setting, instrumentation — all help.
- Use Surprise me to break out of a rut. Click it 3–4 times; one of the styles will spark a new direction.
- Use Go crazy for instant novelty. "Baroque chamber orchestra meets dubstep" might be exactly the brief you needed.
- Style hint + surprise = best of both. Click Surprise me, then tweak the words slightly before generating. The model uses your edit as the basis for the full 120-word style description.
- Revert before regenerating. If you edited a card and the edit isn't quite right, click Revert to restore the last generated version, then click Regenerate to get a fresh alternative.
- History is your scratch pad. If you generate multiple variations, none of them is lost — pick the best from history.
Troubleshooting
- "Server offline" / "Server unreachable": The SPA can't reach the Node server. Check that the server is running (
npm startornode server.mjs),LLM_ENDPOINTandLLM_API_KEYare set in the server's env, and open http://localhost:3000/api/health — it should return{ "ok": true, ... }. - "Provider returned 401 / 403": The
LLM_API_KEYis wrong, expired, or doesn't have access to the model. Update the env var on the server and restart. - "Provider returned 404": Either the
LLM_ENDPOINTis wrong, the path/chat/completionsdoesn't exist at that URL, or the model name (LLM_MODEL) doesn't exist for that provider. - "Could not reach ${url}" with
fetch failed: The server can't reach the LLM provider. If you're running the server in a container, check that it has network access to the provider. Some providers block known cloud-IP ranges — check the provider's allow-list. - The model returns prose instead of JSON: The system prompt asks for JSON only. If a model ignores that, the server's
extractJsontries three increasingly lenient fallbacks. If all fail you'll see a clear error toast — re-try the generation, or try a different model. - "Storage quota exceeded" toast: Your
localStorageis full (a typical cap is 5–10 MB). Open Settings → Local data → Clear all local data, or clear recent generations. - I can't get a clean style out of "Go crazy": The prompt is intentionally permissive — the model is told to "deliberately break conventions". If you get a style that Suno rejects, just click the button again.
API contracts
POST /api/generate — body:
{
"input": "user's music idea (required)",
"language": "English",
"mood": "optional",
"style_hint": "optional — short style description",
"vocals": "vocals | instrumental",
"section": "all | lyrics | style | titles | video_prompts | youtube_description",
"context": { /* full or partial SongAssets, used for partial regen */ }
}
POST /api/style/random — body:
{ "mode": "normal | crazy", "idea": "optional" }
Response: { "style": "…", "mode": "…" }.
GET /api/health — response:
{ "ok": true, "llm_configured": true, "model": "MiniMax-M3", "endpoint": "https://…" }
Additional server endpoints:
GET /api/config— returns configuredVIDEO_AI_LINKS.GET /api/history,POST /api/history,DELETE /api/history,DELETE /api/history/:id— manage persistent generation history (history.json).GET /api/system-prompts,POST /api/system-prompts,DELETE /api/system-prompts— read, save, or reset custom system prompts (prompts.json).
Project Structure
MelodyMuse/
├── public/
│ ├── cursor-default.svg
│ ├── cursor-pointer.svg
│ ├── cursor-text.svg
│ ├── favicon.png
│ └── favicon.svg
├── server/
│ └── prompts.mjs # System + user prompt construction & defaults
├── src/ # React SPA
│ ├── App.tsx
│ ├── main.tsx
│ ├── index.css # Tailwind + design tokens
│ ├── vite-env.d.ts
│ ├── components/
│ │ ├── cards/ # The 5 result cards
│ │ │ ├── LyricsCard.tsx
│ │ │ ├── StyleCard.tsx
│ │ │ ├── TitlesCard.tsx
│ │ │ ├── VideoPromptsCard.tsx
│ │ │ └── YouTubeCard.tsx
│ │ ├── CopyButton.tsx
│ │ ├── EqualizerIcon.tsx
│ │ ├── Footer.tsx
│ │ ├── HistoryPanel.tsx
│ │ ├── InputPanel.tsx
│ │ ├── ResultCard.tsx
│ │ ├── ResultsPanel.tsx
│ │ ├── SkeletonCard.tsx
│ │ └── StickyZipBar.tsx
│ ├── lib/
│ │ ├── history.ts # Recent generations persistence
│ │ ├── i18n.tsx # English / German UI translations
│ │ ├── llm.ts # Browser → server client (thin)
│ │ ├── theme.tsx # Dark/light + localStorage
│ │ ├── toast.tsx # Toast context
│ │ ├── types.ts # Shared TS types
│ │ ├── useAutoHeight.ts # Textarea auto-grow hook
│ │ ├── useElapsed.ts # Elapsed-seconds hook
│ │ ├── useSystemPrompts.ts # System prompts hook
│ │ ├── useVideoAiLinks.ts # Video AI quick-links hook
│ │ └── zip.ts # JSZip layout
│ └── pages/
│ ├── HomePage.tsx
│ └── SettingsPage.tsx
├── .env.example
├── Dockerfile
├── index.html
├── package.json
├── postcss.config.js
├── server.mjs # Production & API runtime — serves dist/ + /api/*
├── tailwind.config.js
├── tsconfig*.json
├── vite.config.ts
├── LIESMICH.md
└── README.md
License
This project's own code and configuration are dedicated to the public domain under CC0 1.0 Universal — see LICENSE.
External dependencies installed via package managers or Docker images retain their respective open-source licenses.