Rasmus​.krats​.se

Denna sida på svenska

New blog software

Posted 2022-01-16 22:07. Tagged , , , , .

I have written a new blog software again! The previous one was named r5, as in Rasmus (5 letters omitted). The new one is written in Rust (.rs source files), so it was natural to call it r4s, also as in Rasmus (but with only 4 letters omitted 😎).

Now let’s see if having a new shiny project for my blog engine makes me write more posts.

The style is inspired by Hamonshu by Eric Meyer and his technique for Pseudo-Randomly Adding Illustrations with CSS, but with art and type that feels more “me”.

The code is a little more than 5000 lines in 54 files, some of which are html templates, the sass stylesheet, javascript (including the leaflet package), sql migrations … and 3400 lines is rust source code. I use the warp crate, which is a great web framework, but rather low-level if compared to something like Django (which I used for r5). In a similar way, diesel is a revolutionary way integrate database code with application code in a safe, convenient, and efficient way. It may require some more code—but gives less surprises—than the django orm.

One part of the design filosofy for r4s is “bake, don’t fry”. Anything that can be ready to take out of the oven should be so, instead of converting your cpu or mine to a frying pan. The html of a page comes fully baked from my server rather than beeing created by some javascript framework in the browser. On the server, as much as posible of the html are stored ready-made in text fields in the database. The markdown-to-html conversion is done once, when a new page is added, rather than beeing repeated for each served request.

In essense, r4s is almost a static site generator, but using a database for some extra flexibility where I want it. As the server code is written in rust and does as little as possible at runtime, it should be fast enough even though it’s still served from my home computer.

Comments

Write a comment

Basic markdown is accepted.

Your name (or pseudonym).

Not published, except as gravatar.

Your presentation / homepage (if any).