This past year, as part of my work on kscu.org, I’ve developed a Spinitron API relay program. Since our website was static and used client side requests to populate Spinitron data, we needed a way to fetch this data without exposing our Spinitron API key.
I decided to open source and post this tool in case any other stations ran into the same issue that I did and wanted to use this!
What is the Spinitron API Relay Server?
Once set up, this server allows you to make GET requests for your station’s current spins, shows, and DJ info. Moreover, the server caches the data received from Spinitron, making it an ideal middleman for applications that require frequent requests, like a station website.
One of the server’s key features is a server-sent event (SSE) endpoint, which notifies clients when a new spin is logged, eliminating the need for clients to continuously poll the server for new spins.
This project was built with Rust specifically for its memory safety and efficiency. The program has been load tested on an AWS free-tier instance up to 20k requests per second, which should be enough for most small stations.
This project was initially created as a student project for KSCU 103.3 FM at Santa Clara University. Check us out!
Installation and Setup
The server can be installed and set up with minimal efforts. Installation guide and setup steps can be found here.
Moreover, it can run on both local and server environments. For hosting on AWS or other platforms, specific containerization schemes would apply.
Help and Questions
I’m sure there are many ways this could be improved, and it has quirks specific to KSCU’s need, however, I wanted to post this to help out other Spinitron developers who might want to use the project, even if just for reference code. Please reach out if you have any questions!