A modern, responsive web-based music player built with Spring Boot and featuring fine-grained authorization using Permit.io.
- Music Management: Browse songs, create playlists, queue management
- Authorization: Fine-grained permissions using Permit.io
- Multi-User Support: Switch between users with different access levels
- Modern UI: Dark theme with responsive design
- Real-time Permissions: Dynamic permission checks for all actions
- Java 17 or higher
- Maven 3.6 or higher
- Permit.io account (free at app.permit.io)
-
Clone the repository
git clone <repository-url> cd springboot-music-player
-
Configure Permit.io
- Create a free account at app.permit.io
- Get your API key from the dashboard
- Update
src/main/resources/application.properties:permit.api.key=YOUR_PERMIT_API_KEY_HERE
-
Run the application
./run.sh
Or manually:
mvn spring-boot:run
-
Access the application Open your browser and navigate to:
http://localhost:8080
The application uses Permit.io to enforce the following permissions:
- playlist: Public and private playlists
- song: Individual songs
- view-public: View public playlists
- view-private: View private playlists
- add-to-playlist: Add songs to playlists
- delete: Remove songs from playlists
- play: Play songs
- add-to-queue: Add songs to playback queue
- Spring Boot: REST API with authorization enforcement
- Permit.io SDK: Real-time permission checks
- In-memory storage: Simple data layer for demo purposes
- Thymeleaf + Bootstrap: Responsive UI
- jQuery: AJAX calls with permission-aware error handling
src/
├── main/
│ ├── java/com/example/musicplayer/
│ │ ├── MusicPlayerApplication.java
│ │ ├── controller/ # REST endpoints with authorization
│ │ ├── model/ # Data models
│ │ └── config/ # Permit.io configuration
│ └── resources/
│ ├── static/ # CSS and JavaScript
│ ├── templates/ # Thymeleaf templates
│ └── application.properties
GET /api/songs- List all songsGET /api/songs/{id}/play- Get song playback URL (requires permission)GET /api/playlists/{id}- Get playlist (requires view permission)POST /api/playlists/{id}/songs- Add song to playlist (requires permission)DELETE /api/playlists/{id}/songs/{songId}- Remove song (requires permission)
This project is open source and available under the MIT License.