Smart Music Management System for Cafes & Restaurants
Revolutionizing cafe ambiance with intelligent music automation and customer interaction
Features β’ Installation β’ Usage β’ Tech Stack β’ Contributing
Cafe Tone is an innovative music management system specifically designed for cafes and restaurants. It combines the power of Spotify Web Playback SDK with intelligent automation features, creating the perfect ambiance while respecting cultural and religious practices.
- πΌ Automated Ambiance: Set different music genres for breakfast, lunch, and dinner times
- π Cultural Sensitivity: Auto-pause during prayer times (Adhan detection)
- π± Customer Engagement: QR-based music request system with tiered access
- ποΈ Full Control: Admin dashboard with real-time playback control
- βοΈ Cloud-Based: No local music storage needed - powered by Spotify
- Regular Customers: Basic music request access via QR code
- VIP Customers: Priority requests + exclusive features
- Admin: Full control over playback and system settings
π
Morning (06:00-11:00) β Jazz, Acoustic, Chill
π€οΈ Afternoon (11:00-17:00) β Pop, Indie, Lounge
π Evening (17:00-22:00) β Smooth Jazz, R&B
π Night (22:00-06:00) β Ambient, Classical
- Automatic detection of Adhan (Islamic call to prayer)
- Auto-pause music during prayer times
- Configurable for multiple prayer schedules
- Respectful of religious practices
- Scan QR β Search Music β Submit Request
- Queue management system
- Request history tracking
- Anti-spam protection
- Play/Pause/Next/Previous
- Volume control
- Seek to position
- Device management
- Live now playing display
- Recently played tracks
- User's top tracks
- Personalized playlists
- Featured playlists by country
- Laravel 11.x - Modern PHP framework
- MySQL - Relational database
- Spotify Web API - Music streaming service
- Guzzle HTTP - API client
- React 18.x - UI library
- Inertia.js - SPA framework
- Tailwind CSS - Utility-first CSS
- Spotify Web Playback SDK - In-browser playback
- Vite - Fast build tool
- Composer - PHP dependency manager
- NPM - JavaScript package manager
- PHP 8.2+
- Composer
- Node.js 18+
- MySQL 8.0+
- Spotify Premium Account
- Spotify Developer Application
git clone https://github.com/yourusername/cafe-tone.git
cd cafe-tone# Install PHP dependencies
composer install
# Install JavaScript dependencies
npm install# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generate- Go to Spotify Developer Dashboard
- Create a new application
- Add redirect URI:
http://localhost:8000/spotify/callback - Copy Client ID and Client Secret to
.env:
SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret
SPOTIFY_REDIRECT_URI=http://localhost:8000/spotify/callback# Configure database in .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cafe_tone
DB_USERNAME=root
DB_PASSWORD=
# Run migrations
php artisan migrate# Build frontend assets
npm run build
# Start development server
php artisan serve
# For development with hot reload
npm run devVisit: http://localhost:8000
-
Connect Spotify Account
- Click "Connect Spotify" on login page
- Authorize the application
- Your account is now linked
-
Control Playback
- Use player controls in dashboard
- Browse and play from your playlists
- Monitor currently playing track
-
Manage Time-Based Genres
- Set genre preferences for different time slots
- System automatically switches genres
-
Configure Prayer Times
- Set local prayer schedule
- Enable/disable auto-pause feature
-
Scan QR Code
- Find QR code displayed in cafe
- Scan with any QR reader
-
Search & Request
- Search for your favorite song
- Submit request
- Wait for admin approval (VIP gets priority)
-
Track Your Request
- View request status
- See queue position
cafe-tone/
βββ app/
β βββ Http/
β β βββ Controllers/
β β β βββ Admin/
β β β β βββ AdminHomeController.php
β β β β βββ AdminPlaylistController.php
β β β β βββ AdminSearchController.php
β β β βββ SpotifyController.php
β β βββ Middleware/
β βββ Models/
β β βββ SpotifyTokenModel.php
β β βββ User.php
β βββ Services/
β βββ SpotifyService.php # Core Spotify API integration
βββ resources/
β βββ js/
β βββ Components/
β β βββ SpotifyPlayer.jsx # Web Playback SDK wrapper
β β βββ MusicCard.jsx
β β βββ Navbar.jsx
β βββ Pages/
β β βββ HomeAdmin.jsx
β β βββ PlaylistDetail.jsx
β β βββ Search.jsx
β βββ Hooks/
β βββ useSpotifyConnection.js
βββ routes/
β βββ web.php # Application routes
βββ database/
βββ migrations/ # Database schema
'streaming', // Web Playback SDK
'user-read-playback-state', // Read playback state
'user-modify-playback-state', // Control playback
'user-read-currently-playing', // Get current track
'playlist-read-private', // Read private playlists
'user-top-read', // Get top tracks
'user-read-recently-played' // Get history/me/player- Playback control/me/playlists- User playlists/me/top/tracks- Top tracks/me/player/recently-played- History/browse/featured-playlists- Discover/search- Search tracks
Edit config/prayer-times.php:
return [
'fajr' => '04:30',
'dhuhr' => '12:00',
'asr' => '15:15',
'maghrib' => '18:00',
'isha' => '19:15',
];Edit config/music-schedule.php:
return [
'morning' => ['jazz', 'acoustic', 'chill'],
'afternoon' => ['pop', 'indie', 'lounge'],
'evening' => ['smooth-jazz', 'rnb'],
'night' => ['ambient', 'classical'],
];This project uses Spotify Web API which is NOT licensed for commercial use.
According to Spotify Developer Terms of Service:
β Prohibited Uses:
- Commercial use in public spaces (cafes, restaurants, retail stores, etc.)
- Broadcasting music to multiple users simultaneously
- Using Spotify as background music for business operations
If you want to use this system commercially in your cafe or restaurant, you should use:
Spotify Soundtrack for Business
- β Licensed for commercial use
- β Curated playlists for business
- β Legal background music streaming
- β No ads interruption
- β Multiple device support
I can rework this project to use Soundtrack API for commercial deployment.
If you're interested in using Cafe Tone for your business:
- Sign up for Spotify Soundtrack
- Contact me for commercial version adaptation
- Get proper licensing for your business
Contact for Commercial Version:
- Email: [email protected]
- GitHub Issues: Create an issue
This project is intended for:
- β Educational purposes
- β Personal development learning
- β Portfolio demonstration
- β Non-commercial experimentation
NOT for:
- β Commercial deployment without proper licensing
- β Public business use with standard Spotify API
- β Revenue-generating applications
By using this code, you agree to comply with Spotify's Terms of Service and applicable copyright laws.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name
- GitHub: @yourusername
- Email: [email protected]
Made with β€οΈ for cafes everywhere
β Star this repo if you find it useful!