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
.envfile 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
.envfile. - CORS Settings: Configured for
http://localhost:3000. - File Uploads: Temporary files stored in the
tmpdirectory 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