Syncify Backend is a powerful and scalable backend solution for a music streaming platform. It provides robust features such as user authentication, song and album management, real-time communication, and scheduled tasks.
Some Features -
🎸 Control music playback with next and previous song options
🔈 Adjust the volume seamlessly using a slider
🎧 Admin dashboard for managing albums and adding new songs
💬 Real-time chat integrated within Spotify
👨🏼💼 Track users' online and offline status
👀 View what others are listening to in real-time
📊 Collect data for analytics insights
Tech Stack -
- 🌟 Introduction
- 🚀 Installation
- 🛠️ Usage
- ✨ Features
- 📦 Dependencies
- ⚙️ Scripts
- 🔧 Configuration
- 📊 API Endpoints
- 🙌 Contributors
- 📜 License
-
Clone the repository:
git clone https://github.com/ramxcodes/Syncify-backend.git cd syncify-backend
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.env
file in the root directory. - Define the following variables:
PORT=<your-port> MONGODB_URL=<your-database-url> ADMIN_EMAIL=<admin-email> CLOUDINARY_API_KEY=<your-cloudinary-api-key> CLOUDINARY_API_SECRET=<your-cloudinary-api-secret> CLOUDINARY_CLOUD_NAME=<your-cloudinary-cloud-name> NODE_ENV=development CLERK_PUBLISHABLE_KEY=<your-clerk-publishable-key> CLERK_SECRET_KEY=<your-clerk-secret-key>
- Create a
- Development mode:
npm run dev
- Production mode:
npm start
The server will be accessible at http://localhost:<PORT>
.
- 👤 User Management: APIs for user registration, login, and profile updates.
- 🔑 Authentication: Secure user authentication using Clerk.
- 🎶 Song Management: Upload, delete, and fetch songs. Features include:
- Trending songs
- Personalized recommendations
- Featured playlists
- 💿 Album Management: Create, delete, and fetch albums, including song associations.
- 📡 Real-Time Communication: Enable live chat & see what others are listening to.
- 📊 Analytics: Provide detailed statistics on admin page with number of songs, albums, users, and artists.
- 📂 File Uploads: Handle media uploads via Cloudinary with size limits and temporary storage.
- ⏱️ Scheduled Jobs: Automatically clean temporary files using
node-cron
.
express
- Web frameworkmongoose
- MongoDB object modelingdotenv
- Manage environment variablescors
- Enable CORSsocket.io
- Real-time communicationcloudinary
- Media uploadsexpress-fileupload
- File handling middlewarenode-cron
- Cron job scheduling
nodemon
- Auto-restart server on changes
Check package.json
for the full list of dependencies.
npm run dev
: Start the server in development mode.npm run start
: Start the server in production mode.npm run seed:songs
: Seed the database with song data.npm run seed:albums
: Seed the database with album data.
- Environment Variables: Defined in
.env
file. - CORS Settings: Configured for
http://localhost:3000
. - File Uploads: Temporary files stored in the
tmp
directory with a 10 MB limit.
/api/users
- Manage users/api/users/messages
- Retrieve user messages
/api/auth
- User authentication
/api/admin
- Admin functionalities/api/admin/create-song
- Add a new song/api/admin/create-album
- Add a new album
/api/songs
- Retrieve all songs/api/songs/trending
- Fetch trending songs/api/songs/featured
- Fetch featured songs/api/songs/made-for-you
- Personalized recommendations
/api/albums
- Retrieve all albums/api/albums/:albumId
- Retrieve album details by ID
/api/stats
- Get platform statistics