SoundStream is a Spotify-like backend application built using Spring Boot.
It models real-world music streaming concepts such as Songs, Artists, Albums, and Playlists, focusing on clean architecture, scalable REST APIs, and best practices with JPA/Hibernate.
This project is designed as a learning + portfolio project demonstrating production-grade backend patterns.
- Overview
- Architecture
- Tech Stack
- Features
- Project Structure
- API Design Principles
- Application Setup
- API Endpoints
- Future Enhancements
- License
SoundStream provides RESTful APIs to manage music content:
- Songs belong to albums
- Songs can have multiple artists
- Artists can collaborate on multiple songs
- Playlists can contain songs from different albums and artists
The project emphasizes:
- DTO-based APIs (no entity exposure)
- Centralized exception handling
- ID-based relationships (no fragile name-based APIs)
- Clean service and repository layers
- Real-world Hibernate/JPA patterns
+------------------------------+
| Client (Postman / Frontend) |
+------------------------------+
|
v
+------------------------------------+
| Spring Boot REST API (SoundStream) |
+------------------------------------+
|
v
+-------------------------------+
| PostgreSQL Database |
+-------------------------------+
- Backend: Spring Boot (Java 17)
- ORM: Spring Data JPA (Hibernate)
- Database: PostgreSQL
- Build Tool: Gradle
- API Testing: Postman
- Logging: SLF4J + Logback
- Containerization: Docker (planned)
- Create songs using
albumIdandartistIds - Fetch songs by ID
- Songs linked to albums and artists
- Create and manage artists
- Prevent duplicate artists (case-insensitive)
- Fetch artists with their songs
- Create albums linked to artists
- Fetch albums and their songs
- Create playlists
- Add/remove songs from playlists
- Fetch playlists songs
src/main/java/org/soundstream
βββ controller
βββ service
β βββ songs
β βββ artists
β βββ albums
β βββ playlists
βββ repository
βββ model
βββ dto
β βββ request
β βββ response
βββ mapper
βββ exception
βββ enum_
βββ config
- Versioned APIs:
/api/v1/... - DTO-based contracts
- No direct entity exposure
- Centralized exception handling using
@ControllerAdvice - Proper HTTP status codes
- ID-based relationships instead of name-based lookups
git clone https://github.com/your-username/soundstream.git
cd soundstream2οΈβ£ Configure Database
Use environment variables for credentials:
spring.datasource.url=jdbc:postgresql://localhost:5432/soundstream
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}3οΈβ£ Run the application
./gradlew bootRun
Application will start at:
http://localhost:8080
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/songs |
Create songs |
| GET | /api/v1/songs/{id} |
Get songs by ID |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/artists |
Create artists |
| GET | /api/v1/artists/{id} |
Get artists by ID |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/albums |
Create albums |
| GET | /api/v1/albums/{id} |
Get albums by ID |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/playlists |
Create playlists |
| POST | /api/v1/playlists/{id}/songs/{songId} |
Add songs to playlists |
| GET | /api/v1/playlists/{id}/songs |
Get playlists songs |
π Future Enhancements
- Swagger / OpenAPI documentation
- Docker & docker-compose support
- Testcontainers for integration testing
- Role-based security (Spring Security)
- MapStruct for DTO mapping
- Load testing & N+1 query optimization
- Native image using GraalVM
π License
This project is licensed under the MIT License. See the LICENSE file for more details.