Illyism/musicplayer.io

:musical_note: A free and open-source streaming music web player using data from Reddit

โ˜… 440Forks 62TypeScriptGitHub โ†—Compare

Project website โ†—

coffeescriptplayerredditsoundcloudyoutube

README

Music Player for Reddit

A free and open-source streaming music web player using data from Reddit.

๐Ÿ“ฆ Repository Structure

This repository contains two versions:

  • main branch (default): Modern Next.js 16/React/TypeScript implementation
  • coffeescript branch: Legacy CoffeeScript/Backbone.js version (v0.6.14)

The main branch is the active development branch with all the latest features and improvements.

๐Ÿš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/musicplayer-io/musicplayer.io.git
cd musicplayer.io

# Install dependencies
npm install

# Set up environment variables
cp .env.local.example .env.local
# Edit .env.local with your Reddit OAuth credentials (optional, for voting/commenting)

# Run development server
npm run dev

# Build for production
npm run build
npm start

The app will be available at http://localhost:3000

โœจ Features

  • ๐ŸŽต Music Playback - Support for YouTube, SoundCloud, Vimeo, and MP3
  • ๐Ÿ” Reddit Search - Search Reddit for music
  • ๐Ÿ“ฑ Mobile Friendly - Responsive design with mobile navigation
  • โŒจ๏ธ Keyboard Shortcuts - Space for play/pause, Ctrl+Arrows for navigation
  • ๐Ÿ” Reddit Authentication - Login to vote and comment
  • ๐Ÿ’พ LocalStorage - Saves your subreddit preferences
  • ๐Ÿ”— Share Playlists - Share your custom playlists
  • ๐ŸŽจ Modern UI - Built with Next.js 16, React, and Tailwind CSS

๐Ÿ› ๏ธ Tech Stack

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • UI Components: shadcn/ui (Radix UI)
  • State Management: Zustand
  • Icons: Lucide React

๐Ÿ“‹ Requirements

  • Node.js 22+
  • npm or yarn
  • Reddit OAuth app (optional, for authentication features)

๐Ÿ”ง Configuration

Reddit OAuth (Optional)

To enable authentication, voting, and comment posting:

  1. Create a Reddit OAuth app at https://www.reddit.com/prefs/apps
  2. Set redirect URI: http://localhost:3000/api/auth/reddit/callback
  3. Add to .env.local:
    REDDIT_CLIENT_ID=your_client_id
    REDDIT_CLIENT_SECRET=your_client_secret
    REDDIT_REDIRECT_URI=http://localhost:3000/api/auth/reddit/callback

See SETUP.md for detailed setup instructions.

๐Ÿ“– Usage

Basic Usage

  1. Browse Subreddits: Click on subreddits in the left panel to add them to your playlist
  2. Play Music: Click any song in the playlist to start playing
  3. Search: Use the search bar to find music on Reddit
  4. Sort: Change sort method (Hot, New, Top) in the playlist panel
  5. Share: Click "Share" button to share your playlist

Keyboard Shortcuts

  • Space - Play/Pause
  • Ctrl + โ†’ - Next song
  • Ctrl + โ† - Previous song
  • Ctrl + โ†‘ - Volume up
  • Ctrl + โ†“ - Volume down

URL Parameters

  • /r/listentothis - Load specific subreddit
  • /r/listentothis+music - Load multiple subreddits
  • ?r=listentothis - Query parameter format

๐Ÿ—๏ธ Project Structure

musicplayer.io/
โ”œโ”€โ”€ app/                    # Next.js App Router
โ”‚   โ”œโ”€โ”€ api/               # API routes (12 routes)
โ”‚   โ”œโ”€โ”€ r/                 # Dynamic subreddit routes
โ”‚   โ”œโ”€โ”€ remote/            # Remote control page
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout
โ”‚   โ”œโ”€โ”€ page.tsx           # Home page
โ”‚   โ””โ”€โ”€ globals.css        # Global styles
โ”‚
โ”œโ”€โ”€ components/            # React components
โ”‚   โ”œโ”€โ”€ players/          # Music players (4)
โ”‚   โ”œโ”€โ”€ ui/               # shadcn/ui components
โ”‚   โ””โ”€โ”€ *.tsx             # Feature components (11)
โ”‚
โ”œโ”€โ”€ lib/                   # Utilities & business logic
โ”‚   โ”œโ”€โ”€ auth/             # Authentication
โ”‚   โ”œโ”€โ”€ hooks/            # Custom hooks (5)
โ”‚   โ”œโ”€โ”€ utils/           # Utilities
โ”‚   โ”œโ”€โ”€ store.ts         # Zustand store
โ”‚   โ””โ”€โ”€ constants.ts     # Constants
โ”‚
โ”œโ”€โ”€ public/               # Static assets
โ”‚   โ””โ”€โ”€ images/          # Images & icons
โ”‚
โ””โ”€โ”€ [config files]        # Root level configs

๐Ÿงช Development

# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Lint code
npm run lint

๐Ÿ“ Migration Status

This project has been migrated from CoffeeScript/Backbone.js to Next.js 16/React/TypeScript.

Conversion Progress: 100% complete - All features fully functional!

The original CoffeeScript/Backbone.js codebase is preserved in the coffeescript branch for reference.

๐Ÿค Contributing

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

๐Ÿ“„ License

Oโ€™Saasy ยฉ Ilias Ism

๐Ÿ™ Acknowledgments

Contributors

Illyismmdanassaif

Issues