Skip to content

zombachu/heardle

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

169 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

K-Pop Heardle ๐ŸŽต

A comprehensive music guessing game featuring your favorite K-pop artists! Test your knowledge of K-pop discographies by guessing songs from short audio previews.

Live Demo TypeScript Next.js Tailwind CSS

โœจ Features

๐ŸŽฎ Game Modes

  • Daily Challenges: New song every day at midnight for each artist (same for all players)
  • Practice Mode: Unlimited random songs for practice sessions
  • Progressive Audio: Start with 1 second, gradually increase to 15 seconds
  • Smart Autocomplete: Search through each artist's entire catalog with intelligent filtering

๐ŸŽจ Modern Design

  • Glassmorphism UI: Beautiful backdrop blur effects and modern aesthetics
  • Artist-Specific Themes: Each artist has unique color schemes (auto-generated or custom)
  • Responsive Design: Optimized for all devices with mobile-first approach
  • Dark Theme: Elegant dark interface with smooth animations
  • Dynamic Artist Artwork: Fetched from Apple Music API

๐Ÿ“Š Statistics & Sharing

  • Game Statistics: Track your performance and accuracy over time
  • Share Results: Share your daily challenge results with friends
  • Local Storage: Persistent game state and statistics
  • Daily Rollover: Automatic detection of new daily challenges

๐ŸŒ Multi-Artist Support

Currently featuring 100+ K-pop artists including:

Girl Groups: TWICE, LE SSERAFIM, BLACKPINK, NewJeans, IVE, aespa, ITZY, Red Velvet, Girls' Generation, NMIXX, Kep1er, ILLIT, Dreamcatcher, MAMAMOO, GFRIEND, LOONA, WJSN, fromis_9, STAYC, KISS OF LIFE, BABYMONSTER, and more

Boy Groups: BTS, Stray Kids, SEVENTEEN, ENHYPEN, TXT, ATEEZ, NCT 127/DREAM/U, EXO, BIGBANG, Super Junior, SHINee, GOT7, MONSTA X, RIIZE, TREASURE, THE BOYZ, and more

Solo Artists: IU, Taeyeon, Sunmi, HyunA, G-Dragon, Taeyang, Baekhyun, Taemin, and more

๐ŸŽฏ How to Play

  1. Choose Your Artist: Select from 100+ K-pop artists on the homepage
  2. Pick Your Mode: Daily Challenge (one song per day) or Practice Mode (unlimited)
  3. Listen & Guess: Start with 1 second of audio, guess the song title
  4. Progressive Reveals: Each wrong guess or skip gives you more audio time
  5. Win Condition: Guess correctly within 6 tries to win
  6. Share Results: Share your daily challenge performance with friends

Audio Progression System

Try Duration
1 1 second
2 2 seconds
3 4 seconds
4 7 seconds
5 10 seconds
6 15 seconds (final)

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Apple Music Developer Token (for API access)
  • Modern browser with HTML5 audio support

Installation

  1. Clone the repository
git clone https://github.com/retlocpeck/heardle.git
cd heardle
  1. Install dependencies
npm install
  1. Set up environment variables Create a .env.local file:
APPLE_MUSIC_DEV_TOKEN=your_apple_music_jwt_token
APPLE_MUSIC_KEY_ID=your_key_id
APPLE_MUSIC_TEAM_ID=your_team_id
  1. Generate Apple Music token (if needed)
node scripts/generate-apple-music-token.js
  1. Pre-fetch song data (recommended for production)
npm run prefetch
  1. Run development server
npm run dev
  1. Open in browser Navigate to http://localhost:3000

Build for Production

npm run build:full  # Includes prefetch step
npm start

๐Ÿ—๏ธ Project Architecture

Tech Stack

  • Framework: Next.js 15 with App Router
  • Language: TypeScript for type safety
  • Styling: Tailwind CSS 4 with custom glassmorphism components
  • Audio: HTML5 Audio API with custom controls
  • Data Source: Apple Music API with static pre-generation
  • Analytics: Vercel Speed Insights for performance monitoring

Data Pipeline

Apple Music API โ†’ Pre-fetch Script โ†’ Static JSON โ†’ Runtime Cache โ†’ Game Logic โ†’ Audio Player

The project uses a static pre-generation strategy:

  1. Build Time: npm run prefetch fetches all artist catalogs from Apple Music API
  2. Runtime: API routes serve pre-cached JSON data (no live API calls needed)
  3. Fallback: If cache misses, falls back to live Apple Music API

Project Structure

heardle/
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ data/                    # Pre-fetched static data
โ”‚   โ”‚   โ”œโ”€โ”€ songs/               # Artist song catalogs (JSON)
โ”‚   โ”‚   โ”œโ”€โ”€ artwork/             # Artist artwork URLs (JSON)
โ”‚   โ”‚   โ””โ”€โ”€ summary.json         # Prefetch metadata
โ”‚   โ””โ”€โ”€ favicons/                # Favicon assets
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ prefetch-songs.js        # Song/artwork pre-fetcher
โ”‚   โ””โ”€โ”€ generate-apple-music-token.js
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                     # Next.js App Router
โ”‚   โ”‚   โ”œโ”€โ”€ [artist]/            # Dynamic artist game pages
โ”‚   โ”‚   โ””โ”€โ”€ api/[artist]/        # Artist API routes
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ game/                # Game components
โ”‚   โ”‚   โ”œโ”€โ”€ stats/               # Statistics components
โ”‚   โ”‚   โ””โ”€โ”€ ui/                  # Reusable UI components
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ artists.ts           # Artist configurations
โ”‚   โ”‚   โ””โ”€โ”€ theme.ts             # Theme generation
โ”‚   โ””โ”€โ”€ lib/
โ”‚       โ”œโ”€โ”€ hooks/               # Custom React hooks
โ”‚       โ”œโ”€โ”€ services/            # Business logic
โ”‚       โ”‚   โ”œโ”€โ”€ appleMusicService.ts
โ”‚       โ”‚   โ”œโ”€โ”€ cachedDataService.ts
โ”‚       โ”‚   โ””โ”€โ”€ trackFilters.ts
โ”‚       โ””โ”€โ”€ utils/               # Utility functions
โ”œโ”€โ”€ keys/                        # Apple Music API keys (gitignored)
โ””โ”€โ”€ docs/                        # Documentation

๐Ÿ”ง API Endpoints

Artist-Specific Routes

  • GET /api/[artist]/daily - Get today's daily challenge song

    • Query: ?date=YYYY-MM-DD (optional)
  • GET /api/[artist]/random - Get random song for practice mode

    • Query: ?exclude=trackId1,trackId2 (optional)
  • GET /api/[artist]/songs - Get all songs for artist

  • GET /api/[artist]/artwork - Get artist artwork URLs

๐ŸŽต Apple Music Integration

Why Apple Music API?

  • Complete catalogs: Full artist discographies including Japanese/Korean releases
  • High-quality previews: 30-second AAC audio files
  • Artist artwork: High-resolution artist images and banners
  • Multi-storefront: Queries US, Japan, and Korea storefronts for complete coverage

Track Filtering

Songs are filtered to ensure quality gameplay:

  • Removes remixes, instrumentals, live versions
  • Filters out non-English titles (Korean/Japanese characters)
  • Removes intros, outros, skits, and interludes
  • Deduplicates versions (keeps shortest/simplest)

๐ŸŽจ Adding New Artists

  1. Add to configuration in src/config/artists.ts:
{ id: 'artist-slug', name: 'Artist Name', displayName: 'Display Name', searchTerms: ['Artist Name', '์•„ํ‹ฐ์ŠคํŠธ'] }
  1. Run prefetch to generate data:
npm run prefetch
  1. Deploy - Artist automatically appears with auto-generated theme

See docs/ARTIST_CONFIGURATION.md for detailed setup.

๐Ÿ› ๏ธ Development

Available Scripts

npm run dev          # Development server (Turbopack)
npm run build        # Production build
npm run build:full   # Prefetch + build
npm run prefetch     # Pre-fetch all artist data
npm run lint         # ESLint
npm start            # Production server

๐Ÿ› Troubleshooting

Common Issues

"No songs found" Error

  • Run npm run prefetch to generate song data
  • Check that artist exists in artists.ts
  • Verify Apple Music API token is valid

Audio Not Playing

  • Check browser HTML5 audio support
  • Some tracks may lack preview URLs
  • Verify device audio permissions

Missing Artist Images

  • Run npm run prefetch to fetch artwork
  • Check network connectivity to Apple Music API

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ™ Acknowledgments

  • Apple Inc. for the Apple Music API
  • All K-pop artists and their entertainment companies
  • Original Heardle game for the concept inspiration
  • Next.js, Tailwind CSS, and Vercel for the amazing tools

Made with ๐Ÿ’œ for the K-pop community | Live Demo | GitHub

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 91.3%
  • JavaScript 6.9%
  • Other 1.8%