How I regained my Sanity
Published: December 21st, 2019. Updated: January 26th, 2020
Finding a good CMS is not that difficult, but finding one that fits all your use cases is a tougher cookie. In my case I've tried multiple CMS platforms, from WordPress to Netlify CMS (using Markdown and Git as the source) to purely headless CMS platforms like Prismic.
If your only use case is to run a simple blog with a single contributor almost anything goes as that use case has been covered many times over. You might not even need a CMS at all if you are a developer and don't mind creating all your posts from within the editor. There are multiple Gatsby starters that use Markdown files as the source, all you need to do is push to the git repo and Netlify will take care of the rest.
But lets face it, you're probably not getting rich from your Markdown powered blog. You probably have clients, and most of those clients are terrified of the colourful, text-based interfaces we spend most of our days staring at. On top of that, their needs are probably more advanced than a simple blog. These days clients expect to be able to edit content on any page, add or remove sections depending on season and events and publish or unpublish whole pages multiple times a year. They don't expect to have to pay extra for this to be done, it's something they should be able to handle on their own.
That's why WordPress became so popular, it was a free to use CMS which allowed content creators access to the site. The problem with WordPress is that it does too much. It's not just a CMS, it's also a site server, it has to be kept up to date to plug security issues and the multitude of plugins that are available often cause more harm than the problems they solve.
In recent years, with the rise of JAMstack architecture, a new type of CMS has made its way onto the scene: the headless CMS. It's a type of CMS that doesn't have a frontend, meaning it focuses solely on what it's supposed to do: manage content, nothing else. The rest is up to you as a developer. Some of these require servers to run, while others have opted for a serverless approach. There are usually generous free tiers intended for developers and small sites to get hooked and then step up their plan as they expand. There are many services like these, my most recent experience was with Prismic.
Prismic has a neat setup to also allow content creators to edit and create new pages, without needing to worry about the design aspect. As long as the types are defined (and hopefully not touched without ensuring they are handled in the code) content creators can focus on their tasks. This keeps the clients happy. Prismic's main killer feature is Slices; a way to add repeatable content sections to any page, with repeatable content within those sections. It makes the platform incredibly flexible while still staying relatively easy to use.
However, you will soon find clients with more complicated use cases, like e-commerce sites which also require an integration to their product catalogue. There is an upcoming integration in Prismic for Shopify which allow content creators to reference products in the content they create. This feature looked very promising to us when we decided to go headless. However, we quickly ran into some limitations with the integration. Content creators are only ever able to select individual products, they can't select a whole collection to highlight, or the most recent products. This requires some ugly work-arounds which degrades the user experience for content creators. Another weird thing about Prismic is that their GraphQL API breaks the norm and uses GET requests instead of POST, which means extra setup work to connect an Apollo client to their API.
Then one day as I listened to Syntax, I heard about Sanity.io, the sponsor of that episode (apologies to Scott and Wes that I forgot to use their link to sign up to Sanity). It sounded interesting, but I was far too busy working on other solutions at the time to give it a try. However, as time went on I heard more about Sanity on other podcasts and the more I heard the more intrigued I was.
Finally after raising some of my issues with Prismic and receiving the response that these features were not something they planned to introduce anytime soon, I realised we'll need to switch to something that can meet our clients' use cases. So I decided to finally take a look at Sanity.
Sanity is a highly customisable CMS where you define the schemas in code which also makes it really easy to reuse from one project to the next. Prismic also allow for schema definitions in JSON, however, you will need to copy paste them into the interface for each new type you create. In Sanity you define them once, store them in git and just clone a base template when you start a new project.
You can run Sanity's editor interface – Sanity Studio – locally. It saves your edits to their servers in the cloud and even allows for previews during development. The interface can even be branded to make your clients feel more at home and less like they are in yet another third party interface. A huge plus in today's servless architecture that often ties multiple services together to create the best possible product for clients.
It's still very early days for Sanity.io and I, but I feel like it may be the key for me to regain my sanity in this headless world.