Statusbox
Continuing the current theme of the indie web, I built statusbox, which is the little string of text you see below my name on the homepage. This project was also inspired by something I found while browsing the indie web. While what I saw was a bit more polished and “established” (it was a whole platform anyone could sign up to), I wanted something of my own. Something I could host myself. The project seemed rather small, and I had lately been using axum and diesel, so I decided to build it myself. In fact, I thought I could build it in a single bus ride. (It actually took three.)
Statusbox is really small. It has only four paths you can call and it’s extremely bare-bones. You can only:
- Retrieve the latest status
- Post a new status
- Create a new author
- Create a new author token
As I said, extremely bare-bones. No deleting of statuses or users, (which might be against GDPR? but I don’t think my friends will sue me) and you can only ever get the latest status.
And that’s on purpose. This is meant to be a place for me (and my friends) to share the thoughts we have at the moment. Thoughts that may be irrelevant in couple days, or things that may not represent who we are on the future. This is one of the things I don’t like about social media. People can just dig up stuff you said years ago that no longer represents you. This is meant to give me that space to share my thoughts without the burden of comments or permanence.
Working on this was great for learning about dealing with users, keeping their passwords safe and such. I also got to learn about how to use sqlite, which will definitely be useful at some point, since sqlite is everywhere.
And yeah! I used sqlite. As I already said, statusbox is tiny, and 99% of the time the only operation done will be reading the latest status. Since I’ve deployed this on docker, using any other database would have been overkill. I would have needed a stack with a database container and all the works. With sqlite I can just attach a volume where the db file is.
Overall, this was a nice project to work on. It allowed me to take a break from what I usually do, learn a bit about backend servers and about the web. I might come back on the future to add some polish and new features, just like I’ve been doing with this website.
Update: #
Polish added! After I switched this website’s hosting to sourcehut, which adds a content security policy header that prevents statusbox from worked, I saw myself forced to update it. I took the opportunity to do a major refactor and clean it up a lot.
The main goal of the update was to make it serve HTML though. The Statusbox server used to send JSON, and the website would display it
using javascript. But the new content security policy disallows scripts from fetching data from other domains. What still works? <iframe>s.
So I got the idea to make statusbox return HTML so it could be rendered inside an HTML <iframe> tag.
Having heard about maud not too long ago, I thought it would be interesting to use it. And it’s pretty cool! Really impressive what you can pull off with rust macros.