DEV Community

Tristan Farkas
Tristan Farkas

Posted on • Originally published at Medium

OxidemusiC and the somewhat modern tech stack it uses.

About one month ago my personal project OxidemusiC officially launched.
This post won't discuss what OxidemusiC is and what it does, but if you're interested in learning more about the application I recommend you visit the website.

This was one of my most time consuming personal projects ever, and I did not exactly make it easy for myself. The project makes use of JavaScript, Python and Rust for the backend services. These languages all have their upsides and drawbacks. The initial version of OxidemusiC relied solely on Python. And that was fine and all when it was just an application I used with me and my group of friends. But when I actually released it, I noticed a big problem. What do I do when I create a breaking change and the app can't run reliably on the new version of the API. And in comes Cloudflare Workers to save the day. Since this version endpoint would be the most requested endpoint I wanted to run it on something that could handle unpredictable amounts of traffic.
OxidemusiC infrastructure

This picture shows two things, the technical stack which OxidemusiC uses and that I'm very much not a graphical designer.

Let's start from the top, all the way to the bottom.

So! Cloudflare Workers, I honestly had a great experience using workers. It was easy getting used to the interface and even though I have little to no JavaScript knowledge it was super easy to make with all the documentation provided by Cloudflare. If you have not used Cloudflare Workers I highly recommend you check them out here. Right now Workers does not have that big of an role within OxidemusiC. All it's used for currently is checking that the server is okay and checking that the user is on a compatible application version. Pretty basic.

Do you want to know what is not basic though? Rust. Do you want headaches, emotional stress and questioning your life choices? Then Rust is the programming language for you! I spent hours making this Rust application, let me give you a rundown of what it does.
Screenshot from the OxidemusiC app

You see that message where it shows how many users are listening along. That's all it does.

I could have probably made that feature in like twenty minutes using Python, but the problem is Python is quite slow. So I looked at alternatives to use for implementing it, in the end it was either Elixir or Rust, and I ended up using Rust thanks to its amazing portability, so after I have a compiled executable that's all I'll need to run the application. While Rust has amazing portability, it is however a pretty different language. Sure it out performs most languages out there, and does not let you make mistakes that easy. It's fucking stupid, no good, shit ass ownership system put me on the edge of a mental breakdown. Even to quote the Rust docs:

"Because ownership is a new concept for many programmers, it does take some time to get used to."

And indeed it does. Coming from Python I'm just used to being able to do what the fuck I want to, when the fuck I want to using variables. But it is also this ownership system that makes Rust safe and efficient. So I guess you're just forced to adapt sometimes. So I spend about two hours figuring this shit out and screaming at the rust compiler. But eventually I got greeted by this:

Rust executable compiled for release

You can not imagine my relief knowing I was done with the Rust part.

So that is deployed and has been running quite smoothly so far, at least there have not been any runtime issues yet🤞. That's enough talking about things that makes no sense what so ever, so let's move on to everyone's favorite programming language, Python!

Oh Python, so simple and so flexible. While I definitely spent the most time writing this code, the code I wrote just made sense, and I can access a variable without getting twenty different issues complaining that I can't move the variable. (cough Rust cough). Python does all of the heavy lifting, the actual music playback, managing what parties you can join, party creation, account management and that's about it. All pretty straight forward things. I would talk about the issues I ran into when making the Python application, if there were any. Now sure I ran into some minor bugs when making the Python side of things, but nothing notable really.

I just figured I'd give the public an understanding how OxidemusiC is structured, since I've been quite quiet about the technical details of the application. On a final note, since I know most of you are interested by security stuff, there's some somewhat exciting news coming soon hopefully.

Top comments (0)