Hero banner

Vaultbot

View on GitHub
#python#javascript#typescript#gcp#docker#kubernetes#react#graphql#postgresql

Overview

Vaultbot is a Discord bot that allows users to add songs from Spotify to a managed playlist. After two weeks, the songs are removed, thereby keeping the playlist fresh. The playlist history along with various song statistics are tracked and displayed in a React web application.

Additionally, Vaultbot generates so-called “aggregate playlists,” which are themed playlists that are created by taking the top songs for a given category, weighted by the number of times the song has been added to the playlist. Some of these themes even rotate on a CRON schedule, such as a featured genre playlist, as well as a “Shift” playlist that randomly selects two unique audio features (such as “danceability” or “energy”), calculates and selects a quartile for each feature, and then selects songs that fall within that quartile range.

Technologies

The entire stack is hosted on Google Cloud. The bot is written in Python and uses the discord.py library and is deployed as a Kubernetes pod. The backend is written in TypeScript and uses Apollo Server. The frontend is written in JavaScript and uses React and Apollo Client. Both the backend API and frontend are deployed to Cloud Run. The underlying PostgreSQL database is hosted on Google Cloud SQL. The code is stored in a monorepo on GitHub, and a CI/CD pipeline is used to automatically deploy the application to Google Cloud via Google Cloud Build.

The Future

Vaultbot in its current form has undergone a few iterations since I first started working on it in 2020. I am working on migrating the application to a fully event-driven, loosely-coupled serverless architecture on AWS, along with a full database rework for multitenant support and purpose-built databases for timeseries data. Additionally, I am a fan of IaC and plan to use CDK to manage the infrastructure for the new application. This repo is therefore no longer being actively developed, but I continue to maintain it for my own personal use.