Skip to content

Rukenshia/shipvote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shipvote

Shipvote is a Twitch Extension for the Game "World of Warships" allowing streamers to let their viewers vote for a ship they should play on stream. It provides a lot of customization options for streamers. For a user manual, please head over to the user documentation. This README serves as a technical overview.

Architecture

TODO: update to remove pubsub

Application Monitoring

The monitoring for this application is sponsored by AppSignal. Feel free to give it a try, it's been really helpful for performance insights and finding slow code paths.

Architecture Overview

Backend Architecture Diagram

shipvote-web

shipvote-web is the main Elixir(+Phoenix) application containing all logic for handling the votes. It verifies the JWT received from twitch and also accesses the Wargaming APIs.

The twitch PubSub API is used to continuously send progress updates of currently open votes to channels. This is done to reduce load on the server since no requests need to be made directly to the shipvote-web server.

To further increase stability and scalability, a future improvement might be removing all API calls directly to shipvote-web for viewers. Right now, a request is made to retrieve basic information about a twitch channel and their WoWS info, meaning that if the extension is enabled suddenly or there is a influx of requests because a vote was opened, the server is under heavy load and might not be able to keep up.

shipvote-api

The shipvote-api is a thin layer accepting a few calls relevant to send live-updates via the Twitch "Send Extension Message" API. This allows high-frequency updates without incurring extra costs for calls and data transfer on my own infrastructure. You can read more about why this component exists below. The shipvote-api application is written in go and acts as a proxy to the shipvote-web. It accepts calls to open a vote, close a vote, and vote for a ship. This allows it to handle the lifecycle of a vote and send updates.

Design Decisions

Learnings from 1.x infrastructure

You can read more about the version 1.x infrastructure here. The main issue with the 1.x infrastructure was becoming the non-existent automated scalability for droplets on DigitalOcean. This is why I decided to migrate the project to AWS, using the Database Migration Service from AWS and using packer to automate AMI creation.

Learnings from early AWS infrastructure

The early infrastructure only included the Application Load Balancer. Due to the volume of calls received by the backend, it was quickly becoming obvious that the costs of operating the application would become too high. After researching more on the Twitch APIs, I found out that you can use a Messaging system on Twitch to send live-updates. This is how the shipvote-api package came to existence.

API Flows

This section describes interactions with the backend and third party APIs.

Channel Configuration

Channel Configuration Sequence Diagram

Twitch Video Overlay

Twitch Video Overlay Sequence Diagram