A modern, full-stack music streaming platform built with the MERN stack. Beat-Bond allows users to listen to their favorite tracks, create playlists, and join real-time synchronized βListen Togetherβ rooms with friends.
The application is structured around a scalable full-stack MERN architecture. Here are the core architecture pillars:
graph TD
Client[React Frontend / Browser]
subgraph Backend API Layer
Express[Node.js / Express Server]
SocketIO[Socket.io WebSocket Server]
end
subgraph Data Layer
MongoDB[(MongoDB Atlas)]
Redis[(Redis Cache)]
end
subgraph External Services
Cloudinary[Cloudinary CDN]
YouTube[YouTube Data API]
Google[Google OAuth Provider]
Email[SMTP Email Service]
end
Client <-->|"REST HTTP/HTTPS"| Express
Client <-->|"WebSockets ws://"| SocketIO
Express <-->|"Mongoose Queries"| MongoDB
Express <-->|"Cache Access"| Redis
SocketIO <-->|"Persist Room State"| MongoDB
Express -->|"Upload Images"| Cloudinary
Express -->|"Search Music"| YouTube
Express -->|"Authenticate Auth"| Google
Express -->|"Send Verifications"| Email
flowchart LR
User([User])
subgraph Beat-Bond Capabilities
auth(Authenticate / Google Login)
play(Stream & Control Music)
playlist(Create & Manage Playlists)
room(Create 'Listen Together' Room)
join(Join Friend's Room)
chat(Live Chat in Room)
timer(Trigger 5-minute Timeout)
end
User --> auth
User --> play
User --> playlist
User --> room
User --> join
User --> chat
User --> timer
erDiagram
USER ||--o{ ROOM : hosts
USER ||--o{ ROOM : participates
USER ||--o{ PLAYLIST : curates
USER }|--o{ SONG : history
USER {
ObjectId _id
String name
String email
String password
Boolean isEmailVerified
String profileImage
String role
Number totalListeningTime
}
ROOM {
ObjectId _id
String roomId
String name
ObjectId host
Boolean isPlaying
Number playbackPosition
Boolean isPrivate
String password
}
SONG {
ObjectId _id
String title
String artist
String audioUrl
String imageUrl
Number duration
}
PLAYLIST {
ObjectId _id
String name
String description
String coverImage
ObjectId creator
}
ROOM }|--o| SONG : currentSong
PLAYLIST }|--o{ SONG : contains
flowchart TD
Start([User opens App]) --> CheckAuth{Is Logged In?}
CheckAuth -->|No| Login[Redirect to Login]
Login --> Auth[Authenticate via JWT/Google]
Auth --> Dashboard[Load Dashboard]
CheckAuth -->|Yes| Dashboard
Dashboard --> Action{Choose Action}
Action -->|Play Music| Fetch[Fetch Music via YouTube API]
Fetch --> Stream[Stream Audio]
Action -->|Listen Together| Room{Create or Join?}
Room -->|Create| CreateRoom[Host Generates Room ID]
CreateRoom --> Wait[Wait for friends & Sync sockets]
Room -->|Join| JoinRoom[Enter Room Code]
JoinRoom --> Connect[Connect to Host Socket]
Wait --> Sync[Synchronize Playback State]
Connect --> Sync
Sync --> End([Session Ends])
stateDiagram-v2
[*] --> Disconnected
Disconnected --> Connecting : Mount Component
Connecting --> Connected : Socket.io Handshake
Connected --> Authenticated : Provide Verify Token
state Room_Session {
[*] --> Idle
Idle --> Buffering : Load Track Data
Buffering --> Playing : Audio Stream Ready
Playing --> Paused : Host triggers Pause
Paused --> Playing : Host triggers Play
Playing --> Seeking : Host scrubs slider
Seeking --> Playing : Sync exact timestamp across clients
}
Authenticated --> Room_Session : Join Listen Together Room
Room_Session --> Disconnected : Leave Room / Web Timeout
To run this project on your local machine, follow these steps:
git clone https://github.com/arjun-holland/Beat-Bond.git
cd Beat-Bond
Create a .env file in the backend directory. You must configure all of the following variables for the platform to function fully:
| Variable | Description | Example / Source |
|---|---|---|
PORT |
API Port | 5000 |
NODE_ENV |
Environment logic | development or production |
MONGO_URI |
MongoDB Connection String | mongodb+srv://... |
REDIS_URI |
Redis Connection String | redis://... |
JWT_SECRET |
Primary JWT encryption key | your_super_secret_key |
JWT_REFRESH_SECRET |
Long-lived JWT key | your_refresh_secret |
CLIENT_URL |
Frontend URL | http://localhost:5173 |
GOOGLE_CLIENT_ID |
OAuth Client ID | Google Cloud Console |
GOOGLE_CLIENT_SECRET |
OAuth Client Secret | Google Cloud Console |
EMAIL_USER |
SMTP App Email Address | your_email@gmail.com |
EMAIL_PASS |
SMTP App Password | 16-digit app password |
EMAIL_FROM |
Base Sender Address | no-reply@beatbond.com |
YOUTUBE_API_KEY |
Music Search API Key | Google Cloud Platform |
CLOUDINARY_CLOUD_NAME |
Cloudinary Storage Name | Cloudinary Console |
CLOUDINARY_API_KEY |
Cloudinary API Key | Cloudinary Console |
CLOUDINARY_API_SECRET |
Cloudinary API Secret | Cloudinary Console |
cd backend
npm install
npm run dev
Open a new terminal and navigate to the frontend:
cd frontend
npm install
npm run dev
The app will now be available at http://localhost:5173.
This application is fully containerized and production-ready.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.