Tuesday, January 29, 2019

What I want from a CMS

Okay, I know I'm probably asking a lot, but this is my list of "want"s for a CMS.

Online Editing

Yup, I want a way to edit the site through a simple web interface. I know a lot of CMS' have this, and this would seem to be the easiest thing to get, but just bear with me.

Static File storage

I'd love for the system to be as fast and lightweight as possible. To the point that there's no need for processing when serving the site. So render it to flat files in the backend, and serve it using something simple and quick like nginx, or a simple CDN. And the static file system can be on a separate host to the admin area, for more security and less processor usage. Plenty of those "headless" systems, right?

Simple, included templating

I would really love it if this system had freely usable templates ready and built out of the box. No need to build your own site around some provided API. Set it and go, with the option for simple customizability later.

Modular design

Want to add functionality? Can do! A nice API lets you drop in modules.

eCommerce

Hey, guess what? I want it all, and that means I want eCommerce capability too. And this leads to the real problem - How do you make a storefront with only flat files?

So here's how I see it working.

The site is all flat, static files, but the optional eCommerce section runs off a tiny active shim (using something lightweight like node.js, Ruby/Rails, Go or python), loaded through JavaScript (or other means, detailed below).

When you initially visit the site, when all the static pages are loaded, one of the items loaded is a lazy-loaded script/JSON call to the eCommerce shim, establishing a session and generating an empty basket for you (or this step could be skipped entirely, with the server-side basket only being created when an item is put into it). This is then stored on the client (cookies, localstorage, webworkers, something similar). Every time you modify your basket, the eCommerce shim is updated to add/remove/alter the contents, ensuring the two are always in-sync (and verifying the details of the client-stored basket, to stop people giving themselves a discount). When the time comes for checkout, the pages are generated for the process by the shim, taking you through the necessary steps until the transaction is complete.

If the user has JavaScript disabled, the "contents of your basket" header section are instead rendered as simple HTML in an iframe from the shim, with the management being done through simple links to the shim (which then redirect to the static page required after the processing is done), and things like the basket display and editing being rendered through iframes.

Why do it this way?

It would make the site a lot simpler, and faster. Database hits would be next to none, as the vast majority of the site is static, so it could be hosted from anywhere, even a simple replicated CDN. The admin system could be hosted on a local network/intranet for security, and wouldn't have to be hosted anywhere near the main site, pushing updates to the CDN as necessary. The eCommerce shim would be lightweight, only called upon when it was needed, and allowing for simple scaling out if demand is particularly high. The system is client agnostic, working equally well on desktop and mobile, with fallbacks for situations where functionality is unsupported, including the capability of disabling completely.

It also means the site is dirt cheap to host, with a basic CDN taking most of the workload. CPU load is low, as content is static, and the static host is as framework agnostic as can be (as it doesn't require any framework, just the capability to serve static HTML). Compressibility is high, and everything can be cached without issue. The shim can be hosted in a simple system agnostic container (and automatically scaled both up to multiple containers, and back down again, as load dictates).

So what are the options?

Right now, as I see it, there are none that work this way. There are a lot of full-fat CMS'  (Wordpress/Joomla/Drupal) that try to host everything inside, making server load heavy. There are some lighter CMS' more meant for blogging (Ghost) that don't even try to touch the eCommerce side. Finally there are "Headless" CMS' that provide an admin interface (sometimes) and an API for you to write into your own site. And right now, none of these are anywhere near what I want. And unfortunately I think that means I might have to write my own. I'd really rather not, and if anyone has already invented this particular wheel (or has a good starting point for me to work from), I'd love to hear about it.