| prisma | ||
| public | ||
| src | ||
| .gitignore | ||
| eslint.config.mjs | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.mjs | ||
| README.md | ||
| setup.sh | ||
| tsconfig.json | ||
Harmony — A Shared Spotify Experience for Two 💕
A beautiful, romantic web application that allows two Spotify users to share their musical journey together. Built with Next.js, TypeScript, and Tailwind CSS.
Features
🎵 Shared Timeline
- View recently played songs from both users in a beautiful timeline
- See which songs you both have listened to with special heart markers 💕
- Track your musical journey together over time
🎧 Mix Generator
- AI-powered playlist creation based on both users' musical tastes
- Uses Spotify's Recommendations API to find perfect songs for both of you
- One-click playlist creation and saving to Spotify
📊 Live Dashboard
- Real-time display of what both users are currently listening to
- Harmony percentage calculation based on audio features (BPM, energy, valence)
- Beautiful animated progress bars and album covers
⚙️ Settings
- Customize display names and profile pictures
- Theme selection (Rose, Purple, Blue)
- Secure user authentication with Spotify OAuth
Tech Stack
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Animations: Framer Motion
- Icons: Lucide React
- Backend: Next.js API Routes
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js with Spotify OAuth
- Music API: Spotify Web API
Setup Instructions
1. Prerequisites
- Node.js 18+
- PostgreSQL database
- Spotify Developer Account
2. Database Setup
# Create PostgreSQL database
createdb spotify_app
# Set up database user (optional, can use default)
psql -c "CREATE USER iu WITH PASSWORD 'iu';"
psql -c "GRANT ALL PRIVILEGES ON DATABASE spotify_app TO iu;"
3. Environment Configuration
Copy .env.local and update with your credentials:
# Database
DATABASE_URL="postgresql://iu:iu@localhost:5432/spotify_app?schema=public"
# NextAuth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"
# Spotify OAuth
SPOTIFY_CLIENT_ID="your-spotify-client-id"
SPOTIFY_CLIENT_SECRET="your-spotify-client-secret"
# Allowed Spotify Users (comma-separated Spotify user IDs)
ALLOWED_SPOTIFY_USERS="your-spotify-user-id,partner-spotify-user-id"
4. Spotify App Setup
- Go to Spotify Developer Dashboard
- Create a new app
- Add
http://localhost:3000/api/auth/callback/spotifyto Redirect URIs - Copy Client ID and Client Secret to your
.env.local
5. Installation & Setup
# Install dependencies
npm install
# Generate Prisma client
npm run db:generate
# Push database schema
npm run db:push
# Start development server
npm run dev
6. Get Spotify User IDs
To find your Spotify user IDs:
- Go to your Spotify profile
- Click "Share" → "Copy link to profile"
- The user ID is in the URL:
https://open.spotify.com/user/{USER_ID}
Usage
- Sign In: Both users need to sign in with their Spotify accounts
- Dashboard: View overview of both users' activity
- Timeline: See shared listening history with heart markers for mutual songs
- Mix Generator: Create AI-powered playlists based on both users' tastes
- Live Dashboard: Real-time view of current listening activity and harmony matching
- Settings: Customize your experience
API Endpoints
GET /api/users- Get all connected usersGET /api/timeline- Get shared listening timelineGET /api/spotify/recently-played- Get user's recently played tracksGET /api/spotify/currently-playing- Get real-time listening dataPOST /api/spotify/recommendations- Generate music recommendationsPOST /api/spotify/create-playlist- Create Spotify playlistPOST /api/spotify/harmony- Calculate harmony percentage
Security Features
- User whitelist: Only specified Spotify users can access the app
- Secure token storage in PostgreSQL database
- Automatic token refresh handling
- Protected API routes with NextAuth session validation
Design Philosophy
Harmony is designed with romance and elegance in mind:
- Pastel color palette: Rose, pink, and purple tones
- Glassmorphism effects: Beautiful frosted glass cards
- Smooth animations: Framer Motion for fluid interactions
- Romantic touches: Heart animations, floating elements, gradient text
- Responsive design: Works perfectly on all devices
Contributing
This is a personal project, but feel free to fork and customize for your own use!
License
MIT License - feel free to use this for your own romantic musical adventures! 💕
Made with 💕 for couples who love music together