Can I write a CMS in two hours?
Martijn Luinstra 10 Feb 2021
Short answer: No.
Long answer: No, but maybe next time?
Please allow me to elaborate. I was given the assignment to set up a blog for a course I’m attending, with one important constraint – take no longer than 2 hours to pick and personalise a CMS (Content Management System, the platform the blog is published on). For about five years or so, I’ve been toying with the idea to start a blog and build a very basic CMS for it as a web-development exercise. Just the will to publish some thoughts wasn’t enough to actually execute this plan, it turns out. So when I got tasked to setup a blog, I couldn’t resist the temptation. After all, my web-development skills have vastly developed since I first considered to start this project years ago. It would be tight, but it didn’t seem unreasonable to think I could do it in two hours.
A former co-worker of mine once told me to always multiply time estimations for programming tasks by π. Once again, they were right. Or so I think. I stopped tracking time when it became clear that two hours was not going to work and I rebranded the endeavour as a “weekend project.” For all intents and purposes, I could have written the code half a decade ago and just have refreshed the design to fit this assignment in an hour or so. That would have worked. The design part of this process was done well within the time budget – made easy by the minimalist style I went with, but that was not intended as a time-saving measure. I think I even have enough time left over, multiplication by π included, to implement a comment system.
The CMS is a simple Markdown based system written in PHP. I didn’t need any fancy user interface, since I speak computer and I generally prefer writing Markdown in my text editor of choice over using whatever rich-text editor the platform provides. Functionally, this CMS is not too dissimilar to a non-static version of Jekyll. It finds Markdown files on the file system and renders their contents using a simple PHP framework I built a couple of years ago in a similar learning experience turned weekend project episode. The basis for this system was indeed easy and within half an hour I had a system that would render Markdown files as I intended.
So, what took me so long?
Well, I wanted to make things fancy. I decided I needed to have pretty URL’s that only loosely correspond to paths on the file system, I needed the ability to host media along side the blog posts and I wanted to customise the Markdown rendering. Eventually I ended up learning new things about NGINX, switched to a completely different markdown renderer, rewrote parts of the code more than once and completely over engineered the thing. Next time, it’ll be a lot easier and I may actually be able to do it in two hours. But then again, I could just recycle this project.
All things considered I still think it was worth it, but a simple WordPress install or something similar would have done the trick. If you want to start a blog, you’d be better off doing exactly that if you want a self-hosted option. If you don’t need something self-hosted, just go for any (popular) publishing platform you like. But if you want to learn new skills and are in need of a weekend project (or something more intense), by all means build your own!
To my teacher: please forgive me for blowing the time budget on this. I promise won’t do it again. But I sure hope you won’t tempt me by giving me another assignment I’ve already considered myself for years…
P.S. I haven’t open-sourced my implementation (yet), but hit me up if you want to have a look!