Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shivabhattacharjee/muxik-backend
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.
https://github.com/shivabhattacharjee/muxik-backend
backend-api docker loginapi mongodb nodejs
Last synced: 1 day ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/shivabhattacharjee/muxik-backend
- Owner: ShivaBhattacharjee
- License: mit
- Created: 2023-07-04T06:47:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-19T22:24:46.000Z (10 months ago)
- Last Synced: 2024-05-01T13:39:27.742Z (7 months ago)
- Topics: backend-api, docker, loginapi, mongodb, nodejs
- Language: JavaScript
- Homepage: https://muxik-backend.vercel.app
- Size: 307 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
Muxik's Backend
Backend logic for login signup and storing history/liked
Report Bug
.
Request Feature
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Deno](https://github.com/ShivaBhattacharjee/AnimeTrix-next/actions/workflows/deno.yml/badge.svg)](https://github.com/ShivaBhattacharjee/AnimeTrix-next/actions/workflows/deno.yml)
![GitHub repo size](https://img.shields.io/github/repo-size/shivabhattacharjee/muxik-backend)
![jwt](https://jwt.io/img/badge-compatible.svg)
[![Docker Build](https://github.com/ShivaBhattacharjee/Muxik-backend/actions/workflows/docker_build.yml/badge.svg)](https://github.com/ShivaBhattacharjee/Muxik-backend/actions/workflows/docker_build.yml)## Table Of Contents
- [Table Of Contents](#table-of-contents)
- [About the Project](#about-the-project)
- [Built With](#built-with)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Docker](#docker)
- [Example](#example)
- [Routes](#routes)
- [Authentication](#authentication)
- [POST](#post)
- [Users / Public](#users--public)
- [GET](#get)
- [POST](#post-1)
- [DELETE](#delete)
- [PUT](#put)
- [Dummy data](#dummy-data)
- [Register](#register)
- [Verify Register](#verify-register)
- [Resend Registration Email](#resend-registration-email)
- [Login](#login)
- [Reset Password](#reset-password)
- [Confirm Reset Password](#confirm-reset-password)
- [Add Liked songs](#add-liked-songs)
- [Delete Liked Songs](#delete-liked-songs)
- [Add History](#add-history)
- [Delete History](#delete-history)
- [Update user](#update-user)
- [License](#license)
- [Todo](#todo)
- [Authors](#authors)## 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 WithMuxik backend api is built using express , Mongodb , JWT and Nodemailer
* [ExpressJs](http://expressjs.com/)
* [MongoDb](https://www.mongodb.com/)
* [JWT](https://jwt.io/)
* [Nodemailer](https://nodemailer.com)## 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**```sh
git clone https://github.com/ShivaBhattacharjee/Muxik-backend
```
```sh
cd Muxik-backend
```
```sh
npm install
```
To start in development mode```sh
npm run dev
```
Or```sh
npm start
```#### Docker
```bash
sudo docker run -p :3000 \
-e MONGODB_URI=yourmongodburi \
-e JWT_SECRET=yourjwttoken \
-e EMAIL_ID=youremail \
-e EMAIL_PASSWORD=yourpassword \
immashiva/muxikapi:latest
```
#### Example
```bash
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/login|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
```sh
{
"username" : "user",
"password" : "password",
"email" : "[email protected]",
"profile" : "thisIsImage"
}
```
### Verify Register
```sh
{
"email" : "[email protected]",
"verificationCode" : "code"
}
```
### Resend Registration Email
```sh
"email" : "[email protected]"
```
> **⚠️ Note: Only users verified via otp can login**
### Login```sh
{
"username":"user",
"password" : "password"
}
```### Reset Password
```sh
{
"email": "email of registered user"
}
```### Confirm Reset Password
```sh
{
"email": "[email protected]",
"otp": "otp",
"newPassword": "new password"
}
```### Add Liked songs
```sh
{
"username": "user",
"songId": "1234",
"songName": "test song",
"banner": "https://example.com/song_banner.jpg"
}
```
### Delete Liked Songs
```sh
{
"songId" : "song id"
}
```
### Add History```sh
{
"username": "user",
"songId" : "1234",
"songName" : "test song",
"banner" : "https://example.com/song_banner.jpg"
}
```
### Delete History```sh
{
"songId" : "song id"
}
```
### Update user
```sh
{
"username" : "new username"
"profile" : "new profile"
}
```
## LicenseDistributed under MIT License . See [LICENSE](https://github.com/ShivaBhattacharjee/Muxik-backend/blob/main/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* **Shiva Bhattacharjee** - [Shiva Bhattacharjee](https://github.com/ShivaBhattacharjee)