CanVote 🇨🇦, short for Canada Vote, is a web application that allows Canadian voters to vote for a candidate in their electoral district in a quick and efficient fashion. As well, it features the ability to show real-time election results, allowing the public to understand the grasp of which direction the country is heading towards. Overall, the web application works in the confines of an election, where the election contains multiple political parties, and electoral districts (or ridings) with candidates from each political party.
To ensure the stability of the election on CanVote, there are a variety of user roles with different responsibilities. As well, to ensure that a voter is who they say they are, they will be authenticated with two-factor authentication. The second factor of authentication will be a unique method of asking the voter to record themselves through HTML media capture saying a phrase randomly provided to them. When the recording is submitted, a combination of face and voice recognition technologies will be used to verify that the voter is indeed an individual registered to vote and is prepared to vote for themselves. With a combination of these features, it will make it harder for third-party manipulators to modify election results.
Side Note: For the sake of this project, the application will not account for all voters in the real-world as users of the application will have to speak english; can register with an election officer beforehand; has access to a device with a modern browser; and has a webcam and voice recorder on their device.
A public view of real-time riding results and which parties are leading in the polls can be viewed through bar charts in the application. When the voting period is over (i.e. all electoral districts have closed voting), a choropleth map can be accessed to view who has won a majority in each riding, and the overall results (similar to what you would see at the end of an election).
The inspiration for this web applications comes as statistics show that elections are disproportionately against low-income citizens (in the United States). With an application like CanVote, it can remove some (but not all) barriers such as being busy or not being able to physically go to a voting station. CanVote allows voters to register in advance with election officers anytime before an election and then cast their ballot quickly during the election period. As well, recent news from the 2020 Iowa democratic caucuses has inspired us for a challenge to build something that can be better implemented and simple to use.
The README for /voting-service
, /auth-service
, and /ws-service
all contain API documentations for their respective services.
An administrative officer is a non-bias actor which manages the foundations of the election, such as political parties, ridings, candidates, and election officers. This role can be thought of as a member of the administrative staff in Elections Canada. The resources they create is the first step in allowing voters to vote through the system.
An election officer is a non-bias actor which is responsible for managing voters in electoral districts. This role can be thought of as a government employee in a government office that registers a voters into the system, enabling voters access to the system.
A voter can vote once for a specific political party within their electoral district. When a vote is added, two resources are modified to ensure a voter doesn't vote again and a vote has been added - this ensures anonymity. To create an account, a voter should present government issued id to an election officer, and then the election officer should be able to proceed with creating their account.
Like a real election, anyone can view voting results. As such, any user can view the voting results of each electoral district in real time through a bar chart. After all electoral districts have closed voting, then a choropleth map displaying parties that have won each electoral district can be viewed.
- Frontend
- CSS Framework:
- Web Experience Toolkit (WET): WET is a front-end framework designed and developed by the Government of Canada. Built on top Bootstrap 3.
- JavaScript Libraries:
- React: Component based library to build repetitive UI.
- Axios: Promise based HTTP Client used to make HTTP ajax requests.
- Apollo Client w/ Hooks: A GraphQL client that includes state management. Takes care of requesting and caching data, as well as updating the UI.
- Chart.js: Chart library used for displaying election results
- CSS Framework:
- Backend
- Voting Microservice: A service that exposes APIs to create, read, update and delete voting resources such as political parties, candidates, votes, and ridings.
- Language: JavaScript (NodeJS)
- Frameworks: ExpressJS + Apollo Server
- Persistence: MongoDB
- ORM: Mongoose
- Authentication Microservice: A service that enables authentication, and manages user resources.
- Language: Python
- Framework: FastAPI
- Persistence: PostgreSQL
- Websocket Microservice: A service that broadcasts votes in real-time through WebSockets by subscribing to data in MongoDB through Change Streams.
- Voting Microservice: A service that exposes APIs to create, read, update and delete voting resources such as political parties, candidates, votes, and ridings.
- Deployment
- Docker
- Kubernetes (on GKE)
- Security and Authentication: As an application to be used for an election, it is very important that the application is to be implemented with strong security as a consideration. Therefore, the way the application is deployed, how to store data, and how data can be accessed must be carefully considered. In the next bullet point, we discuss how security will be a challenge with microservices. Furthermore, when dealing with authentication, we plan to utilize a combination of facial and voice recognition as a means for two factor authentication. The transition between first logging in with a username and password to the second factor of authentication will need to be carefully considered.
- Microservices: Connecting all the services together will be a challenge. In class, we deal with monolithic applications, but in this project we hope to split everything into independent services and fuse it all in the end. Effectively combining all these services securely in production will add another challenge to our plate, such as stateless tokens.
- Charts and Maps: This library is new to all of us, and we are hoping to use it for the map generation in the end. This does not seem trivial, and that is why it is a technical challenge.
- WebSockets: WebSockets will be utilized to display data in real-time. As it is a different method of communicating to a backend compared to REST through HTTP, there will be some challenges as not all members have dealt with continuous communication.
- React: The team members have little to no experience in this library. We are trying to learn this over the reading week, so it will be easier to create the frontend.