I meid dis - a commenting widget in Rust

in /var/log

🎄 Merry Christmas everybody!

I have been playing with Rust (again) and made this thing over the holidays where you could paste a javascript include tag in a webpage and it would load a comment section - you might have seen those on other blogs ðŸĪŠ

The aim was to get back into learning Rust, and I believe the best way to do it is to try and write a real world app. Apart from getting comfortable with the syntax and learning to love the compiler errors, a big part of becoming good at Rust is to familiarise yourself with the ecosystem of libraries and frameworks.

Let me introduce to you the star of the show - Besedka commenting widget. It is a Rust backend with Typescript on the front. The whole thing compiles into a single binary and uses sqlite for persistent storage which makes it extremely portable.

This project allowed me to get familiar with Axum and the ecosystem of crates around tower. Apart from running the server, the binary can also be ran with a bunch of other subcommands to add configuration, moderators and so on. All of this is possible thanks to the awesome clap library. They advertise it as a command line arguments parser, but for me this is a full-featured CLI app framework! Amazing!

Another cool thing is I used RSpec, yes the ruby testing framework, to write a bunch of integration specs where it would compile the backend, run the binary, and then fire requests and verify the API works correctly.

Anyways, go check it out if you are on the lookout for yet another commenting widget. I’ve been using it on this blog in production for the whopping total of 2 hours so you know it’s really good!

I’d love to add some extra features to it, like web push notifications and the ability for a moderator to see all unreviewed comments in a single place.

That’s it for now, thanks for reading and have a Happy New 2023!