Skip to content

This repo contains the backend logic for Muxik, including login, register, forget password, update profile, adding songs to history, adding liked songs, and many more functionalities.

License

Notifications You must be signed in to change notification settings

ShivaBhattacharjee/Muxik-backend

Repository files navigation

Logo

Muxik's Backend

Backend logic for login # and storing history/liked

Report Bug . Request Feature

code style: prettier Deno GitHub repo size jwt Docker Build

Table Of Contents

About the Project

This repo contains the backend logic for Muxik, including login, register, forget password, update profile, adding songs to history, adding liked songs, and many more functionalities.

Built With

Muxik backend api is built using express , Mongodb , JWT and Nodemailer

Getting Started

Prerequisites

Git is a distributed version control system used for software development. It allows multiple developers to work on the same codebase simultaneously, keeping track of changes and managing versions. It also enables users to revert changes and collaborate more effectively.

NodeJs is a JavaScript runtime built on Chrome's V8 JavaScript engine. It allows developers to execute JavaScript code outside of a web browser, making it possible to create server-side applications with JavaScript. Node.js is fast, lightweight, and scalable, making it popular for building modern web applications.

Thunder Client is a lightweight Rest API client extension for VS Code

Installation

Rename env.example to env and fill the values

⚠️ Note: MongoDb memory server can be used by changing the config inside Database.js

git clone https://github.com/ShivaBhattacharjee/Muxik-backend
cd Muxik-backend
npm install

To start in development mode

npm run dev 

Or

npm start

Docker

sudo docker run -p <your-port-number>:3000 \
-e MONGODB_URI=yourmongodburi \
-e JWT_SECRET=yourjwttoken \
-e EMAIL_ID=youremail \
-e EMAIL_PASSWORD=yourpassword \
immashiva/muxikapi:latest

Example

sudo docker run -p 8080:3000 \
-e MONGODB_URI=yourmongodburi \
-e JWT_SECRET=yourjwttoken \
-e EMAIL_ID=youremail \
-e EMAIL_PASSWORD=yourpassword \
immashiva/muxikapi:latest

Routes

⚠️ Note: Bearer Token can be obtained after successfull login

Authentication

POST

Endpoint Method Bearer Token
api/validation/register POST No
api/validation/verify-register POST No
api/validation/resend-email POST No
api/validation/reset-password POST No
api/validation/confirm-reset-password POST No
api/validation/# POST No

Users / Public

⚠️ Note: Routes remain the same for both liked and history requests; the method used will determine which function triggers the database queries. The queries depend on the username obtained from the bearer token.

GET

Endpoint Method Bearer Token
api/user/liked-songs GET Yes
api/user/history GET Yes
api/user/user-info GET Yes

POST

Endpoint Method Bearer Token
api/user/liked-songs POST Yes
api/user/history POST Yes
api/user/user-info POST Yes

DELETE

Endpoint Method Bearer Token
api/user/liked-songs DELETE Yes
api/user/history DELETE Yes

PUT

Endpoint Method Bearer Token
api/user/user-info PUT Yes

Dummy data

Register

{
 "username" : "user",
 "password" : "password",
 "email" : "email@gmail.com",
 "profile" : "thisIsImage"
}

Verify Register

{
  "email" : "email@gmail.com", 
  "verificationCode" : "code"
}

Resend Registration Email

  "email" : "email@gmail.com"

⚠️ Note: Only users verified via otp can login

Login

{
  "username":"user",
  "password" : "password"
}

Reset Password

{
   "email": "email of registered user"
}

Confirm Reset Password

{
  "email": "email@gmail.com",
  "otp": "otp",
  "newPassword": "new password"
}

Add Liked songs

{
  "username": "user",
  "songId": "1234",
  "songName": "test song",
  "banner": "https://example.com/song_banner.jpg"
}

Delete Liked Songs

{
  "songId" : "song id"
}

Add History

{
  "username": "user",
  "songId" : "1234", 
  "songName" : "test song", 
  "banner" : "https://example.com/song_banner.jpg"
}

Delete History

{
  "songId" : "song id"
}

Update user

{
  "username" : "new username"
  "profile" : "new profile"
}

License

Distributed under MIT License . See LICENSE for more information.

Todo

  • ✅ Register and verify
  • ✅ OTP Resend
  • ✅ Login
  • ✅ Get User info
  • ✅ Update user profile
  • ✅ Reset Password
  • ✅ custom email for register account and reset passowrd
  • ✅ Verify Reset password
  • ✅ Liked Songs
  • ✅ History
  • ❌ Custom Playlists
  • ✅ Code Refactoring

Authors

About

This repo contains the backend logic for Muxik, including login, register, forget password, update profile, adding songs to history, adding liked songs, and many more functionalities.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages