Skip to content

BruceFloyd/mixtape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽต Mixtape - Spotify-Powered Cassette Tape Experience

Create beautiful, shareable mixtapes presented as animated retro cassette tapes. Connect with Spotify, curate your perfect playlist, and share it with friends through a nostalgic cassette player interface.

Mixtape Demo

โœจ Features

  • ๐Ÿ” Spotify OAuth Integration - Secure authentication with Spotify
  • ๐Ÿ” Track Search - Search millions of songs from Spotify's library
  • ๐ŸŽจ Retro Cassette UI - Beautiful animated cassette tape with spinning reels
  • ๐ŸŽต Web Playback - Stream music directly using Spotify's Web Playback SDK
  • ๐Ÿ”— Shareable Links - Each mixtape gets a unique URL to share
  • ๐Ÿ“ฑ Mobile Responsive - Works beautifully on all devices
  • ๐Ÿ’พ Dual Database Support - PostgreSQL for production, SQLite for local development
  • ๐ŸŽญ Personalization - Add custom titles and messages to your mixtapes
  • โ˜๏ธ Cloud Ready - One-click deploy to Railway + Vercel

๐Ÿš€ Tech Stack

Frontend

  • React 18 - UI library
  • Vite - Fast build tool and dev server
  • React Router - Client-side routing
  • Axios - HTTP client
  • Spotify Web Playback SDK - Music streaming

Backend

  • Node.js - Runtime environment
  • Express - Web server framework
  • PostgreSQL / SQLite - Database (PostgreSQL in production, SQLite for local dev)
  • Spotify Web API - Music data and authentication

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have:

  • Node.js 18+ installed (Download)
  • A Spotify Premium account (required for Web Playback SDK)
  • A Spotify Developer account (Sign up)

๐Ÿ› ๏ธ Installation & Setup

1. Clone the Repository

```bash git clone cd mixtape ```

2. Set Up Spotify Developer App

  1. Go to Spotify Developer Dashboard
  2. Click "Create App"
  3. Fill in the details:
  4. Save your app
  5. Copy your Client ID and Client Secret

3. Configure Backend

```bash cd backend npm install cp .env.example .env ```

Edit `.env` with your Spotify credentials:

```env SPOTIFY_CLIENT_ID=your_client_id_here SPOTIFY_CLIENT_SECRET=your_client_secret_here FRONTEND_URL=http://localhost:5173 BACKEND_URL=http://localhost:3000 REDIRECT_URI=http://localhost:3000/api/auth/callback SESSION_SECRET=generate_a_random_string_here PORT=3000 ```

4. Configure Frontend

```bash cd ../frontend npm install ```

5. Start the Application

Open two terminal windows:

Terminal 1 - Backend: ```bash cd backend npm run dev ```

Terminal 2 - Frontend: ```bash cd frontend npm run dev ```

6. Open in Browser

Navigate to: http://localhost:5173

๐ŸŽฎ How to Use

Creating a Mixtape

  1. Connect with Spotify - Click "Connect with Spotify" on the home page
  2. Authorize - Grant permissions to the app
  3. Search for Songs - Use the search bar to find tracks
  4. Build Your Mixtape - Add up to 20 tracks
  5. Customize - Add a title and optional message
  6. Create - Click "Create Mixtape" to generate your shareable link

Sharing a Mixtape

  1. Copy the unique URL from the success screen
  2. Share it with friends via text, email, or social media
  3. Recipients can listen by logging in with their Spotify account

Playing a Mixtape

  1. Click on a mixtape link
  2. Login with Spotify (if not already logged in)
  3. Press play on the cassette player
  4. Use controls to navigate through tracks

๐ŸŽจ Customization

Color Themes

Edit the CSS variables in /frontend/src/index.css:

```css :root { --orange: #ff6b35; --teal: #4ecdc4; --beige: #f7e5d0; --dark-brown: #3d2817; /* ... */ } ```

Cassette Design

Modify the cassette component in:

  • /frontend/src/components/Cassette.jsx
  • /frontend/src/components/Cassette.css

๐Ÿ“ Project Structure

``` mixtape/ โ”œโ”€โ”€ backend/ โ”‚ โ”œโ”€โ”€ db/ โ”‚ โ”‚ โ””โ”€โ”€ database.js # SQLite database operations โ”‚ โ”œโ”€โ”€ routes/ โ”‚ โ”‚ โ”œโ”€โ”€ auth.js # Spotify OAuth routes โ”‚ โ”‚ โ”œโ”€โ”€ mixtapes.js # Mixtape CRUD routes โ”‚ โ”‚ โ””โ”€โ”€ spotify.js # Spotify API routes โ”‚ โ”œโ”€โ”€ server.js # Express server โ”‚ โ”œโ”€โ”€ package.json โ”‚ โ””โ”€โ”€ .env โ”œโ”€โ”€ frontend/ โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ components/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Cassette.jsx # Cassette UI component โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Cassette.css โ”‚ โ”‚ โ”œโ”€โ”€ context/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ AuthContext.jsx # Auth state management โ”‚ โ”‚ โ”œโ”€โ”€ pages/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Home.jsx # Landing page โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Create.jsx # Mixtape creation โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ MixtapePlayer.jsx # Playback page โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ MyMixtapes.jsx # User's mixtapes โ”‚ โ”‚ โ”œโ”€โ”€ utils/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ api.js # API client โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ spotify.js # Spotify SDK utilities โ”‚ โ”‚ โ”œโ”€โ”€ App.jsx โ”‚ โ”‚ โ”œโ”€โ”€ main.jsx โ”‚ โ”‚ โ””โ”€โ”€ index.css โ”‚ โ”œโ”€โ”€ index.html โ”‚ โ”œโ”€โ”€ vite.config.js โ”‚ โ””โ”€โ”€ package.json โ””โ”€โ”€ README.md ```

๐Ÿ”ง API Endpoints

Authentication

  • `GET /api/auth/login` - Initiate Spotify OAuth
  • `GET /api/auth/callback` - OAuth callback handler
  • `GET /api/auth/me` - Get current user
  • `POST /api/auth/refresh` - Refresh access token
  • `POST /api/auth/logout` - Logout user

Spotify

  • `GET /api/spotify/search?q={query}` - Search tracks
  • `GET /api/spotify/playlists` - Get user playlists
  • `GET /api/spotify/playlists/:id/tracks` - Get playlist tracks

Mixtapes

  • `POST /api/mixtapes` - Create new mixtape
  • `GET /api/mixtapes/:slug` - Get mixtape by slug
  • `POST /api/mixtapes/:id/play` - Increment play count
  • `GET /api/mixtapes/user/mine` - Get user's mixtapes

๐Ÿ› Troubleshooting

"Premium Required" Error

The Spotify Web Playback SDK requires a Premium subscription. Free accounts cannot stream music.

Player Not Initializing

  1. Check that you have Spotify Premium
  2. Verify your access token is valid
  3. Check browser console for errors
  4. Try refreshing the page

OAuth Redirect Issues

  1. Verify redirect URI in Spotify Dashboard matches your `.env`
  2. Ensure backend is running on the correct port
  3. Clear cookies and try again

Database Errors

If you encounter database issues: ```bash cd backend rm db/mixtapes.db # Delete the database npm start # Restart - database will be recreated ```

๐Ÿš€ Deployment

Quick Deploy to Railway + Vercel (Recommended)

We've made deployment super easy! Follow our comprehensive deployment guide:

๐Ÿ“– Read the Full Deployment Guide โ†’

Overview

Backend โ†’ Railway

  • Free tier includes PostgreSQL database
  • Automatic deployments from GitHub
  • Environment variable management
  • SSL included

Frontend โ†’ Vercel

  • Free tier with unlimited deployments
  • Automatic builds and deployments
  • Global CDN
  • SSL included

Quick Setup Summary

  1. Deploy Backend to Railway

    • Connect your GitHub repo
    • Set root directory to backend
    • Add PostgreSQL database
    • Configure environment variables
    • Get your backend URL
  2. Deploy Frontend to Vercel

    • Connect your GitHub repo
    • Set root directory to frontend
    • Add VITE_API_URL environment variable
    • Get your frontend URL
  3. Update Spotify App

    • Add production redirect URI
    • Update website URL

That's it! Every git push automatically deploys your changes.

For detailed step-by-step instructions with screenshots and troubleshooting, see DEPLOYMENT.md

Alternative Deployment Options

  • Docker: Use the provided configuration (coming soon)
  • Other PaaS: Render, Fly.io, Heroku all work similarly
  • VPS: Requires manual setup with PM2 or similar

๐Ÿ“ License

MIT License - feel free to use this project for personal or commercial purposes!

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ’– Credits

๐Ÿ“ง Support

If you encounter any issues or have questions:

  1. Check the Troubleshooting section above
  2. Review Spotify Web API docs
  3. Open an issue on GitHub

Made with ๐ŸŽต by [Your Name]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published