Why did I write a CMS in 2021
To build a CMS must be the least fashionable thing in tech this year. Probably even less than using MongoDB (no offense). And still, I found myself writing one.
Because of the same, old reasons that have inspired thousands before me in the ancient tradition of reinventing the wheel:
- I didn’t like anything out there.
- This way it was more fun.
No doubt about the second, but why didn’t I like any of the many existing content management systems out there? Let’s see:
As of today, if you want to publish your own content you have basically four options:
- Closed platforms like Medium. I love Medium and I truly enjoy publishing content here. The editor is great and the only template is simple and beautiful. My main problem with Medium is that (for now) you can’t use your own domain nor your own identity, so I always feel like I’m building someone else’s audience. On the other hand, they allow you to borrow theirs, which is great (and that’s why you’re reading this here!), but it’s not really an option if you need to customize your audience’s experience.
- If that’s your case you can use an open platform, like Wordpress.com or Blogger. I’d say this should be the best solution for most people. However, I don’t really like the options you’re given to customize your site: plugins and templates are usually huge and too complex, and I’m too lazy to learn another templating API or try to find a theme that is close enough to my idea. But as I said, this should be the way to go as long as you don’t need complete control and you’re comfortable dealing with templates and plugins.
- If you need more control the natural option would be self-hosted, traditional CMS software like Wordpress. You can use a managed server or set up your own and do decently well. Problems: if you use a managed server you’ll always be a bit behind (and you’ll never have actual full control, which kind of defeats the whole purpose); and if you set up your own thing, you’ll end up owning a web server server that will eventually become outdated and then hacked.
- If you need full control but you don’t want to deal with all the problems I’ve described so far you can also try a Jamstack-type site generators like Gatsby or Jekyll. I tend to agree with the philosophy behind them but I’ve managed a few web applications written with them and they all ended up becoming really messy. The deployment process is always complex and becomes unreliable after a few Node versions. Also, you need to set up an environment if you want to make changes, so there’s always some pain involved. You can’t just publish a change from a random laptop without installing dependencies.
It looks to me like at some point, the paradigm began to shift from having an easy way of updating content at the cost of having something expensive to run (traditional database-oriented CMS platforms like Wordpress), to something cheaper to run at the cost of a more complex publishing system, often involving some sort of code generation or compilation (site generators like Gatsby).
Was there a way of getting the best of these two worlds?
What I wanted
- Serverless. I wanted it to run for free when there’s no traffic (99% of the time) and didn’t want to worry about securing a web server.
- Secure by design. No admin area, no plugins, nothing that could be easily exploited.
- Fully containerized development environment. I recently bought a new laptop and this time I’m not allowing myself to install a single tool or library apart from Docker, not even Node or NPM. I’m not dealing with this anymore.
- Simple publishing system. I should be able to publish content from any random laptop or an iPad.
- Database-free. I wanted FILES. Old, boring, HTML files sitting in a folder.
I believe this is a good compromise between the traditional database-oriented CMS platforms and site generators.
Yes, it might well have the disadvantages of both worlds too. I guess we’ll never know.
How it works
All content is organized in pages (named posts). SiestaCMS has only two routes: one to list all the posts, and another to get one post.
Posts are just XML files sitting either in a regular folder or a S3 bucket, depending on the configuration. When listing all the pages, SiestaCMS just reads all the files in the folder or the bucket. The file name will act as a primary identifier and to generate the links. No database, no plugins, no templates, nothing.
Some skills are needed if you want to use it, but you only need to know how Serverless framework works. For some users it might be harder to use than a regular Wordpress installation, but I’m sure some weird people will find it pretty cool and even enjoyable.
And that’s pretty much it! Hope you’ll enjoy it as much as I did!
- The SiestaCMS project website: siestacms.com
- The source code: github.com/nosolopau/siestacms
- And an article I wrote describing the heroic setup: How to get a Serverless web app working with your own domain and SSL on AWS, the right way.