21ee7863bcc203a260eb4995d8a13e0d8fca8799
Bitify 🎵
Self-hosted YouTube music streaming application built with Next.js.
Preview
Desktop
Mobile
Playlist
Features
- 🎵 Stream music from YouTube without downloading files
- 🎨 Beautiful dark mode interface
- 📱 Fully responsive design (mobile & desktop)
- 🎮 Full playback controls (play, pause, next, previous, shuffle)
- 🔊 Volume control with visual feedback
- 📊 Progress bar with seeking and time display
- 🎼 Create and manage playlists
- 🌐 Global player - music continues playing across page navigation
- 🔔 Toast notifications for user feedback
- 🗂️ SQLite database for song and playlist management
- 🐳 Easy Docker deployment
Tech Stack
- Frontend & Backend: Next.js 15 (App Router)
- Styling: Tailwind CSS v4
- Database: SQLite with Prisma ORM
- Audio Streaming: yt-dlp
- Icons: Lucide React
- Containerization: Docker
Prerequisites
- Node.js 20+ (for local development)
- Docker & Docker Compose (for deployment)
- Python 3 & yt-dlp (installed automatically in Docker)
Local Development
-
Install dependencies:
npm install -
Set up the database:
npx prisma generate npx prisma db push -
Install yt-dlp:
pip install yt-dlp -
Run the development server:
npm run dev -
Open your browser: Navigate to http://localhost:3000
Docker Deployment
-
Build and run with Docker Compose:
docker-compose up -d -
Access the application: Navigate to http://localhost:3000
-
Stop the application:
docker-compose down
Usage
- Add a song: Paste a YouTube URL in the input field and click "Add"
- Play a song: Click the play button on any song card
- Control playback: Use the player controls at the bottom of the page
- Create playlists: Navigate to Playlists and create your custom collections
- Shuffle mode: Toggle shuffle to randomize playback order
- Navigate freely: Music continues playing as you browse different pages
API Endpoints
POST /api/songs- Add a new song from YouTube URLGET /api/songs- Get all songs from libraryDELETE /api/songs- Remove a song from libraryGET /api/stream/[id]- Get streaming URL for a songGET /api/playlists- Get all playlistsPOST /api/playlists- Create a new playlistGET /api/playlists/[id]- Get a specific playlist with songsPUT /api/playlists/[id]- Update playlist nameDELETE /api/playlists/[id]- Delete a playlistPOST /api/playlists/[id]/songs- Add a song to playlistDELETE /api/playlists/[id]/songs- Remove a song from playlistPOST /api/admin/update- Update yt-dlp to the latest version
Project Structure
bitify/
├── app/
│ ├── api/
│ │ ├── admin/update/
│ │ ├── playlists/
│ │ │ └── [id]/
│ │ ├── songs/
│ │ └── stream/[id]/
│ ├── playlists/
│ │ ├── [id]/
│ │ └── page.tsx
│ ├── globals.css
│ ├── icon.svg
│ ├── layout.tsx
│ ├── page.tsx
│ └── slider.css
├── components/
│ ├── GlobalPlayer.tsx
│ ├── Header.tsx
│ ├── Navbar.tsx
│ ├── PlayerBar.tsx
│ ├── PlayerContext.tsx
│ ├── SongCard.tsx
│ └── Toast.tsx
├── lib/
│ ├── prisma.ts
│ └── ytdlp.ts
├── prisma/
│ └── schema.prisma
├── docker-compose.yml
├── Dockerfile
├── next.config.js
├── package.json
└── tsconfig.json
Environment Variables
The application uses SQLite by default. The database file is stored at prisma/dev.db.
You can customize the database location by setting the DATABASE_URL environment variable:
DATABASE_URL="file:./dev.db"
Notes
- Audio files are never downloaded to the server
- Streaming URLs are dynamically generated using
yt-dlp -g -f bestaudio - The application requires
yt-dlpandffmpegto be installed - Database automatically initializes on first run
License
MIT
Author
Built with ❤️ using Next.js and yt-dlp
Languages
TypeScript
95.8%
CSS
1.7%
Dockerfile
1.6%
JavaScript
0.9%


