The idea
In June, I started learning Rust
. Why? Just out of curiosity. A system-level language with a lot of syntax sugar, new patterns, and approaches. So, I started with the Rust Book, got through half of it, and decided to build something real.
My previous blog was made with PHP 5.5
more than ~8 years ago. It wasn’t bad, but I completely quit PHP. I didn’t want to touch that old codebase. So I came to the conclusion: why not write a new one, this time in Rust?
Here it is. You’re welcome ;)
AI
I didn’t want to vibe-code it. However, I didn’t want to face all the obstacles by myself. So I used ChatGPT
a lot, for almost every aspect of the development. I turned off Copilot
and didn’t use Cursor
. Because I wanted to write the blog “myself”. To feel it. At least in some merit. GTP was always in a separate browser tab. More like a helper, not an author.
Rust. First impression
Rust is wonderful, but it’s a system-level language. I had no real experience in this area before. Just a few simple C++
LeetCode
problems, which gave me no real C++
knowledge. So it was a real challenge. But I wasn’t completely unarmed. I still remembered something about pointers, the heap, allocation, and other important system-level stuff. Though it was purely theoretical in my mind.
I was curious how hard it would be to learn the borrow checker. You know… It’s hard and not that hard at the same time. Because the system is huge, with so many different aspects. I probably still know only 10–15% of it. Just the parts I needed to move forward. Even though writing web servers implies writing async code, I didn’t really face most of the complex async problems. E.g., no mutexes, no manual work with threads, no RefCell
, Cell
, dyn
, Rc
, or other similar tricks. Most of it was hidden in the internal implementations of the libraries I used, like Tokio
.
A bit about the project
- I chose
Rocket
as a web framework. I just liked how its route handlers looked. Not sure I’m happy with it now, though. - I chose
SQLite
as a database. I’ll never do that again. It surprised me in both directions. It supports things I never thought it did, like full-text search with stemmers or JSON fields. But it turned out to be really poor at schema alterations. I also spent 5-10 hours figuring out how to run it on Linux with a custom stemmer (snowball
). Luckily, that’s all in the past, and now it just works. - I chose
SeaORM
as an ORM. Can’t say I struggled with it — it’s quite a good one. - I chose
markdown-it
as a markdown engine. It supports plugins, and I wrote a few. Pretty flexible. - I chose
syntect
to highlight code blocks. It was a tough journey to set it up properly with the set of languages I wanted. I’ve ended up with a separate build step that bundles it separately from the app. - I chose vanilla JS for client code. Why? Because it was more than enough. Blogs like this one are pretty simple in terms of frontend. So far, all JS lines are inlined into HTML via
<script/>
tags. - I chose plain CSS. Yep, no SCSS/SASS/Stylus. Just wanted to try it out. Modern CSS supports nested rules (the most desired feature), variables, and math. What else do we need, folks? I think that’s enough.
Some numbers
- The whole solution is about
4,000
lines of Rust. - I spent about two months working on it periodically in my free time.
- The main page, after compression, weighs only
35 KiB
. That includes everything — HTML, styles, scripts, images, etc. - The Linux binary is about
25 MiB
.
Design
No, it’s not a third-party template. I made it by myself. I even built some of the SVGs by hand. E.g., the glider in the top-left corner is self-made. The clouds and birds… nope. Too complex for me, heh.
Big thanks to my wife and my friend Sergey for their reviews and ideas.