GitHub Repository can be found here, and Releases are found here
Name | Student ID | Role | Github |
---|---|---|---|
Dylan Tok | 2101372 | Backend Lead | @dthx2710 |
Xu Xueli | 2101812 | Databases and Analytics | @xx-ue |
Derick Kwok | 2100689 | Docker and Deployment | @zyferis |
Zhang XiangHui | 2101993 | Backend and Testing | @XiangHui556 |
Yong Kai En | 2100658 | Frontend Lead | @kaiiennn |
Samantha Lee | 2102066 | Frontend and Testing | @slqy |
This project is a cloud-native solution that leverages gRPC and Kafka to create a scalable and distributed voting platform; with a efficient and reliable voting processes across multiple nodes.
In this prototype, users are able to log into the system as an user or a system admin to view the polls of their GRC (Group representation constituency) location. Users will also be able to vote on these polls. Admins will be able to view the results of these polls, while also being able create and delete them.
The system is designed as a microservices architecture, with distinct services for our business logic.
By utilizing gRPC, a high-performance RPC framework, the system ensures secure and seamless communication between client applications and voting servers, enabling users to cast their votes efficiently.
To enable data-queuing and event-driven architecture, the system incorporates Kafka, a distributed streaming platform. Kafka facilitates the smooth transmission of vote-related events across distributed nodes, enabling real-time updates and result aggregation. Kafka also helps with fault tolerance and data integrity of the payload.
Security and anonymity has been enhanced with the use of JSON Web Tokens (JWT) for authorization and authentication, hashing and salting for passwords and voters so identities cannot be tracked back.
Designed with cloud-native principles in mind, the Distributed Voting System can be effortlessly deployed and scaled on modern cloud platforms. With the help of containerization technologies like Docker and Kubernetes, deployment and management across various cloud environments become simplified. Additionally, our project is also deployed on the cloud using Google Kubernetes Engine.
In summary, the Distributed Voting System combines cloud-native technologies, gRPC, and Kafka to provide a scalable and secure voting solution. It aims to deliver an efficient and transparent voting experience, ensuring the integrity of the entire voting process in real time.
- A machine running Windows or Linux operating system
- Docker
- NodeJS and Go if you want to run the services manually (optional)
./frontend
- Contains the frontend code for the web application./gateway
- Contains the gRPC gateway code./user-service
- Contains the user-service code./poll-service
- Contains the poll-service code./result-service
- Contains the result-service code./vote-service
- Contains the vote producer and consumer./nginx
- Contains the nginx configuration file./kubernetes
- Contains the kubernetes configuration files./docker-compose.yml
- Contains the docker-compose configuration for the services
- Clone the repository or download release from here
- Configure the environment variables in the
.env
file:- You can use the
.env.sample
file as a template (copy and rename as.env
) - !IMPORTANT! Add Database Credentials to the
.env
file, based on the details provided in the submission email/pdf:DATABASE_URL={provided string}
- You can use the
- Start Docker
- Build the container (optional)
npm run build
- Run the container
npm run up
- With this, the Docker-Compose Stack will be up and running
- The frontend will be available at
localhost
or wherever you are hosting/deploying this on (HTTP - port 80) - The gateway will be available at
localhost:8080
, and acts as a internal proxy for the other api services on ports (e.g.50051
-50054
) - We have an NGINX reverse proxy running on port
80
to route the traffic to the frontend and gateway
- The frontend will be available at
The protobuf files are already generated, but if you want to generate them yourself, you can do so by following the steps below:
- Install protoc, protoc-gen-go, protoc-gen-grpc-web, make
- Find the proto files in the
proto
directory - You can simply run
make protoc-all
to generate the gateway files - Or alternatively, copy the commands in Makefile to run them individually if you prefer This will generate the Protobuf files for gRPC communications
We recommend using Docker to run the services instead, but if you want to run the services manually (NOT recommended), you can do so by following the steps below:
- Install NodeJS, go
- Configure environment files for each folder
- Start frontend, gateway, user, poll, result, voteproducer/consumer + kafka/zookeeper compose container services in separate terminals