Skip to content

Ananya-te/MusicTrackerAPI

Repository files navigation

🎵Music Tracker API

A local RESTful API which is made by using Node.js, Express.js and SQLite3 that allows users to manage a list of songs and playlists. We can perform tasks like creating,viewing and playing a song, as well as creating, viewing and running a playlist. Optionally includes a basic frontend to interact with the API.

📁 Project Structure

📁 MusicTrackerAPI
├── _tests/
│ ├── api/
│ ├── integration/
│ └── unit/
├── controllers/
│ └── songController.js
├── routes/
│ └── songRoutes.js
├── music.db
├── db.js
├── server.js
├── MusicAPI.html
├── package.json
├── coverage/
├── .github/workflows/
├── appss.png
├── appss2.png
└── README.md

📌 Features

✅ Create, view and play songs and playlists using API
✅ Local database using SQLite3
✅ Integrated with DB Browser for SQLite3
✅ HTML frontend (optional)
✅ Backend using Node.js and Express.js
✅ Fully local setup — no external APIs used

🚀 How to Run This Project

  1. 📥 Clone the Repository git clone https://github.com/your-username/music-tracker-api.git
    cd music-tracker-api

  2. 📦 Install Dependencies Node.js (v14 or above)
    → Required to run the backend server.
    npm (Node Package Manager)
    npm install
    → Comes with Node.js. Used to install project dependencies.

  3. ✅ Start the Server
    Run this command :
    node server.js
    The server will start at:
    http://localhost:5000

🧠 API Endpoints

GET /api/songs
Returns all songs in the database.
Response:

  {
    "id": 1,
    "title": "Test Song",
    "artist": "Tester",
    "genre": "Rock"
  }

POST /api/songs
Adds a new song to the database.
Request Body:

{
  "title": "Shape of You",
  "artist": "Ed Sheeran",
  "genre": "Pop"
}

Response:

{
  "id": 2,
  "title": "Shape of You",
  "artist": "Ed Sheeran",
  "genre": "Pop"
}

🗃️ Database Used

📌 SQLite Database File: music.db
🎛️ Managed Using: DB Browser for SQLite
🛠️ Tables are auto-created on server start (via db.js)

🎼 Table Schema:

CREATE TABLE IF NOT EXISTS songs (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  title TEXT,
  artist TEXT,
  genre TEXT
);

🌐 Frontend

You can easily run the frontend by opening the MusicAPI.html file in your browser.
🔧 Features:
🎵 Add a song using a simple form
📋 View all added songs in a list

🚀 How to Use:

Make sure your server is running (node server.js)
Double-click on MusicAPI.html to open it in your browser
Fill out the form and hit “Add Song” to submit 🎶

Sample curl Requests

  • 🎵 Add a New Song
Copy
Edit
curl -X POST http://localhost:5000/api/songs \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Test Song",
    "artist": "Tester",
    "genre": "Rock"
  }'
  • Get All Songs:
curl http://localhost:5000/api/songs

🛠️ Built With

  • 🟩 Node.js – For backend JavaScript runtime
  • 🚂 Express.js – Web framework to handle routes and APIs
  • 🗃 SQLite3 – Lightweight database for storage
  • 🌐 HTML/CSS/JavaScript – To power the frontend UI

📄 License

This project is open-source and free to use!
Feel free to fork it, play around, or even use it to build something cooler.
Just don’t forget to give credit if you’re vibing with it 💫

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •