A high-performance real-time polling and Q&A platform designed for live events, classrooms, and interactive presentations. Built with React, Node.js, WebSockets, and Redis for sub-300ms latency real-time updates.
- Create polls manually or extract from images using Google Gemini AI OCR
- Real-time voting with instant synchronization across all connected clients
- Password-protected polls for secure access control
- Expiring session links for time-bound events
- Live vote counters and participant tracking
- Role-based access control for event organizers and participants
- Comprehensive analytics dashboard with multiple chart types (Bar, Pie, Line, Radar)
- Real-time vote statistics and trends
- Export results as PNG images or PDF documents
- Share analytics across social media platforms
- WebSocket-based bidirectional communication using Socket.io
- Redis Pub/Sub for message queuing and caching
- Horizontally scalable WebSocket servers for high availability
- Stateless API design for microservices architecture
- 99% uptime with auto-scaling capability
Frontend
- React 19 - UI library
- Vite - Build tool and development server
- Tailwind CSS - Styling framework
- Nivo Charts - Data visualization
- Lucide React - Icon library
- html2canvas - Image export
- jsPDF - PDF generation
Backend
- Node.js - Server runtime
- Express.js - Web framework
- Socket.io - WebSocket communication
- Redis - Caching and pub/sub messaging
- Supabase - PostgreSQL database and authentication
DevOps
- Docker - Containerization
- AWS EC2 - Cloud hosting
- Nginx - Reverse proxy and load balancing
AI Integration
- Google Gemini AI - OCR and text extraction
- Node.js 18 or higher
- Redis server
- Supabase account
- Google Gemini AI API key
- Docker (optional, for containerized deployment)
- Clone the repository
git clone https://github.com/lande26/pollmap.git
cd pollmap- Install frontend dependencies
cd client
npm install- Install backend dependencies
cd ../server
npm install- Configure environment variables
Create a .env file in the server directory:
# Supabase Configuration
SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# Redis Configuration
REDIS_URL=redis://localhost:6379
REDIS_PASSWORD=your_redis_password
# Gemini AI
VITE_GEMINI_API_KEY=your_gemini_api_key
# Server Configuration
PORT=3000
NODE_ENV=development
CORS_ORIGIN=http://localhost:5173
# JWT Secret
JWT_SECRET=your_jwt_secret_key- Setup database
Run the Supabase schema migration:
cd server/supabase
psql -h your-project.supabase.co -U postgres -d postgres -f schema.sql- Start Redis server
redis-server- Run the application
Start the backend server:
cd server
npm run devStart the frontend (in a new terminal):
cd client
npm run dev- Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
- Redis: localhost:6379
Build and start all services:
docker-compose up -dView logs:
docker-compose logs -fStop services:
docker-compose downBuild frontend image:
docker build -t pollmap-client ./clientBuild backend image:
docker build -t pollmap-server ./serverRun containers:
docker run -p 5173:5173 pollmap-client
docker run -p 3000:3000 pollmap-server- Navigate to the "Create Poll" page
- Choose between manual creation or AI extraction
- Manual: Enter your question and answer options
- AI: Upload an image containing poll text
- Configure security settings:
- Password protection (optional)
- Expiration time
- Maximum votes per user
- Click "Create Poll" to generate a shareable link
- Access the poll via the shared link or room code
- Enter password if the poll is protected
- Select your answer option
- View real-time results and analytics
- Access the event dashboard to monitor active polls
- Track real-time votes and participant engagement
- View comprehensive analytics with multiple chart types
- Export results as images or PDF documents
- Share results via social media or direct links
Authentication
POST /api/auth/register - Register new user
POST /api/auth/login - Login user
POST /api/auth/logout - Logout user
GET /api/auth/me - Get current user
Polls
GET /api/polls - Get all polls
POST /api/polls - Create new poll
GET /api/polls/:id - Get poll by ID
PUT /api/polls/:id - Update poll
DELETE /api/polls/:id - Delete poll
POST /api/polls/:id/vote - Submit vote
Analytics
GET /api/analytics/:pollId - Get poll analytics
GET /api/analytics/:pollId/export - Export analytics as PDF
pollmap/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── Poll/
│ │ │ ├── Analytics/
│ │ │ └── Auth/
│ │ ├── pages/ # Application pages
│ │ │ ├── Dashboard.jsx
│ │ │ ├── CreatePoll.jsx
│ │ │ └── VotePage.jsx
│ │ ├── context/ # React context providers
│ │ │ ├── AuthContext.jsx
│ │ │ └── SocketContext.jsx
│ │ ├── services/ # API services
│ │ │ ├── api.js
│ │ │ └── socket.js
│ │ ├── utils/ # Helper functions
│ │ └── App.jsx
│ └── package.json
├── server/ # Node.js backend
│ ├── socket/ # WebSocket handlers
│ │ ├── pollHandler.js
│ │ └── voteHandler.js
│ ├── routes/ # API routes
│ │ ├── polls.js
│ │ ├── auth.js
│ │ └── analytics.js
│ ├── middleware/ # Express middleware
│ │ ├── auth.js
│ │ └── rateLimiter.js
│ ├── services/ # Business logic
│ │ ├── redis.js
│ │ └── gemini.js
│ ├── supabase/ # Database schemas
│ │ └── schema.sql
│ └── server.js
├── docker-compose.yml # Docker orchestration
├── nginx.conf # Nginx configuration
└── README.md
The application follows a microservices architecture with the following components:
- Frontend Layer - React application served via Nginx
- API Layer - RESTful Express.js server with stateless endpoints
- WebSocket Layer - Socket.io servers for real-time communication
- Cache Layer - Redis for session management and pub/sub
- Database Layer - Supabase PostgreSQL for persistent storage
- Load Balancer - Nginx for distributing traffic across servers
Client ──WebSocket──> Socket.io Server ──Pub/Sub──> Redis ──Subscribe──> Other Socket.io Servers
When a user votes:
- Vote sent via WebSocket to Socket.io server
- Server publishes vote event to Redis
- All Socket.io servers subscribed to Redis receive the event
- Servers broadcast update to their connected clients
- All clients receive real-time vote update (sub-300ms latency)
users
- id (UUID, primary key)
- email (string, unique)
- password_hash (string)
- created_at (timestamp)
polls
- id (UUID, primary key)
- user_id (UUID, foreign key)
- title (string)
- options (jsonb)
- password_hash (string, nullable)
- expires_at (timestamp, nullable)
- created_at (timestamp)
votes
- id (UUID, primary key)
- poll_id (UUID, foreign key)
- user_id (UUID, foreign key)
- option_id (string)
- created_at (timestamp)
- Real-time Latency: Sub-300ms for vote updates
- Latency Improvement: 150ms reduction using Redis Pub/Sub
- System Uptime: 99% availability with auto-scaling
- Concurrent Connections: Horizontally scalable WebSocket servers
- Database Queries: 70% reduction through Redis caching
Frontend (client/)
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLintBackend (server/)
npm run dev # Start with nodemon
npm start # Start production server
npm test # Run tests
npm run lint # Run ESLint- Use ESLint and Prettier for code formatting
- Follow React Hooks best practices
- Use async/await for asynchronous operations
- Implement error boundaries in React components
- Validate and sanitize all user inputs
- Use environment variables for configuration
- JWT-based authentication
- Password hashing with bcrypt
- CORS configuration for API protection
- Rate limiting on API endpoints
- Input validation and sanitization
- Password-protected polls
- Session expiration management
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
This project is licensed under the MIT License.
Kartik Lande
- Email: kartiklande70@gmail.com
- GitHub: @lande26
- LinkedIn: linkedin.com/in/kartik-lande
- Supabase for database and authentication services
- Socket.io for real-time WebSocket communication
- Redis for high-performance caching and pub/sub
- Google Gemini AI for OCR functionality
- Nivo for data visualization components