Skip to content

abheeshtsingh2803/SoundStream

Backend: Spring Boot Java Database Docker License: MIT

🎡 SoundStream – Music Streaming Backend

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.


πŸ“‘ Table of Contents


πŸ“Œ Overview

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

πŸ— Architecture

+------------------------------+
| Client (Postman / Frontend) |
+------------------------------+
              |
              v
+------------------------------------+
| Spring Boot REST API (SoundStream) |
+------------------------------------+
              |
              v
+-------------------------------+
| PostgreSQL Database |
+-------------------------------+

🧰 Tech Stack

  • Backend: Spring Boot (Java 17)
  • ORM: Spring Data JPA (Hibernate)
  • Database: PostgreSQL
  • Build Tool: Gradle
  • API Testing: Postman
  • Logging: SLF4J + Logback
  • Containerization: Docker (planned)

✨ Features

🎡 Songs

  • Create songs using albumId and artistIds
  • Fetch songs by ID
  • Songs linked to albums and artists

🎀 Artists

  • Create and manage artists
  • Prevent duplicate artists (case-insensitive)
  • Fetch artists with their songs

πŸ’Ώ Albums

  • Create albums linked to artists
  • Fetch albums and their songs

πŸ“ƒ Playlists

  • Create playlists
  • Add/remove songs from playlists
  • Fetch playlists songs

πŸ“‚ Project Structure

src/main/java/org/soundstream
β”œβ”€β”€ controller
β”œβ”€β”€ service
β”‚ β”œβ”€β”€ songs
β”‚ └── artists
β”‚ └── albums
β”‚ └── playlists
β”œβ”€β”€ repository
β”œβ”€β”€ model
β”œβ”€β”€ dto
β”‚ β”œβ”€β”€ request
β”‚ └── response
β”œβ”€β”€ mapper
β”œβ”€β”€ exception
β”œβ”€β”€ enum_
└── config

πŸ”Œ API Design Principles

  • 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

β–Ά Application Setup

1️⃣ Clone the repository

git clone https://github.com/your-username/soundstream.git
cd soundstream

2️⃣ 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

πŸ”— API Endpoints

Songs

Method Endpoint Description
POST /api/v1/songs Create songs
GET /api/v1/songs/{id} Get songs by ID

Artists

Method Endpoint Description
POST /api/v1/artists Create artists
GET /api/v1/artists/{id} Get artists by ID

Albums

Method Endpoint Description
POST /api/v1/albums Create albums
GET /api/v1/albums/{id} Get albums by ID

Playlists

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.


About

No description or website provided.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors