Skip to content

AyalaVirtual/MusicPlaylistAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Playlist

A REST API developed using Java and the Spring framework that offers users the ability to register and log in to their personalized profiles, where they can search for songs, explore diverse music genres, and curate a unique playlist of their favorite tracks. This project exemplifies the practical implementation of back-end development, database management, and API design.

Technologies Used

  • Java 17
  • Maven
  • Spring Boot
  • Spring Data (JPA)
  • Spring Security
  • JSON Web Tokens
  • H2 Database
  • Postman

General Approach

I started off by creating my user stories and acceptance criteria. This helped me visualize my end goals and outline what I wanted to achieve with this project. I also created a spreadsheet of all my HTTP methods and endpoints to keep track of which methods were supposed to hit which endpoint.

Finally, I created an ERD (entity relationship diagram) to plan my different models and their relevant attributes. This helped me to visualize their relationships to one another and plan out how I was going to link the corresponding tables in the database.

ERD

User Stories

User Story 1: As a user, I want to be able to search different genres so that I can discover new music. (GET all songs by genre ID)

Acceptance Criteria:

  • User can filter search results by genre.
  • Search results should display a list of all songs that match the user's search criteria.

User Story 2: As a user, I want to be able to search for specific songs so that I can listen to my favorites. (GET individual song by genre ID & song ID)

Acceptance Criteria:

  • User can filter search results by genre & song.
  • Search results should return an exact match to the user's search criteria.

User Story 3: As a user, I want to create a profile so that I can save my favorite songs in playlists organized by genre. (POST song to genre)

Acceptance Criteria:

  • User can register and login to their profile.
  • User can save specific songs to their profile’s playlist.

HTTP Endpoints

Request Type URL Functionality Access
POST /auth/users/register/ Register a new user Public
POST /auth/users/login/ Login a user Public
POST /api/genres/ Create genre Private
GET /api/genres/ Get all genres Private
GET /api/genres/1/ Get single genre Private
PUT /api/genres/1/ Update single genre Private
DELETE /api/genres/1/ Delete single genre Private
POST /api/genres/1/songs/ Create a song in a genre Private
GET /api/genres/songs/ Get all songs Private
GET /api/genres/1/songs/1/ Get a song from a genre Private
PUT /api/genres/1/songs/1/ Update a song from a genre Private
DELETE /api/genres/1/songs/1/ Delete a song from a genre Private

Major Hurdles

At first, I struggled with getting my POST requests to work because Postman kept giving me a 403 Forbidden error. I was able to remove a line of code in the user authorizations that fixed this error.

When I first tried to add the option to search for, save, update, and delete songs, I wasn't able to get the CRUD methods working after adding the security and authentication layer. I have since fixed these issues and added the necessary logic to make the app fully functional. Users can now search for, create, update, and delete genres and songs from their account's list of favorites.

Links

Special Thanks

  • Suresh Sigera - my instructor who not only taught me all the concepts used in this project, but also wrote the code I used in the security package handling authorization. GitHub

  • Elizabeth Yang - my partner in pair programming during class, who helped me to refactor CRUD methods relevant to the user, which I used as a reference when writing the CRUD methods for this project. GitHub

Author

👩‍💻 Erica Ayala

About

An API built using Java, Spring Boot, Spring Data JPA, and Spring Security, and H2 database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages