A real-time interactive polling system designed for educational environments, enabling teachers to create live polls and students to participate in real-time. Built with modern web technologies for seamless classroom engagement.
- Real-time Poll Creation: Create polls with multiple choice questions and set custom durations
- Live Results: View student responses in real-time with visual progress bars
- Participant Management: See all connected students and manage participation
- Chat Integration: Built-in chat system for classroom communication
- Student Management: Ability to remove disruptive students from the session
- Poll History: Access and review past polls with detailed analytics
- Easy Participation: Simple name entry and one-click poll participation
- Real-time Updates: See live poll results and countdown timers
- Instant Feedback: View correct answers and performance immediately
- Chat Access: Communicate with teacher and classmates
- Session Persistence: Rejoin sessions seamlessly if disconnected
- Real-time Communication: WebSocket-based live updates using Socket.IO
- Responsive Design: Modern UI built with React and TailwindCSS
- Data Persistence: MongoDB integration for poll history and analytics
- Cross-platform: Works on desktop, tablet, and mobile devices
- Scalable Architecture: Modular backend with RESTful API endpoints
- Node.js with Express.js framework
- Socket.IO for real-time bidirectional communication
- MongoDB with Mongoose ODM for data persistence
- CORS enabled for cross-origin requests
- Environment-based configuration with dotenv
- React 19 with modern hooks and functional components
- React Router for client-side navigation
- TailwindCSS for responsive and modern styling
- Socket.IO Client for real-time communication
- Axios for HTTP API calls
- Vite for fast development and building
LivePollingSystem/
βββ lpsbackend/ # Backend server
β βββ index.js # Main server entry point
β βββ models/
β β βββ Poll.js # MongoDB Poll schema
β βββ routes/
β β βββ history.js # Poll history API endpoints
β βββ socket/
β β βββ pollSocket.js # Socket.IO event handlers
β βββ utils/
β β βββ database.js # MongoDB connection utility
β βββ package.json
βββ lpsfrontend/ # Frontend React application
β βββ src/
β β βββ components/ # Reusable UI components
β β β βββ ActivePoll.jsx
β β β βββ ChatPopup.jsx
β β β βββ PollForm.jsx
β β β βββ PollResult.jsx
β β β βββ ...
β β βββ pages/ # Main application pages
β β β βββ RoleSelector.jsx
β β β βββ TeacherPage.jsx
β β β βββ StudentPage.jsx
β β β βββ PollHistory.jsx
β β βββ utils/ # Utility functions
β β β βββ api.js # Axios API configuration
β β β βββ socket.js # Socket.IO client setup
β β βββ App.jsx # Main application component
β β βββ main.jsx # Application entry point
β βββ package.json
βββ README.md
- Node.js (v18 or higher)
- MongoDB (local installation or MongoDB Atlas)
- npm or yarn package manager
-
Navigate to backend directory:
cd lpsbackend -
Install dependencies:
npm install
-
Create environment file:
# Create .env file in lpsbackend/ MONGODB_URI=mongodb://localhost:27017/live-polling-system PORT=8000 -
Start the server:
npm start
-
Navigate to frontend directory:
cd lpsfrontend -
Install dependencies:
npm install
-
Create environment file:
# Create .env file in lpsfrontend/ VITE_BACKEND_URI=http://localhost:8000 -
Start the development server:
npm run dev
-
Teacher Setup:
- Open the application in your browser
- Select "Teacher" role
- Wait for students to join
-
Student Setup:
- Open the application in your browser
- Select "Student" role
- Enter your name to join the session
-
Teacher creates a poll:
- Click "Create New Poll"
- Enter the question
- Add multiple choice options
- Mark correct answers (optional)
- Set poll duration
- Click "Start Poll"
-
Students participate:
- See the poll question and options
- Select an answer within the time limit
- View real-time results
-
Results and Analytics:
- View live response counts
- See correct answer indicators
- Access detailed poll history
Backend (.env):
MONGODB_URI=mongodb://localhost:27017/live-polling-system
PORT=8000
NODE_ENV=developmentFrontend (.env):
VITE_BACKEND_URI=http://localhost:8000The Poll model includes:
- Question text
- Multiple choice options with correct answer flags
- Student responses with timestamps
- Poll duration and end times
- Creation and completion timestamps
GET /history- Retrieve poll historyPOST /history- Save completed poll
join- Student/teacher joins sessioncreate_poll- Teacher creates new pollsubmit_answer- Student submits answerpoll_started- Broadcast poll to all participantspoll_ended- Broadcast poll resultschat_message- Real-time chat messageskick_student- Teacher removes student
- RoleSelector: Initial role selection interface
- TeacherPage: Main teacher dashboard with poll controls
- StudentPage: Student interface for poll participation
- ActivePoll: Real-time poll display with countdown
- PollResult: Results visualization with progress bars
- ChatPopup: Real-time chat interface
- PollHistory: Historical poll data and analytics
- Input Validation: Server-side validation for all inputs
- Duplicate Prevention: Prevents multiple answers from same student
- Session Management: Tracks connected participants
- Error Handling: Graceful error handling and user feedback
- Set up MongoDB (local or cloud)
- Configure environment variables
- Deploy to your preferred hosting service (Heroku, AWS, etc.)
- Build the production version:
npm run build - Deploy the
distfolder to your hosting service - Configure environment variables for production
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues and questions:
- Check the existing issues
- Create a new issue with detailed description
- Include error logs and steps to reproduce
Built with β€οΈ for modern education