This project aims to solve the server-side of the Anovote application, a digital anonymous voting system. Anovote aims to implement
a voting solution that can perform secure, digital and anonymous elections. It is required that the solution secures the anonymity
of eligible voters, that a vote cannot be modified and that the voter is validated and approved prior to the election.
- TypeScript
- Node
- Yarn
- Express
- TypeORM
- PostgreSQL
- Socket.io
- Nodemailer
- Node cron
- Docker/Docker compose
- Nginx
- Certbot
The anovote backend comes with an Anovote CLI, which can be used to start or clean the development environment.
Since the anovote CLI is located in the root folder, you may have to run chmod +x ./anovote
for execution access.
It is therefore recommended to run the Anovote CLI on a linux based system.
To be able to use the Anovote CLI, Docker and Docker compose needs to be installed on the device.
The Anovote CLI comes with the following commands:
anovote dev
, which starts the development environment (database and server).anovote dev --build
, which builds server images and starts containers.anovote dev --down
, which stops the development containers, removes all volumes and clear all orphan child containers.anovote dev --force
, which re-creates the containers and starts the development environment.
- Node
- Yarn
- Docker
- Docker compose
- Create an
.env
file in the root of the project based on the existing.env-example
DB_HOST
must be "localhost" OR "127.0.0.1".DB_PORT
must be "5432"
- Run
yarn install
- Run
docker-compose -f ./docker-compose.yml -f ./docker-compose-dev.yml up db
- Run
yarn dev
- Let the code fly!
- Hot reloading is enabled, so the server restarts on code change in the
src
directory.
- Hot reloading is enabled, so the server restarts on code change in the
- Docker
- Docker compose
- Node (Optional)
- Yarn (Optional)
- Create an
.env
file in the root of the project based on the existing.env-example
DB_HOST
must be "anovote_database"DB_PORT
must be "5432"
- (Optional) Run
yarn install
- This is only required for getting the types in your editor, but is not required for running as the container has its own node_modules folder.
- Run
./anovote dev --build
- If the images are already built, run
./anovote dev
- As described in the Anovote CLI section, this might require execution permission.
- If the images are already built, run
- Let the code fly!
- Hot reloading is enabled, so the server restarts on code change in the
src
directory.
- Hot reloading is enabled, so the server restarts on code change in the
Currently the Anovote stack is built from the backend. The anovote team is planning to move the building of the Anovote stack out of the backend repository.
The anovote backend is also responsible for building the anovote stack, this means fetching and building the frontend, setting
up a NGINX proxy and fetching certificates.
By running the start-production.sh
bash script, the following will happen:
- Stop any old production services still running
- Set up a HTTP folder which will be used by the NGINX proxy
- Creates SSL certificates used by the NGINX proxy if they do not exists.
- Fetching the Anovote frontend repository from GitHub.
- Build the anovote frontend, which makes a static index.html served by the NGINX proxy.
- Configures the NGINX proxy.
- Starts the Anovote backend.