Election-Day Live Platform
Real-time voter-card scanning and campaign dashboard for a national general election.
A national political campaign needed to know, in real time, how voters were responding on election day itself — while polls were still open — across a country with 200,000+ registered voters and dozens of constituencies. An earlier prototype depended on a slow round-trip to an external system for every read, gave every user visibility into every region regardless of role, and refreshed on a timer rather than in real time.
- A phone-based scanning app for canvassers, built as an installable app rather than a browser page — deliberately, because installation is what guarantees the offline queue and camera permissions actually work when it matters.
- A true real-time dashboard — every scan triggers an instant push to every open dashboard, updating live totals and regional breakdowns within a few hundred milliseconds, with no polling loop running at all.
- Offline-first scanning — a queued-on-device, auto-flush-on-reconnect model so a canvasser working in a dead zone never loses a single record.
- Role-based data scoping enforced at three separate layers — the database query, the API, and the live dashboard's real-time feed — so a regional manager only ever sees their own area's data even if one layer had a bug.
- Two-tier caching that separates the heaviest aggregate calculation from the paginated list of individual records, cutting the dashboard's busiest-view response time by roughly six times.
- A natural-language AI analyst layered on top, letting campaign staff ask plain-English questions and get a summary, a chart, and a one-click export.
The system recorded over 115,000 voter-card scans live on election day, with campaign leadership watching results update in real time throughout the day. The dashboard held up under sustained, nationwide load with response times fast enough to feel instant, and not a single scan was lost even in locations with unreliable connectivity.
- Forcing app installation was a deliberate UX trade-off — the right call for a system that had to work correctly on exactly one day, with no do-overs.
- Denormalizing the database was the single highest-leverage performance decision — copying a few fields onto each record at write time turned the busiest screen in the system from several joins per page load into zero.
- Layered access control, not a single gate — enforcing regional scoping independently in the database, API, and event stream meant a mistake in any one layer couldn't leak another region's data.
Next.js · PostgreSQL · Pusher (real-time events) · Progressive Web App / service workers · OpenAI / DeepSeek (natural-language analyst layer)