A scalable backend API for a Music Streaming Application built using Node.js and Express. This project handles user authentication, music management, and secure API operations, designed to simulate a real-world backend system.
- 🔐 User Authentication (JWT-based)
- 👤 User Registration & Login
- 🎶 Music Upload & Management
- 📂 Organized MVC Architecture
- 🔑 Secure Password Hashing
- ⚡ RESTful API Design
- 🌐 Environment-based configuration
- Node.js
- Express.js
- MongoDB (Mongoose)
- JWT (Authentication)
- bcrypt.js (Password Hashing)
- dotenv
musicApp-Backend/
│
├── controllers/ # Business logic
├── models/ # Database schemas
├── routes/ # API routes
├── middleware/ # Auth & error handling
├── config/ # DB & environment setup
├── utils/ # Helper functions
├── app.js # App configuration
├── server.js # Entry point
└── .env # Environment variables (not committed)
- Clone the repository:
git clone https://github.com/mukul1612/musicApp-Backend.git
- Navigate to the project folder:
cd musicApp-Backend
- Install dependencies:
npm install
- Create a
.envfile and add:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
- Start the server:
npm run dev
- POST
/api/auth/register→ Register user - POST
/api/auth/login→ Login user
- GET
/api/music→ Get all songs - POST
/api/music→ Upload music - DELETE
/api/music/:id→ Delete song
This API uses JWT (JSON Web Tokens) for secure authentication. Protected routes require a valid token in headers:
Authorization: Bearer <token>