My solution to Reaktor's Trainee Developer, summer 2022 pre-assignment.
The server works as a "cache" for the historical game data and serves the data via a REST API. The server is also responsible for fetching the "massive" (~900k items at the time of writing) dataset from the Reaktor's API, and storing it in a relation database.
The process of fetching the data from the Reaktor's API is relatively quick, it takes ~4 seconds to process a full page of items. It's possible it could be sped up more. I'm fairly certain it's bottlenecked by the database connection and better design there could help. Though once the whole dataset has been pulled (~1.5 hrs at the time of writing) it's much faster to only add the new games to the database. (This has been sped up significantly in the dev branch, about a second per page.)
The server is written in Kotlin.
Libraries used:
- Guice: Dependency injection
- Ktor: Web Server/Client framework
- Netty: Asynchronous Web Server
- Exposed: ORM framework
- HikariCP: Database connection pooling
- Flyway: Database migrations
Theoretically you can use any database that has a JDBC driver but at least the ones listed here by Exposed are supported.
By default, the application uses a PostgreSQL database. You can opt to use something different by adding the driver to the classpath.
I opted to take some shortcuts as the application is not intended for production use.
- The application can take sustains errors in the fetching process, errors aren't really handled just logged and the cursor is retried on the next go around.
- We are knowingly relying on the weak ETags provided by Reaktor's API.
- We are also expecting the Reaktor's API to also provide us with the rate limit headers.
The client is a Vue application, responsible for displaying the game amd player data and displaying the ongoing games via Reaktor's WebSocket API.
The client is written in TypeScript, PostCSS and Vue using Nuxt.
Libraries used:
- Vue: View layer
- Nuxt: Framework for Vue
- Vuetify: Vuetify material components
- ESLint: Linter
- Prettier: Code formatter
This project is licensed under the MIT license.