ScaleVote
It's just a non-serious project I put up to learn Spring Boot and Kafka by simulating a large-scale voting process, inspired by the recent Indian General Elections.
Lately, I've been working with dynamically typed languages like Python (Django) and JavaScript (Node). While dynamic typing is quick and forgiving for solo projects, it can lead to unpredictable issues in larger teams. This led me to technologies like TypeScript, which are amazing at mitigating many of these issues and we see it bringing some order in chaos everyday. This got me wanting to revisit my childhood roots coding in Java, and to explore frameworks utilizing Java's strong typing and robust environment. This project is an exploration of building a robust and scalable system with Spring Boot and Kafka which is capable of handling high-throughput data efficiently.
Project Overview
The goal of ScaleVote is to simulate a voting system where votes are cast at various polling booths and processed in real-time. This is a draft project created for educational purposes and does not fully relate to a real-world voting system.
Key Components
  • Polling Booth UI: A simple interface where votes can be cast. This includes options for single and bulk voting for demonstration purposes.
  • Producer Controller: Handles the incoming vote data from the Polling Booth UI and sends it to the appropriate Kafka topic.
  • Kafka Topics: Each political party has its own topic. Votes are sent to the relevant topic based on the selected candidate's party.
  • VoteConsumer Service: Consumes votes from Kafka topics, aggregates the results, and saves them to a PostgreSQL database.
  • Results UI: Fetches the aggregated vote counts from the database and displays the election results in real-time.
Database
At this draft stage I'm only storing very primitive stuff you can see in this ER diagram:
Realistically, the Vote entity should have a lot more information, and include a Voter entity having some kind of unique user identification (or an anonymized user uniqueness guarantee, hiding which user gave which vote), and the Candidate entity inherit the Voter entity (the candidate is a voter too), the PollingBooth entities be having more attributes like number of voters in the area, be linked with some kind of clustering entity, and so on... But, we're not being realistically accurate here for now!!!
To Be Continued
Will experiment more and post here later.