Site Logo

5 years of

In my final year of high school I was reading a lot of blogs by college students. Articles like, "23 things I wish I knew freshman year", or "87 true facts about college, you won't believe number 6". There was one piece of advice that really stuck with me: have a website. By that time I already had a web presence on various forums, IRC channels, and I think a few web pages somewhere, but nothing concrete or worth sharing. But now I was inspired. I was going to make a website for myself that could act as a portfolio, a blog, whatever I wanted!

More importantly: I had an excuse to learn node.js.

Why node.js? I'm not entirely sure, since that was five years ago. I was spending a lot of my free time learning new programming languages for fun, and maybe server-side JavaScript was just another one to add to the list. Plus, I could reuse the same code between the client and the server side! (spoiler alert: that never actually happened.)

The earliest iterations of "home-jebrosen" were hosted on OpenShift, and it used the express.js web framework. I used the lightweight database nedb for storage, because at the time I didn't want the complexity of a "real" database. 2014 was a wild year for that project. I vaguely remember cycling between several async libraries and syntaxes, including DIY callback stacks and the async library, all the while using express.js. A notable architectural feature of this version was the use of AJAX to switch between pages. At the end of it all, my 4-page website was a SPA CMS implemented in JavaScript. I could have accomplished the same with 4 HTML pages in Notepad, but of course that wouldn't have been nearly as fun.

I used my website backend as my playground for learning new JS frameworks, libraries, and syntaxes. Over the course of another year or two, I went through early versions of koa and its coroutine/generator style, promises, arrow functions, async/await, and sometimes transpiled with babel or used experimental versions of node.js. I dropped the dynamic functionality and stuck with server-side rendering with the Jade template engine (now known as Pug.

Another notable change I made around that time was the switch to SQLite. We wanted to try SQLite for a project at school, and it was the perfect excuse to rewrite some core functionality of my website for the umpteenth time! I am very happy with SQLite overall and will probably always reach for it first for small projects.

The other, much larger, change to my website also happened in college: Rust. Rust looked like the programming language I had been searching for for years: something low-level and performant like C and C++ but without so many footguns. I loved C for its simplicity, but it is too unsafe for my tastes. C++ solves some of the most annoying things about writing C code—especially with RAII and templates—but it introduces some complexity and downright awkwardness that I was unhappy with. As a minor example, I have read several explanations of rvalue references and never felt like I actually understand them. The situation is the same with variadic templates and SFINAE, and it was frustrating to peek into standard library implementations and see all of these things combined all the time.

Rust claimed to be a kind of goldilocks language ("fast, reliable, productive - pick three"). The syntax looked close enough to C++ for me to pick it up fairly quickly. And it felt like a good time to learn another programming language that was more my style (sorry, Perl, that side-eye is directed at you). After reading through the Rust Book and some other guides, I needed a real project to experience the language. So I just rewrote my entire website in Rust.

I started with the iron web framework, which seemed like a solid choice at the time. I used horrorshow templates, which have a syntax similar to Pug in the ways I cared about but unlike Pug were checked for validity at project compile time. Over the course of a month I rewrote everything, including the site, the blog, and the administration backend. I named the new project sirus: SImple RUst Site. A few months later, the iron project announced that it was going to be unmaintained, and I started looking elsewhere.

Somehow I settled on Rocket, which introduced me to nightly rust and comparatively heavy amounts of code generation. I really liked Rocket's approach to route definitions, especially with request and data guards. For brevity I will not tell the story here, but I am now one of Rocket's maintainers: I help answer support questions for the project, and for the past year or so I have been working on a migration to Rust's new async/await functionality.

Rocket is here to stay as part of my website for a while; it eliminates certain pain points that I would likely struggle with again if I were to switch, and I have no good reason to use anything else now. That's not to say that development has remained stagnant! I have still carried on my tradition of rewriting something every few months - I have gone through the tera, askama, and maud template engines. I also went to sqilte-with-diesel, to postgres-or-sqlite-with-diesel, to postgres-without-diesel. (The switch to postgres was motivated by using postgres for other things on my server anyway, and having everything in one system makes backups easier to deal with. I would probably still be using sqlite otherwise.)

So what's next? The math says I am overdue to switch template engines again, but that's pretty low on my priority list right now. I have been spending the bulk of my work-unrelated programming on making Rocket async, and it will be nice to work on some of my other projects too. If I get an itch to try something new, it could end up in my website in one form or another. Or not. After 5 years, maybe it is finally time to stop rewriting the world.

Created 2019-11-02. Updated 2019-11-02.