Hermes is a sophisticated live polling platform developed as part of the Google Developer Student Clubs (GDSC) VIT initiative. The system enables organizers to create interactive polling events with real-time audience participation, featuring live vote tracking, multi-question quizzes, and comprehensive event management capabilities.
The application implements a hierarchical data structure designed for scalable event management:
- Users → Create and manage multiple Events
- Events → Contain multiple Actions (polls/quizzes)
- Actions → Comprise multiple Questions
- Questions → Include multiple Options with real-time vote statistics
- JWT-based Authentication: Secure token-based user authentication system
- Password Encryption: Bcrypt implementation with configurable salt rounds
- Route Protection: Middleware-based access control for administrative functions
- Input Validation: Comprehensive request validation using Joi schema validation
- Unique Event Codes: Automatic generation of 6-digit event access codes
- Real-time Participant Tracking: Live participant count updates
- Event Lifecycle Management: Complete CRUD operations for event administration
- User Association: Events linked to creator accounts with ownership validation
- Multi-format Actions: Support for polls, quizzes, and interactive questionnaires
- Question Sequencing: Ordered question navigation with state management
- Real-time Vote Tracking: Redis-powered live vote counting and statistics
- Live Broadcasting: Socket.IO integration for instant result updates
- WebSocket Integration: Bi-directional real-time communication
- Live Vote Updates: Instant vote count broadcasting to all participants
- Question Navigation: Real-time question transitions and state synchronization
- Event State Management: Live status updates for events, actions, and questions
- Node.js: Version 14.0 or higher
- MongoDB: Version 4.0 or higher
- Redis: Version 5.0 or higher
- npm: Version 6.0 or higher
Create a .env
file with the following variables:
DB_CONNECTION=mongodb://localhost:27017/livepoll
REDIS_URL=redis://localhost:6379
TOKEN_SECRET=your_jwt_secret_key
SALT_ROUNDS=12
PORT=3000
SSL_PORT=3443
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=password
REDIS_PASSWORD=redis_password
-
Clone the Repository
git clone https://github.com/mdhishaamakhtar/live-poll.git cd live-poll
-
Install Dependencies
npm install
-
Configure Environment
- Copy
.env.example
to.env
- Update configuration values as needed
- Copy
-
Start Services
# Development mode with auto-reload npm run dev # Production mode npm start
The application includes comprehensive Docker configuration for streamlined deployment:
-
Using Docker Compose
# Start all services (MongoDB, Redis, Backend) docker-compose up -d # View logs docker-compose logs -f # Stop services docker-compose down
-
Individual Container Build
# Build application image docker build -t live-poll-backend . # Run with environment configuration docker run -d --name live-poll --env-file .env -p 80:3000 live-poll-backend
POST /api/user/register
- User registration with validationPOST /api/user/login
- Authentication with JWT token generationGET /api/user/getEvents
- Retrieve user's associated events
POST /api/events/addEvent
- Create new polling eventGET /api/events/getEvent/:code
- Access event by unique codeGET /api/events/getEventdetail/:id
- Retrieve detailed event informationDELETE /api/events/deleteEvent/:id
- Remove event (creator only)PATCH /api/events/editEventTitle/:id
- Update event title
POST /api/actions/addAction/:eventId
- Create poll/quiz within eventGET /api/actions/getActiondetail/:id
- Retrieve complete action detailsGET /api/actions/openAction/:id
- Activate action for participationGET /api/actions/closeAction/:id
- Deactivate action
POST /api/questions/addQuestion/:actionId
- Add individual questionPOST /api/questions/addQuestionsAll/:actionId
- Batch question creationGET /api/questions/publishQuestion/:actionId/:questionId
- Make question livePOST /api/options/addOption/:actionId/:questionId
- Add response option
Client → Server Events:
option
- Cast vote for specific optionnext question
- Request question navigationclose quiz
- Terminate polling sessionreset options
- Clear vote statistics
Server → Client Events:
all options
- Broadcast updated vote countsnext
- Signal question transitionquiz ended
- Notify session termination
- Client emits vote selection via
option
event - Redis increments vote counter for selected option
- Server broadcasts updated statistics to all connected clients
- Client interfaces update in real-time
- Linting: ESLint with Standard.js configuration
- Code Formatting: Consistent style enforcement
- Error Handling: Comprehensive error catching and response formatting
- Logging: Morgan HTTP request logging for development
# Run linter and auto-fix issues
npm run lint
# Development server with auto-reload
npm run dev
# Production server
npm start
- Mongoose ODM: Optimized MongoDB queries with proper indexing
- Connection Pooling: Efficient database connection management
- Embedded Documents: Hierarchical data structure for reduced query complexity
- Redis Integration: Real-time vote counting with memory-based storage
- Session Management: Efficient state management for active sessions
- Data Persistence: Automatic cleanup and restoration mechanisms
- Docker Support: Containerized deployment for horizontal scaling
- Environment Configuration: Flexible configuration for different deployment scenarios
- SSL/TLS Support: Production-ready HTTPS configuration
- JWT Token Validation: Stateless authentication with secure token verification
- Password Hashing: Bcrypt encryption with configurable complexity
- Route Protection: Middleware-based authorization for sensitive endpoints
- Input Sanitization: Joi-based request validation
- SQL Injection Prevention: NoSQL injection protection through Mongoose
- CORS Configuration: Controlled cross-origin resource sharing
The system supports both traditional and containerized deployment:
Traditional Deployment:
- Node.js process management with PM2
- Reverse proxy configuration (Nginx recommended)
- SSL/TLS certificate integration
- Environment-based configuration management
Container Deployment:
- Multi-service Docker Compose configuration
- Persistent volume mapping for data retention
- Network isolation and service discovery
- Health check implementation
- Application Logging: Comprehensive request and error logging
- Performance Metrics: Response time and throughput monitoring
- Error Tracking: Centralized error collection and analysis
- Database Monitoring: Connection pool and query performance tracking
This project welcomes contributions from the developer community. Please refer to the contribution guidelines and ensure all pull requests include appropriate documentation and testing.
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for complete terms and conditions.
Md Hishaam Akhtar
GitHub: @mdhishaamakhtar
LinkedIn: @mdhishaamakhtar
Developed with ❤️ by GDSC VIT