Back to projects

Election platform

Vox

Election platform with Angular, Spring Boot, and PostgreSQL used in an election at Etec de Guarulhos.

Technical vision

Voting with transactional serialization

Vox keeps validation, vote persistence, and ballot-box closing inside the same transaction to avoid invalid concurrency.

Impact106 req/s

100% success over 10,000 requests and 100 concurrent accesses on AWS EC2 t2.micro

Validations

Candidate, election relationship, ballot-box state, and time window are validated before persistence.

Concurrency

PESSIMISTIC_WRITE serializes requests on the same ballot box.

Realtime

STOMP and WebSocket communicate platform updates.

Execution flow

Main flow

Voting with transactional serialization

Vox keeps validation, vote persistence, and ballot-box closing inside the same transaction to avoid invalid concurrency.

CONCURRENT REQUESTS -> LOCK -> COMMIT -> NEXT

  1. 01

    Vote is received

    The platform validates candidate, election, ballot box, and time window.

  2. 02

    Ballot box is locked

    PESSIMISTIC_WRITE serializes requests on the same ballot box.

  3. 03

    Transaction completes

    Validation, vote persistence, and ballot-box closing remain inside the same transaction.

Engineering decisions

Architecture

Pessimistic lock by ballot box

PESSIMISTIC_WRITE prevents invalid concurrent votes on the same ballot box.

One transaction for the critical cycle

Validation, vote persistence, and ballot-box closing stay in the same transactional boundary.

Realtime with WebSocket

STOMP and WebSocket support realtime communication.

Risk controls

Reliability

Invalid vote

Candidate, election, ballot-box, and time-window validations protect the flow.

Concurrency on the same ballot box

Serialization through PESSIMISTIC_WRITE avoids conflicts at the critical voting point.

Stack

Application

  • Angular
  • Spring Boot

Data and transaction

  • PostgreSQL
  • PESSIMISTIC_WRITE

Realtime

  • STOMP
  • WebSocket

Outcome

Real use and documented load test

More than 500 voters participated in an election at Etec de Guarulhos; on AWS EC2 t2.micro, the test had 10,000 requests, 100 concurrent accesses, 100% success, 0 failures, and 106 req/s.

100% success over 10,000 requests and 100 concurrent accesses on AWS EC2 t2.micro
106 req/s
voters in real use at Etec de Guarulhos
500+

Next project

Auronix

End-to-end financial platform with accounts, transfers, and payment requests.

Next project