Beat in Box is a modern web application for discovering, playing, and managing music. Built with Next.js and featuring a sleek user interface, it provides a seamless music streaming experience with playlist management capabilities.
-
🎵 Music Streaming
- YouTube Music integration for vast music library
- High-quality audio playback
- Background playback support
- Queue management and playlist shuffling
- Continuous playback between tracks
-
👤 User Experience
- User authentication with Google OAuth
- Personalized playlists and recommendations
- Cross-device synchronization
- Dark theme UI
- Responsive design for all devices
-
📝 Playlist Management
- Create unlimited playlists
- Add/remove songs from playlists
- Reorder songs within playlists
- Share playlists with other users
- Import/export playlist functionality
-
🔍 Search & Discovery
- Advanced search for songs, artists, and videos
- Real-time search suggestions
- Filter results by type
- Artist page with top songs and albums
- Related artists recommendations
-
🎮 Player Controls
- Play/pause/skip controls
- Volume control and mute option
- Progress bar with seek functionality
- Shuffle and repeat modes
- Mini player mode
-
📱 Mobile Features
- Touch-optimized interface
- Swipe gestures for navigation
- Picture-in-picture support
- Mobile notifications
- Offline mode support
-
🔄 Integration & Sync
- YouTube Music synchronization
- Real-time updates across devices
- Social media sharing
- Last played position memory
- Watch history tracking
-
🛠 Technical Features
- Server-side rendering
- API rate limiting
- Image proxy for optimization
- Error tracking and logging
- Performance monitoring
- Node.js 16.x or later
- PostgreSQL database
- npm or yarn package manager
- Clone the repository:
git clone https://github.com/yourusername/beatinbox.git
cd beatinbox- Install dependencies:
npm install
# or
yarn install- Set up environment variables:
Create a
.envfile in the root directory with the following variables:
DATABASE_URL="postgresql://username:password@localhost:5432/beatinbox"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
YOUTUBE_API_KEY="your-youtube-api-key"- Initialize the database:
npx prisma migrate dev- Run the development server:
npm run dev
# or
yarn devThe application will be available at http://localhost:3000.
For production deployment, you can use:
- Vercel (Recommended):
npm run build
vercel deploy- Docker:
docker build -t beatinbox .
docker run -p 3000:3000 beatinbox- Manual Deployment:
npm run build
npm startAdditional environment variables for production:
NODE_ENV="production"
VERCEL_URL="your-domain.com"
POSTGRES_PRISMA_URL="your-production-db-url"
POSTGRES_URL_NON_POOLING="your-non-pooling-db-url"Beat in Box provides a RESTful API for interacting with the application. The API documentation is available at /api-docs when running the application.
Most API endpoints require authentication. Use the following authentication methods:
- Session-based Authentication: For browser-based access
- JWT Authentication: For API access
POST /api/auth/registerRegister a new user.
Request Body
{
"email": "string",
"password": "string",
"name": "string"
}POST /api/auth/reset-passwordRequest a password reset.
Request Body
{
"email": "string"
}GET /api/youtubemusic
Search YouTube Music.
**Parameters**
- `q` (required): Search query
- `type` (required): Type of search ('song', 'video', 'artist')
```http
GET /api/artist-insights
Get detailed artist information.
Request Body
{
"browseId": "string"
}GET /api/proxy-imageProxy for fetching images from external sources.
Parameters
url(required): URL of the original image
GET /api/playlistsGet all playlists for the authenticated user.
Response
[
{
"id": "string",
"name": "string",
"userId": "string"
}
]POST /api/playlistsCreate a new playlist.
Request Body
{
"name": "string"
}POST /api/playlists/{playlistId}/songsAdd a song to a playlist.
Request Body
{
"id": "string",
"title": "string",
"artist": "string",
"thumbnail": "string"
}GET /api/search?q={query}Search for music content.
Parameters
q(required): Search query string
Response
{
"artists": [],
"songs": [],
"videos": []
}GET /api/videosGet a list of videos.
Beat in Box provides an interactive Swagger UI interface that allows you to explore and test the API. You can access it at:
- Development:
http://localhost:3000/api-docs - Production:
https://beatinbox.com/api-docs
The Swagger UI interface allows you to:
- Browse all available API endpoints
- View detailed request/response schemas
- Test API endpoints directly in the browser
- Generate code snippets for various languages
- Authenticate and test protected endpoints
To use the Swagger interface:
- Start the development server
- Navigate to
http://localhost:3000/api-docs - Click "Authorize" to add your authentication token
- Expand any endpoint to see details and test it
- Try out endpoints with the interactive "Try it out" button
You can also test the API using tools like Postman or cURL:
Example cURL request:
curl -X GET "http://localhost:3000/api/playlists" \
-H "Authorization: Bearer YOUR_TOKEN"For local development, the Swagger UI at localhost:3000/api-docs provides the most convenient way to test and explore the API functionality. For testing the production API, visit https://beatinbox.com/api-docs.
Note: Some API endpoints may have different rate limits or authentication requirements in production. Always refer to the live documentation at https://beatinbox.com/api-docs for the most up-to-date API specifications.
- Node.js 16.x or later
- PostgreSQL 12.x or later
- Modern web browser with JavaScript enabled
- Minimum 1GB RAM for development
- 2GB+ free disk space
Beat in Box is built with:
- Frontend: Next.js 13+ with App Router
- Backend: Next.js API Routes
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js
- State Management: Custom store with React Context
- Styling: Tailwind CSS
- API Documentation: Swagger/OpenAPI
beatinbox/
├── src/
│ ├── app/ # Next.js 13+ app directory
│ │ ├── api/ # API routes
│ │ ├── auth/ # Authentication pages
│ │ ├── components/ # App-specific components
│ │ └── ... # Other app routes
│ ├── components/ # Shared React components
│ ├── contexts/ # React contexts
│ ├── lib/ # Utility functions
│ ├── services/ # External service integrations
│ ├── store/ # State management
│ └── types/ # TypeScript type definitions
├── prisma/
│ ├── schema.prisma # Database schema
│ └── migrations/ # Database migrations
├── public/ # Static assets
└── scripts/ # Utility scripts
-
Local Development
npm run dev
- Hot reload enabled
- API documentation at
/api-docs - Swagger UI for testing
-
Database Updates
# Create a migration npx prisma migrate dev --name your_migration_name # Apply migrations npx prisma migrate deploy # Reset database npx prisma reset
-
Testing
# Run tests npm test # Run tests in watch mode npm run test:watch
-
Code Quality
# Lint code npm run lint # Format code npm run format
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- YouTube Music API integration
- Next.js team for the amazing framework
- All contributors who have helped shape Beat in Box
For support, please open an issue in the GitHub repository or contact the maintainers.