Playpaste•2025

Generate YouTube Playlists with AI

Paste a list of songs, or describe the playlist you want, and Playpaste creates it on your YouTube account. Gemini turns the text into a clean song list, and the YouTube Data API finds each track and builds the playlist.

  • Next.js (App Router)
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
  • Next.js Server Actions
  • Route handlers
  • Google Gemini 2.0 Flash
  • YouTube Data API v3
Playpaste app turning a pasted song list into a YouTube playlist

Case study

The problem and how I built it 

What the app solves, and the pieces that make it work.

The problem

Making a YouTube playlist from a list of songs means searching for each track, picking the right video and adding it, one at a time. Twenty songs is twenty searches.

Song lists people copy from chats, notes or websites are messy: numbering, emojis, extra text, duplicates and missing artist names.

How I built it


  • Google sign-in with NextAuth, requesting YouTube access so the app can create playlists on the user's own account.
  • A server action sends the pasted text to Gemini 2.0 Flash with a strict prompt: return only a JSON array of "Song - Artist" strings, with no duplicates or empty entries. The response is cleaned of code fences and parsed before use.
  • Each song is searched with the YouTube Data API through the googleapis client, and the best match is added to a new playlist.
  • Access tokens are refreshed automatically against Google's OAuth endpoint, so long sessions don't fail halfway through creating a playlist.
  • Sitemap, robots.txt and page metadata generated with next-sitemap and the Next.js Metadata API.

Under the hood

Design decisions 

The choices that shaped the code, and what they cost.

Let the model clean the input, not regex

Pasted lists come in too many shapes for a parser to handle reliably. Gemini understands "1. Kesariya (Arijit) 🔥" and "something chill for a rainy evening" equally well. Constraining it to a JSON array of strings keeps its output easy to check.

Work on the user's own YouTube account

Creating the playlist through the user's OAuth token means it lives in their library and they can edit it later. It also means the app needs token refresh handling, since Google access tokens expire after an hour.

Results

Stack and outcome 

What it runs on, what it does today, and what I would build next.

Tech stack

Frontend
  • Next.js (App Router)
  • TypeScript
  • Tailwind CSS
  • shadcn/ui
Backend
  • Next.js Server Actions
  • Route handlers
AI & APIs
  • Google Gemini 2.0 Flash
  • YouTube Data API v3
  • googleapis
Auth
  • NextAuth
  • Google OAuth 2.0

Outcome

  • A pasted list or a short description becomes a YouTube playlist without any manual searching.
  • Messy input (numbering, emojis, duplicates) is cleaned before any API call is made.

What's next

  • Let users review and swap the matched videos before the playlist is created.
  • Handle YouTube API quota limits with batching and clear error messages.

Lets create something amazing together

Ready to bring your vision to life? Get in touch!