002 // projects
Melodex
Melodex is a full-stack, AI-native web application that turns a user's Spotify library into something they can converse with — asking questions in plain language, discovering and building playlists, and cleaning up their library, all grounded in real data, with every mutating action gated behind a preview-confirm-undo workflow. Built end to end as a TypeScript pnpm monorepo, it runs a Fastify/Node backend, a React/Vite frontend, a PostgreSQL data layer, and an OpenAI tool-calling agent, deployed fully serverless on Vercel with Supabase Postgres. The AI agent is grounded through structured tools rather than free-text matching, with a post-generation validator that cross-checks every claim against actual tool results before responding. Because the app runs as a single serverless function with hard timeouts, the Spotify sync engine is built as a checkpointed, resumable state machine that can survive a function timeout and pick back up exactly where it left off, with idempotent writes so retries never duplicate work. Every write to Spotify follows a strict preview/commit/undo pattern with a 60-minute undo buffer built from recorded inverse operations. Security is handled through two custom SDKs built from scratch: a hybrid RSA-4096/AES-256-GCM end-to-end encryption protocol with forward secrecy and anti-MITM server authentication, and a stateless JWT session library with rotating refresh tokens.