Okay, just to get some ideas out of my head:
The goal is to have a functional version of this whole app that is written in rust. The frontend would become a site served with NGINX built without any server functions. I want to do this for several reasons:
- The current app is monolithic. When the osu! bot starts glitching, the whole app has to go down. Ideally this would be separated into several microservices
- Rust microservices are smaller. The current app fits in a single 400 MB dockerfile. Rewriting it in rust would let us get 3-4 services, each with only 20-30 MB each. These could then be run on a single machine with less ram, or multiple machine to scale horizontally if traffic increases.
- Rust’s packaging system seems like it will translate quite nicely to the design I’m looking for. Rather than having 5 different repos each in their own folder, I can have them all combined together in the same project and export each service as a binary.
- I want practice building a microservice app where the services are actually micro. Every “microservices” project I’ve done in the past has had two microservices, where one is the “frontend” and one is the “backend”.
- I want practice with RabbitMQ and horizontal scaling, as none of the services I’ve made before have actually been able to successfully scale horizontally.
Okay so now that I’ve convinced myself why I want to go through all this, I’m gonna start planning the how.
Services
API
This service acts as the gateway between passing data between the database, and anywhere else. The primary mode of transport for this data is a GraphQL API, where nearly all data is exposed, and mutations can be made via authentication.
Features:
- GraphQL queries for all relevant data.
- Several mutations to change relevant data, which require authentication.
- A subscription service that allows clients to stream data from games in real time.
- A RabbitMQ message-passing system to keep multiple API containers in sync.
Authentication
This service is responsible for letting users (or services) perform authenticated actions.