A complete MERN stack application that allows an admin to start a live video session and students to join via a unique URL.
- Admin Dashboard: Start a session with one click
- Unique Session URLs: Each session gets a unique ID and shareable link
- Video Player: Full-featured video player with controls (Play/Pause, Volume, Fullscreen, Settings)
- Student Access: Students can join using the unique session link
- Responsive Design: Beautiful UI built with Tailwind CSS
- Node.js + Express.js
- MongoDB + Mongoose
- UUID for unique ID generation
- CORS for cross-origin requests
- React.js + Vite
- React Router for navigation
- React Player for video playback
- Tailwind CSS for styling
- Axios for API calls
live-session-app/
β
βββ backend/
β βββ server.js
β βββ routes/sessionRoutes.js
β βββ models/Session.js
β βββ controllers/sessionController.js
β βββ package.json
β βββ .env
β
βββ frontend/
β βββ src/
β β βββ pages/
β β β βββ AdminPage.jsx
β β β βββ StudentPage.jsx
β β βββ components/
β β β βββ VideoPlayer.jsx
β β βββ App.jsx
β β βββ main.jsx
β β βββ index.css
β βββ index.html
β βββ package.json
β βββ vite.config.js
β βββ tailwind.config.js
β βββ postcss.config.js
β
βββ README.md
- Node.js (v16 or higher)
- MongoDB (installed and running locally)
- npm or yarn
git clone <your-repo-url>
cd live-session-appcd backend
npm installCreate a .env file in the backend folder:
MONGODB_URI=mongodb://localhost:27017/live-session-app
PORT=5000Start MongoDB (if not running):
# On Windows (if installed as service)
net start MongoDB
# Or using mongod directly
mongodStart the backend server:
npm run devThe backend will run on http://localhost:5000
Open a new terminal:
cd frontend
npm installStart the frontend development server:
npm run devThe frontend will run on http://localhost:5173
- Open
http://localhost:5173in your browser - Click the "Start Session" button
- A new session will be created with:
- Unique Session ID
- Student Access Link
- Copy the student link and share it with students
- The video player will appear with full controls
- Open the shared URL (e.g.,
http://localhost:5173/session/abc-123-xyz) - The session will load automatically
- Watch the video with full playback controls
Creates a new session
Response:
{
"success": true,
"data": {
"type": "admin",
"unique_id": "550e8400-e29b-41d4-a716-446655440000",
"userurl": "http://localhost:5173/session/550e8400-e29b-41d4-a716-446655440000",
"createdAt": "2025-10-30T10:30:00.000Z",
"updatedAt": "2025-10-30T10:30:00.000Z"
}
}Retrieves session details by unique ID
Response:
{
"success": true,
"data": {
"type": "admin",
"unique_id": "550e8400-e29b-41d4-a716-446655440000",
"userurl": "http://localhost:5173/session/550e8400-e29b-41d4-a716-446655440000",
"createdAt": "2025-10-30T10:30:00.000Z",
"updatedAt": "2025-10-30T10:30:00.000Z"
}
}In both AdminPage.jsx and StudentPage.jsx, update the sampleVideoUrl variable:
const sampleVideoUrl = 'YOUR_VIDEO_URL_HERE';Supported video formats:
- YouTube videos
- Vimeo videos
- Direct video files (mp4, webm, etc.)
- Live streams (HLS, DASH)
The app uses Tailwind CSS. Modify the styles in the component files or update tailwind.config.js for theme customization.
- This is a basic implementation without real-time streaming
- No authentication is implemented
- The video URL is hardcoded (can be made dynamic)
- MongoDB should be running before starting the backend
MongoDB Connection Error:
- Ensure MongoDB is running:
mongod - Check the connection string in
.env
Port Already in Use:
- Change the port in
.env(backend) orvite.config.js(frontend)
CORS Error:
- Ensure backend CORS is properly configured
- Check that frontend is calling the correct backend URL
MIT License - feel free to use this project for learning and development!
Built with β€οΈ using the MERN stack