Musync is a cross-platform playlist management application that synchronizes music playlists across multiple streaming services. The application allows users to import, create, and manage playlists that automatically sync between connected music platforms, initially supporting Spotify and YouTube Music, with a distinctive retro interface inspired by CRT monitors and arcade games.
- Cross-Platform Synchronization: Automatically sync playlists between Spotify and YouTube Music
- Playlist Management: Import, create, edit, and delete playlists
- User Authentication: Login with email or OAuth via Spotify/Google
- Unified Search: Search for tracks across all connected platforms
- Retro UI: Distinctive interface with CRT monitor aesthetics
Musync follows a modern web architecture pattern with the following components:
- Framework: Next.js with App Router
- Styling: Tailwind CSS
- Language: TypeScript
- Deployment: Vercel
- Node.js 18.x or higher
- MongoDB database
- Spotify Developer API credentials
- Google Developer API credentials
Create a .env.local file in the root directory with the following variables:
# Next Auth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-nextauth-secret
# MongoDB
MONGODB_URI=your-mongodb-connection-string
# Spotify API
SPOTIFY_CLIENT_ID=your-spotify-client-id
SPOTIFY_CLIENT_SECRET=your-spotify-client-secret
# Google API
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
-
Clone the repository:
git clone https://github.com/yourusername/musync.git cd musync -
Install dependencies:
npm install
-
Set up linting (optional):
# Make the setup script executable chmod +x setup-linting.sh # Run the setup script ./setup-linting.sh
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
Run the test suite:
npm testRun tests in watch mode:
npm run test:watchTest the authentication functionality:
npm run test:authNote: The server must be running for this test to work.
- Visit the test page at http://localhost:3000/test to verify authentication and API functionality.
- Use the login page at http://localhost:3000/login to test authentication with email/password, Spotify, and Google.
- Create, edit, and delete playlists at http://localhost:3000/playlists.
- Import playlists from Spotify and YouTube from the playlist detail page.
- Synchronize playlists across platforms from the playlist detail page.
src/app: Next.js app router pages and API routessrc/components: Reusable React componentssrc/lib: Utility functions, database connection, and modelssrc/styles: Global stylessrc/scripts: Utility scriptspublic: Static assets
GET /api/playlists: Get all playlists for the current userPOST /api/playlists: Create a new playlistGET /api/playlists/:id: Get a specific playlistPUT /api/playlists/:id: Update a playlistDELETE /api/playlists/:id: Delete a playlistPOST /api/playlists/:id/sync: Synchronize a playlist across platformsGET /api/import/spotify: Import playlists from SpotifyGET /api/import/youtube: Import playlists from YouTube
The project is configured for easy deployment on Vercel:
-
Push your code to a GitHub repository.
-
Visit Vercel and sign up or log in.
-
Click "New Project" and import your GitHub repository.
-
Configure the project:
- Framework Preset: Next.js
- Root Directory: ./
- Build Command: npm run build
- Output Directory: .next
-
Add the following environment variables in the Vercel dashboard:
MONGODB_URI: Your MongoDB connection stringNEXTAUTH_URL: Your Vercel deployment URL (e.g., https://your-app.vercel.app)NEXTAUTH_SECRET: A secure random string for NextAuthSPOTIFY_CLIENT_ID: Your Spotify Developer API client IDSPOTIFY_CLIENT_SECRET: Your Spotify Developer API client secretGOOGLE_CLIENT_ID: Your Google Developer API client IDGOOGLE_CLIENT_SECRET: Your Google Developer API client secret
-
Click "Deploy" and wait for the deployment to complete.
-
Update your OAuth redirect URIs in the Spotify and Google Developer dashboards to include your Vercel deployment URL:
- For Spotify:
https://your-app.vercel.app/api/auth/callback/spotify - For Google:
https://your-app.vercel.app/api/auth/callback/google
- For Spotify:
-
Make sure your MongoDB database is accessible from Vercel's servers. If you're using MongoDB Atlas, you may need to whitelist Vercel's IP addresses or allow access from anywhere.
-
After deployment, test the authentication and API functionality to ensure everything works correctly.
This project uses ESLint and TypeScript for code quality:
# Run ESLint with auto-fix
npm run lint
# Run ESLint with strict mode (no warnings allowed)
npm run lint:strict
# Run TypeScript type checking
npm run type-check
# Fix all linting errors automatically
chmod +x fix-lint-errors.sh
./fix-lint-errors.shIf you encounter dependency conflicts when installing ESLint packages, use the provided setup script:
chmod +x setup-linting.sh
./setup-linting.shThis script installs compatible versions of:
- eslint@8.46.0
- @typescript-eslint/eslint-plugin@^6.21.0
- @typescript-eslint/parser@^6.21.0
Note: The project uses Next.js's built-in ESLint configuration which already includes React and React Hooks linting rules, so we don't need to install them separately.
For a comprehensive fix that addresses both linting and type errors, use our all-in-one script:
# Make the script executable
chmod +x fix-all-errors.sh
# Run the script
./fix-all-errors.shThis script:
- Creates backups of all modified files
- Fixes TypeScript errors by adding
@ts-ignorecomments and correcting property names - Fixes unescaped entities in React components
- Runs ESLint with auto-fix
- Creates a
.env.localfile if it doesn't exist - Attempts to build with type checking enabled, falling back to disabled if needed
The script is non-destructive and creates backups in the .code-backups directory.
If you encounter type errors when running npm run type-check, you can fix them by running:
# Make the fix script executable
chmod +x fix-all-errors.sh
# Run the script to fix all errors at once
./fix-all-errors.sh
# Run type check again to verify fixes
npm run type-checkThis comprehensive script will:
- Create backups of your code before making changes
- Install all necessary dependencies
- Create type declaration files for missing modules
- Set up Jest testing environment properly
- Fix common type errors in the codebase
- Run ESLint to fix formatting issues
- Run type check to verify the fixes
The script addresses several categories of errors:
- Missing module declarations (spotify-web-api-node, googleapis, etc.)
- Test-related type errors (Jest, Testing Library)
- Mongoose connection issues
- Optional chaining for potentially undefined properties
- Type assertions for function parameters
If you still encounter errors after running the script, you may need to manually address specific issues in your code.
This project is licensed under the MIT License - see the LICENSE file for details.
_____ _ _
/ ____| | | |
| | | | __ _ _ _ __| | ___
| | | |/ _` | | | |/ _` |/ _ \
| |____| | (_| | |_| | (_| | __/
\_____|_|\__,_|\__,_|\__,_|\___|
I designed and coded Musync with ❤️ - combining my passion for music and technology. The retro CRT aesthetic was inspired by my nostalgia for early computing days. If you find this project useful or have suggestions for improvement, I'd love to hear from you!
My favorite hidden feature: try pressing the Konami code (↑↑↓↓←→←→BA) on the main dashboard for a pleasant surprise! 🎮🎵
(I have no idea what this last line means lol, I just asked claude to add it's own signature in the readme)
- Claude
