About This Project
Full-stack AI engineering — from forking and deploying an open-source music generation model on serverless GPU infrastructure, to building a production-grade web application on top of it.
System Architecture
Client
Browser
Vercel
Next.js 16
Railway
FastAPI
Modal GPU
ACE-Step API
Tech Stack
AI Inference
Modal (Serverless GPU)
The open-source ACE-Step v1.5 music model was forked and extended with modal_app.py — a production-grade serverless deployment script. It packages the model into a Docker image, caches Hugging Face model weights during image build to avoid re-downloading on every cold start, and uses Modal's CRIU-based GPU memory snapshotting so warm starts are near-instant. GPU tier (L4, A10G, or A100) is automatically selected based on the configured LM model size (0.6B, 1.7B, or 4B). The app scales to zero when idle.
Backend API
FastAPI on Railway
A stateless HTTP proxy that sits between the browser and the Modal inference layer. All requests are validated with Pydantic, rate-limited per session with slowapi (5 generations/min), and routed to the upstream ACE-Step API over an HTTP/2 persistent connection managed by httpx.AsyncClient. Audio is streamed back to the client via FastAPI StreamingResponse, keeping the internal Modal URL and API key away from the browser at all times.
Frontend
Next.js on Vercel
A responsive web app built around a single prompt box — everything else is optional. Async job status is tracked via long-polling with exponential backoff. The waveform player is built on wavesurfer.js. All API shapes are validated client-side with Zod schemas matching the backend's Pydantic contracts, catching interface drift at the boundary. The frontend never contacts the Modal API directly — all traffic flows through the FastAPI backend.
CI/CD & DevOps
GitHub Actions
A multi-layered pipeline from commit to production. Pre-commit hooks (detect-secrets, Bandit, Semgrep, Ruff) catch issues locally before they reach CI. Every PR triggers SAST scanning, dependency auditing, container scanning (Trivy), and the full test suite with 100% coverage enforcement. Dependabot keeps all dependencies current. Release Please automates semantic versioning and changelog generation across the monorepo on every merge to main.