whatSocks / quadratic-voting

Real-time Quadratic Voting dashboard to encourage mathematically optimal voting in democratic communities.

Home Page:https://quadraticvote.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quadratic Voting (live)

Open-source, real-time QV dashboard.

Quadratic Voting is the mathematically optimal way to vote in a democratic community, where votes express the degree of your preferences, not just direction. This calculator is an open-source voting application, with development supported by Gitcoin, and is a counterpart to the Quadratic Funding Calculator.

Architecture

This application is built atop

  1. Front-end: NextJS (React)
  2. Back-end: NodeJS + Express serverless functions deployed on Vercel
  3. Database: PostgreSQL + the Prisma DB toolkit

At a fundamental level, the way in which voting links are generated and sessions are handled is kept simple:

  1. An events table keeps track of open voting events. Each event has a secret_key (uuid) to manage the event.
  2. A voters table keeps track of all voters and their preferences. Each voter has a id (uuid) that together with the event_uuid (uuid) represents their unique voting URL.

Important files:

  1. prisma/schema.sql contains the SQL schema for the application.
  2. pages/api/events/details.js contains the QV calculation logic.

Run locally / redeploy

  1. Setup your PostgreSQL database
# Import schema
pg:psql -f prisma/schema.sql
  1. Setup environment variables. Copy prisma/.env.sample to prisma/.env and replace DATABASE_URL with your PostgreSQL DB url.

  2. Run application

# Install dependencies
yarn

# Run application
yarn dev

Future development

This project is actively maintained.

There are currently plans to update this calculator based on community feedback. A few demanded items include better mechanisms of Sybil resistance (social OAuth logins), easy one-click self-deploys, and markdown support across voteable option fields.

A sprint is planned within the next few weeks to address these pieces of feedback. I encourage creating new issues to provide feedback, and I will try my best to incorporate it in the next sprint.

License

GNU Affero General Public License v3.0

About

Real-time Quadratic Voting dashboard to encourage mathematically optimal voting in democratic communities.

https://quadraticvote.co

License:GNU Affero General Public License v3.0


Languages

Language:JavaScript 100.0%