/pivot-serverless

Pivot is a web app for conducting Ranked Pairs elections

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Pivot Serverless

Pivot is a web app for conducting Ranked Pairs elections

This repo is split into:

  • ui: A Vue JS application
  • services: Python web services
  • infrastructure: A Typescript AWS CDK project

Requirements

  • nodejs v 10+
  • npm
  • Python 3.6+
  • An AWS Account
    • Create an Access Key
    • Put your access key in ~/.aws/credentials (example)
    • Populate ~/.aws/config with a region and an output (example)

Setup

Clone this repo.

$ git clone <clone url here>
cd ui
npm install
npm run build
cd ../infrastructure
npm install
npx cdk bootstrap
npx cdk deploy
# copy the API Gateway URL from the output to your clipboard
# ex: https://1234567890.execute-api.us-east-2.amazonaws.com/prod/
cd ../ui
# copy the example ui config to public/config.json
# (this path is ignored in ui/.gitignore)
cp config.example.json public/config.json
# paste the API Gateway URL from your clipboard into the config file
vim public/config.json

# verify locally
npm run serve
# visit the local URL
# ex: https://localhost:8080

# verify in the cloud 
#rebuild the ui
npm run build
cd ../infrastructure
npx cdk deploy
# copy the cloudfront hostname from the output to your clipboard
# ex: 1234567890.cloudfront.net
# visit the remote URL
# ex: https://1234567890.cloudfront.net

Tear-Down

cd infrastructure
npx cdk destroy

Details

Additional documentation is available in each directory: