"use client"; import { useEffect, useState } from "react"; import { useRouter } from "next/navigation"; import { api, ApiError } from "@/lib/api"; import { useAuth } from "@/lib/auth"; export default function CreatePage() { const { user, loading } = useAuth(); const router = useRouter(); const [title, setTitle] = useState(""); const [prompt, setPrompt] = useState(""); const [mode, setMode] = useState<"instrumental" | "vocals">("instrumental"); const [lyrics, setLyrics] = useState(""); const [isPublic, setIsPublic] = useState(true); const [error, setError] = useState(null); const [busy, setBusy] = useState(false); useEffect(() => { if (!loading && !user) router.push("/login"); }, [loading, user, router]); const onSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(null); setBusy(true); try { await api.createSong({ title: title || prompt.slice(0, 60) || "Untitled", prompt, mode, lyrics: mode === "vocals" ? lyrics : null, is_public: isPublic, }); router.push("/library"); } catch (err) { setError(err instanceof ApiError ? err.message : "Something went wrong"); } finally { setBusy(false); } }; if (loading || !user) return null; return (

Create a song

Describe the vibe — genre, mood, instruments, story. Generation happens in the background; you'll see it appear in your library once it's ready.