A modern, elegant music streaming web application powered by the Spotify API. Melodine provides a beautiful interface to explore your music library, discover new tracks, and manage your playlists with a sleek, responsive design.
- 🎵 Spotify Integration - Full access to your Spotify library and playlists
- 🎨 Modern UI - Beautiful, responsive design with smooth animations
- 🔍 Music Discovery - Search for tracks, artists, albums, and playlists
- 📱 Mobile Responsive - Optimized for all device sizes
- 🎭 Personalized Experience - View your top artists, recent plays, and recommendations
- 🔐 Secure Authentication - OAuth integration with Spotify
- ⚡ Fast Performance - Built with Next.js 15 and modern web technologies
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS 4
- Authentication: NextAuth.js with Spotify OAuth
- State Management: Zustand
- Data Fetching: TanStack Query (React Query)
- Animations: Framer Motion
- Package Manager: pnpm
- Deployment: Docker, GitHub Actions
Before running this project, make sure you have:
- Node.js 20 or higher
- pnpm (recommended) or npm
- A Spotify Developer Account
- Docker (for containerized deployment)
git clone https://github.com/lxnid/melodine.git
cd melodinecd apppnpm install
# or
npm installCreate a .env.local file in the app directory with the following variables:
# Spotify API Configuration
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
# NextAuth Configuration
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_nextauth_secret_key- Go to the Spotify Developer Dashboard
- Create a new app or use an existing one
- Add
http://localhost:3000/api/auth/callback/spotifyto your app's redirect URIs - Copy your Client ID and Client Secret to the
.env.localfile
Start the development server:
pnpm dev
# or
npm run devOpen http://localhost:3000 in your browser.
pnpm build
pnpm start
# or
npm run build
npm startBuild and run with Docker:
# Build the image
docker build -t melodine .
# Run the container
docker run -p 3000:3000 \
-e SPOTIFY_CLIENT_ID=your_client_id \
-e SPOTIFY_CLIENT_SECRET=your_client_secret \
-e NEXTAUTH_URL=https://your-domain.com \
-e NEXTAUTH_SECRET=your_secret \
melodine| Variable | Description | Required |
|---|---|---|
SPOTIFY_CLIENT_ID |
Your Spotify app's client ID | Yes |
SPOTIFY_CLIENT_SECRET |
Your Spotify app's client secret | Yes |
NEXTAUTH_URL |
The canonical URL of your site | Yes |
NEXTAUTH_SECRET |
Secret key for NextAuth.js | Yes |
The application requests the following Spotify scopes:
user-read-email- Access to user's emailuser-read-private- Access to user's profile informationuser-read-playback-state- Read access to user's playback stateuser-modify-playback-state- Write access to user's playback stateuser-read-currently-playing- Read access to currently playing trackuser-read-recently-played- Access to recently played tracksuser-top-read- Access to top artists and tracksplaylist-read-private- Access to private playlistsplaylist-modify-private- Write access to private playlistsplaylist-modify-public- Write access to public playlistsuser-library-read- Access to user's saved tracks and albums
For production deployment:
- Set
NEXTAUTH_URLto your production domain - Update Spotify app redirect URIs to include your production callback URL
- Use a secure
NEXTAUTH_SECRET(generate withopenssl rand -base64 32)
app/
├── src/
│ ├── app/
│ │ ├── (protected)/ # Protected routes requiring authentication
│ │ │ └── dashboard/ # Main dashboard and music features
│ │ ├── api/ # API routes
│ │ │ └── auth/ # NextAuth.js authentication
│ │ ├── globals.css # Global styles
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Landing page
│ └── lib/
│ └── auth.ts # Authentication configuration
├── public/ # Static assets
├── Dockerfile # Docker configuration
├── package.json # Dependencies and scripts
└── tailwind.config.js # Tailwind CSS configuration
We welcome contributions to Melodine! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests and linting:
pnpm lintandpnpm type-check - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow the existing code style and conventions
- Write meaningful commit messages
- Add TypeScript types for new features
- Test your changes thoroughly
- Update documentation as needed
- Use TypeScript for all new code
- Follow React best practices and hooks patterns
- Use Tailwind CSS for styling
- Maintain consistent file and component naming
| Command | Description |
|---|---|
pnpm dev |
Start development server with Turbopack |
pnpm build |
Build for production |
pnpm start |
Start production server |
pnpm lint |
Run ESLint |
pnpm type-check |
Run TypeScript type checking |
The project includes GitHub Actions workflows for:
- Docker Build & Push: Automatically builds and pushes Docker images to GitHub Container Registry
- GitHub Pages: Serves a redirect page to the main application
-
Render.com (Recommended):
- Connect your GitHub repository
- Set environment variables
- Deploy automatically on push to main
-
Vercel:
npx vercel --prod
-
Docker:
docker build -t melodine . docker run -p 3000:3000 melodine
-
Spotify Authentication Fails
- Verify your Spotify app credentials
- Check redirect URIs in Spotify Developer Dashboard
- Ensure
NEXTAUTH_URLmatches your domain
-
Build Errors
- Clear node_modules and reinstall:
rm -rf node_modules && pnpm install - Check Node.js version (requires 20+)
- Clear node_modules and reinstall:
-
API Rate Limits
- Spotify API has rate limits; implement proper error handling
- Consider caching strategies for production
This project is licensed under the MIT License - see the LICENSE file for details.
- Spotify Web API for music data
- Next.js for the React framework
- NextAuth.js for authentication
- Tailwind CSS for styling
- Framer Motion for animations
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join our community discussions
Live Demo: https://melodine.onrender.com