Skip to main content
Back to Projects

Agentic Songwriter

A learning-first agentic AI project that helps songwriters create song drafts. Built with Next.js and TypeScript, demonstrating orchestrator loops, tool-based LLM integration, state management, tracing, and human-in-the-loop capabilities.

Agentic Songwriter project screenshot

Architecture

System Architecture

The application implements a sophisticated agentic AI architecture built on Next.js 14 with TypeScript, leveraging the App Router for optimal performance and SEO. The frontend utilizes React 18 with server-side rendering capabilities, while Prisma ORM manages database operations with PostgreSQL for persistent storage of songs, melodies, and user data. The core innovation lies in the rule-based orchestrator pattern: agents make decisions using deterministic logic (if/else trees), while OpenAI API calls are strictly isolated within tools for creative generation and quality evaluation. This separation ensures predictable orchestration with LLM-powered creativity. NextAuth.js handles authentication via Google OAuth, providing secure user sessions. Real-time progress updates are streamed to clients using Server-Sent Events (SSE), enabling live feedback during song generation. Tone.js powers browser-based MIDI playback, allowing users to hear generated melodies without external dependencies. The architecture supports horizontal scaling and implements user quotas (5 drafts/day) with database-backed tracking.

Technologies

Production experienceLearning / Experimental

Next.jsTypeScriptReactPrismaPostgreSQLOpenAI APINextAuth.jsTone.jsServer-Sent Events