Skip to content

Mohit138928/live-session-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Live Session App πŸŽ₯

A complete MERN stack application that allows an admin to start a live video session and students to join via a unique URL.

πŸ“‹ Features

  • 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

πŸ› οΈ Tech Stack

Backend

  • Node.js + Express.js
  • MongoDB + Mongoose
  • UUID for unique ID generation
  • CORS for cross-origin requests

Frontend

  • React.js + Vite
  • React Router for navigation
  • React Player for video playback
  • Tailwind CSS for styling
  • Axios for API calls

πŸ“¦ Project Structure

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

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (installed and running locally)
  • npm or yarn

Installation

1. Clone the repository

git clone <your-repo-url>
cd live-session-app

2. Setup Backend

cd backend
npm install

Create a .env file in the backend folder:

MONGODB_URI=mongodb://localhost:27017/live-session-app
PORT=5000

Start MongoDB (if not running):

# On Windows (if installed as service)
net start MongoDB

# Or using mongod directly
mongod

Start the backend server:

npm run dev

The backend will run on http://localhost:5000

3. Setup Frontend

Open a new terminal:

cd frontend
npm install

Start the frontend development server:

npm run dev

The frontend will run on http://localhost:5173

🎯 Usage

For Admin:

  1. Open http://localhost:5173 in your browser
  2. Click the "Start Session" button
  3. A new session will be created with:
    • Unique Session ID
    • Student Access Link
  4. Copy the student link and share it with students
  5. The video player will appear with full controls

For Students:

  1. Open the shared URL (e.g., http://localhost:5173/session/abc-123-xyz)
  2. The session will load automatically
  3. Watch the video with full playback controls

πŸ”Œ API Endpoints

POST /api/start-session

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"
  }
}

GET /api/session/:unique_id

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"
  }
}

🎨 Customization

Change Video URL

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)

Styling

The app uses Tailwind CSS. Modify the styles in the component files or update tailwind.config.js for theme customization.

πŸ“ Notes

  • 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

πŸ”§ Troubleshooting

MongoDB Connection Error:

  • Ensure MongoDB is running: mongod
  • Check the connection string in .env

Port Already in Use:

  • Change the port in .env (backend) or vite.config.js (frontend)

CORS Error:

  • Ensure backend CORS is properly configured
  • Check that frontend is calling the correct backend URL

πŸ“„ License

MIT License - feel free to use this project for learning and development!

πŸ‘¨β€πŸ’» Author

Built with ❀️ using the MERN stack

About

A complete MERN stack application that allows an admin to start a live video session and students to join via a unique URL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors