Live: which.jwlarocque.com
A simple voting/polling web app, with support for instant runoff as well as approval and plurality voting. Svelte frontend, Go backend, PostgreSQL database.
Current code quality: gradually improving
- Install
git
,npm
,go
, andpostgresql
- Get server dependencies:
go get github.com/jackc/pgx github.com/jmoiron/sqlx golang.org/x/oauth2 cloud.google.com/go/compute/metadata
- Clone this respository:
git clone https://github.com/jwlarocque/which.git
- Change to which directory:
cd which
- Build the frontend:
npm run build
- Create a PostgreSQL DB from
schema.sql
(you might want to change the owner username) - Edit
start.sh.sample
with the appropriate paths and variables and rename itstart.sh
. - If necessary, allow execution:
chmod u+x start.sh
- Build the server executable:
go build -o which_server server/main.go
- If not running it with sudo, give
which_server
permission to bind reserved ports:sudo setcap 'cap_net_bind_service=+ep' which_server
Run as daemon:
- Edit
which_server.service.sample
with the appropriate paths and rename itwhich_server.service
- Move the systemd service file:
sudo cp which_server.service /etc/systemd/system
- Start the service
(
sudo
)systemctl start which_server.service
Or just run (sudo
) ./start.sh
In Progress
- Consider redirecting to question upon creation
- Sankey diagrams for ranked choice/runoff results (currently just shows winner)
- Link copy dropdown
Planned
- Question subtitles/additional information
- List of questions voted on by user
- Additional cleanup and documentation
Potential
- Config file (instead of treating start.sh as config via env vars)
- HTTPS
- Jenkins CI
Skarlso, Google sign-in Part 1
Skarlso, Part 2
Alex Pliutau, stdlib OAuth2
Jon Calhoun, Securing cookies in Go