Cory Zeitz

Return Home

Coursework Detail Page

Professional Society Election System

Election Bay

A web app for managing elections in professional societies with reliable vote and candidate management flows.

Election platform details

Platform Summary

Full-stack election system for managing voters, ballots, initiatives, and results at scale. Built to simulate enterprise workloads with strong auditing, analytics, and database-first performance features.

Users

20K+

Votes

1.4M+

Auth Model

JWT + RBAC

Highlights

  • Enterprise-style workload simulation and reporting.
  • Role-based access with granular permissions.
  • Materialized views, triggers, and PL/pgSQL functions for analytics.
  • Redis caching and indexed-query strategy for throughput.
  • Pino structured logging with request-to-query correlation via reqId.
  • Append-only and log-based auditing coverage for admin-sensitive actions.

Tech Stack

Backend

Node.js, Express, TypeScript

Database

PostgreSQL, Prisma ORM, PL/pgSQL, triggers, materialized views

Auth

JWT access/refresh, HttpOnly session cookies

Observability

Redis cache, Pino logs, metrics endpoints, Jest tests

Database Design

Core entities include users, companies, ballots, positions, initiatives, candidates, votes, and assignment tables for company/society membership.

FeaturePurpose
`user_voting_status` (Materialized View)Fast dashboard reads for who voted vs who has not.
`check_ballot_voter(ballot, user)`Guard rails to prevent duplicate voting by user.
`get_ballot_voting_status(ballot)`Aggregate + per-member turnout status in one function.

Security and RBAC

  • HttpOnly cookie session (`user_session`) with SameSite=Lax and secure in production.
  • Middleware-enforced roles: `Admin`, `Employee`, `Officer`, `Member`.
  • Input validation with Zod across body and query parameters.
  • Least-privilege database runtime role (`ElectionSystemUser`) for API access.
  • Threat model coverage for SQL injection, CSRF, brute force, replay, privilege escalation, and DoS.

API Snapshot

REST API supports authentication, user management, ballot lifecycle, turnout checks, and results viewing with pagination/filtering and consistent error modeling.

EndpointMethodRole(s)
`/login`POSTPublic
`/createBallot`POSTEmployee, Admin
`/submitBallot`POSTMember, Officer
`/viewBallotResults`GETMember, Officer, Employee, Admin
`/getSystemReport`GETAdmin, Employee

Auditing and Observability

  • HTTP audits in `log/app.log` with request metadata and response timings.
  • Prisma query audits in `log/db.log` with model/action/duration metrics.
  • Traceability via shared `reqId` across app and DB log streams.
  • JSON logs designed for ELK/Datadog/Loki ingestion pipelines.

Frontend and Screenshots

Add your final frontend walkthrough and screenshots here. The cards below are placeholders for election dashboard, ballot flow, results view, and admin analytics.

Dashboard

Ballot Flow

Results

Admin Analytics