Skip to main content
Full-Stack MERN · CodeEra Hackathon 1st Place Winner
Source-Verified Implementation

PollBoard

First Place Winner (₹5,000 prize) at CodeEra Hackathon. Real-time polling and quiz platform featuring bi-directional Socket.IO updates, Recharts analytics, duplicate vote prevention, and client CSV exports.

Role: Full-Stack Developer
PollBoard Interface Preview

Project Overview

PollBoard is a real-time polling and audience-engagement platform built on the MERN stack (MongoDB, Express 5, React 19, Node.js) with Socket.IO.

Developed for and awarded First Place (1st Prize: ₹5,000) at the CodeEra Hackathon, PollBoard is engineered for classrooms, student teams, live presentations, and hackathons where creators need instantaneous live response tallies without page reloads.

The platform features room-based WebSocket broadcasting, animated analytics powered by Recharts, automated poll expiry enforcement, and CSV export functionality.

The Problem & Motivation

  • Traditional survey tools rely on page refreshes or periodic polling, making them sluggish for interactive live presentations or classroom voting.
  • Many lightweight poll tools lack essential security controls, allowing ballot box stuffing through repeated submissions from single browsers.
  • The technical goal was to build an ultra-responsive, real-time polling application with room-isolated WebSockets, atomic vote tallying, and robust anti-duplicate submission safeguards.

Architectural Solution

  • Developed a React 19 client with Vite and Tailwind CSS 4, utilizing Framer Motion for micro-interactions and Recharts for live visual data representations.
  • Engineered an Express 5 backend with MongoDB and Mongoose, implementing Socket.IO rooms to isolate real-time event broadcasting to active poll participants.
  • Built dual voting modes: authenticated voting tracked by user ID and anonymous voting using client session tokens and IP heuristics as a lightweight deterrent against casual re-voting (acknowledging that anonymous client heuristics can be bypassed via incognito windows or IP rotation).
  • Managed voting concurrency and deduplication by implementing dual partial unique indexes in Mongoose: the authenticated unique index { poll: 1, respondent: 1 } uses partialFilterExpression: { respondent: { $type: "objectId" } }, which applies only to authenticated respondents and excludes anonymous records where respondent is null; the anonymous unique index { poll: 1, anonymousVoterHash: 1 } uses partialFilterExpression: { anonymousVoterHash: { $type: "string" } }.
  • Added security and reliability middleware including Helmet, CORS, and express-rate-limit to protect API endpoints against abuse.

Technology Stack & Evidence

Technologies categorized by source verification and documented implementation scope:

Frontend Client

React 19
Vite
React Router DOM 7
Tailwind CSS 4
Framer Motion
Recharts
Socket.IO Client
Axios

Backend & Real-Time Engine

Node.js
Express 5
Socket.IO
Zod Validation
JWT Authentication
bcryptjs

Database & Persistence

MongoDB
Mongoose ODM

Security & Middleware

Helmet
CORS
express-rate-limit

Architecture & System Flow

1

Client Application (client)

React 19
Vite
Tailwind CSS 4
Framer Motion

Responsive single-page application handling poll creation, voting flows, and animated chart displays.

2

Real-Time WebSocket Layer

Socket.IO
Room-Based Channels

Manages client socket connections, groups connections into poll-specific rooms, and broadcasts live tally events upon vote submission.

3

API Server & Auth (server)

Express 5
Zod
JWT
express-rate-limit

REST API handling user authentication, poll CRUD operations, payload validation, and voting endpoint security.

4

Persistence Layer

MongoDB
Mongoose ODM

Document models for users, polls, questions, and voter logs with compound indices to ensure data integrity.

Core Implemented Features

CodeEra Hackathon First Place Achievement

Awarded First Place (1st) with a ₹5,000 cash prize at the CodeEra Hackathon for live interactive audience engagement and room-based Socket.IO architecture.

Room-Scoped Live Response Streaming

Socket.IO rooms broadcast vote increments and participant counts instantly to creators and voters without unnecessary traffic across other polls.

Multi-Question Poll Builder & Expiry

Flexible creator workflow supporting single and multi-question polls with optional expiry deadlines enforced by server-side schedulers.

Interactive Analytics & CSV Export

Real-time dynamic bar and pie charts rendered via Recharts, with one-click client-side CSV export for offline analysis.

Duplicate Vote Prevention & Security

Enforces vote uniqueness for authenticated accounts via a partial unique index on { poll, respondent } (excluding anonymous nulls), alongside dedicated token-hash deduplication for anonymous respondents.

Technical Challenges & Trade-Offs

01.Isolating Real-Time Broadcast Traffic with Socket.IO Rooms

Challenge

Broadcasting vote updates to a global WebSocket namespace wastes bandwidth and causes security leaks as participants receive updates for unrelated polls.

Engineering Approach

Implemented room-based socket subscriptions (join:poll): voters and creators join only their specific poll's room, and the server emits events strictly to socket.to(pollId).

Result

Clean network isolation with minimal overhead, maintaining high real-time throughput even with concurrent active polls.

02.Handling Concurrent Submissions with Partial Unique Indexes

Challenge

Simultaneous vote submissions can cause race conditions. Furthermore, a naive unique compound index on { poll: 1, respondent: 1 } includes anonymous records where respondent is null, causing duplicate key collisions across distinct anonymous voters on the same poll.

Engineering Approach

Separated authenticated and anonymous deduplication into distinct partial unique indexes. The unique index { poll: 1, respondent: 1 } uses partialFilterExpression: { respondent: { $type: "objectId" } }, which applies only to authenticated respondents and excludes anonymous records where respondent is null. The anonymous unique index { poll: 1, anonymousVoterHash: 1 } uses partialFilterExpression: { anonymousVoterHash: { $type: "string" } }. Validated this fix with an automated 19-test MongoDB verification suite (commit a230b93) covering sequential voting, concurrent voting and race conditions, duplicate-key protection (HTTP 409 Conflict), authenticated and anonymous vote handling, and legacy index replacement and migration safety checks.

Result

Enforced one-response-per-account integrity for authenticated users and anonymous vote deduplication using voter hashes, while eliminating cross-voter null collisions. Anonymous deduplication depends on continuity of the client-side voter token and may be bypassed if that token is cleared or reset. The schema index correction and migration procedure are verified in the codebase (commit a230b93). The production database migration has not yet been executed and requires a separately planned maintenance window.

03.Smooth Transition from Voting to Published Results

Challenge

Managing poll states (draft, active, expired, published) across disparate clients without forcing manual page reloads.

Engineering Approach

Broadcasted state-change socket events (poll:published) that dynamically trigger client-side re-renders, immediately locking the voting form and displaying the results dashboard.

Result

Instantaneous state transitions that keep audience screens synchronized in live presentation settings.

Key Engineering Takeaways

Awarded First Place (1st Prize: ₹5,000) at the CodeEra Hackathon for real-time polling performance and resilient WebSocket room engineering.
Gained hands-on experience designing and debugging room-scoped WebSocket architectures with Socket.IO.
Engineered and verified MongoDB partial unique indexes to solve cross-voter null index collisions, backed by an automated 19-test verification suite covering concurrency, error mapping, and legacy index replacement.
Engineered accessible, real-time data visualizations using Recharts and Framer Motion.