Online Voting System

A secure full-stack electronic voting application featuring double-vote prevention, JWT authorization, and live result tallies.

Author / Role
Hareram Kushwaha (Creator)
Tech Stack
React, Vite, Node.js, Express, SQLite
Category
Full-Stack Security
Repository
Online Voting System portal preview

The Problem

Student organization and community elections often rely on informal surveys or physical ballots, which are susceptible to duplicate voting, lost submissions, and lack verifiable auditability. Online alternatives must ensure that each registered voter can cast exactly one ballot, while preventing voters from seeing or tampering with administrative tally controls.

The objective was to build an election platform enforcing deterministic double-vote prevention at the database level, coupled with token-based access control separating voter ballot interfaces from administrative dashboard controls.

My Role & Technical Stack

I engineered the project across the backend and frontend:

  • Client Architecture: Single Page Application (SPA) built with React and Vite under the client/ directory, handling authentication sessions and candidate ballots.
  • Backend API: Node.js and Express REST API featuring authentication routes (/auth/register, /auth/login) and protected voting endpoints.
  • Authentication & Security: JSON Web Tokens (JWT) for stateless session verification and bcrypt-style password hashing.
  • Data Storage: SQLite database utilizing transactional ACID guarantees to lock ballot entries and ensure double-vote prevention.

Key Features

Double-Vote Prevention

Enforces a strict unique constraint on voter IDs per election session, rejecting any second ballot attempt with an unambiguous error.

Role-Based Access Control

Separation of concerns between general Voters (who can only cast ballots) and Administrators (who can manage candidate rosters and view results).

Real-Time Tally Aggregation

Computes and displays aggregated election results without exposing individual secret ballots.

Technical Decisions

Database-Level Uniqueness Invariants

Rather than relying solely on client-side button disabling or in-memory checks, double-vote protection is enforced via unique database constraints within SQLite transactions. This guarantees safety even if duplicate HTTP requests are submitted concurrently.

React + Vite Client Separation

Scaffolding the client as an independent Vite SPA cleanly separates the view layer from the Express backend, enabling fast hot-module replacement during development and straightforward static builds for production.

What I'd Improve Next

  • Cryptographic Ballot Receipts: Implement zero-knowledge ballot verification tokens so voters can confirm their vote was counted without revealing their choice.
  • Database Migration for Scale: Transition from SQLite to PostgreSQL for high-concurrency campus-wide elections with connection pooling.
  • Multi-Factor Authentication: Add email or TOTP one-time passcode verification during voter registration.