DEV Community

Cover image for Headless GraphQL CMS
stereobooster
stereobooster

Posted on

Headless GraphQL CMS

What I'm looking for?

CMS - admin section of a website to edit the content (CRUD operations). This task was solved so many times, I don't want to do it again, I want to use something existing, something that works out of the box.

Headless CMS - means that CMS doesn't provide frontend section of the website it only provides the backend for editing. For example, Wordpress is not headless by default, it generates also the website.

GraphQL has many aspects, but I'm interested in it as API specification. It is possible to generate type signatures from GraphQL specification or generate validators (like io-ts) so it creates "end-to-end type checking" experience. From this point of view, OpenAPI as specification would also work.

Open source - I would like to be able to deploy it myself, for example, to use it in intranet application.

Relational database support - I would like to be able to backup my content or use it in a different application. A relational database is a well-understood abstraction. It is easy to backup, replicate, inspect with SQL client, visualize with superset, build ER diagram for it. For example, ponzu (awesome project) but it uses its own internal database, which stops me from using it.

S3 for assets (optional) - it would be nice if CMS could upload assets to S3 bucket (or similar service) so I wouldn't need to worry about storing files, backups, and migration.

Not a priority for me (but maybe a priority for others):

Access control - I don't need granular permissions.

High load support or rate limiting - API will be used to generate static website so I don't care about the high load.

Mutations - I don't need to write or modify data through API.

Options

CMS which were built with this use case in mind and provide all feature out of the box, for example, strapi, prime, etc.

Headless CMS without GraphQL + some proxy to convert API to GraphQL, for example, Ghost + Gatsby's Ghost plugin.

Headless CMS without GraphQL + Postgraphile or Hasura.

Framework to generate headless CMS + Postgraphile or Hasura, for example, Rails frameworks.

What I found

I did a small research and found some options but will be grateful for additional hints. I used docker-compose for my experiments. All intermediate results documented in the repo.

Strapi

Website: https://strapi.io/
Technology: ECMAScript, MongoDB or MySQL or MariaDB or PostgreSQL

One which actually works (I had problems starting some other projects). I had only one question: why does it need to restart after every change in schema or plugin installation, it feels they doing some hacks there.

Prime

Website: https://docs.primecms.app/
Technology: TypeScript, PostgreSQL

Looks cool, but I wasn't able to start it. The project is young - there is only one core maintainer. The author doing cool things, but documentation is still lagging behind and first-time user experience could be better.

Cockpit

Website: https://getcockpit.com/
Technology: PHP, ECMAScript, SQLite or MongoDB, Apache

It seems it is not actively maintained. I wasn't able to figure out how to install GraphQL plugin.

WordPress as headless CMS

Website: https://wordpress.org/
Technology: PHP, ECMAScript, MySQL

People from postlight have extended article about this option. I don't like this solution - WordPress wasn't built for this use case. It is possible to add 2-3 plugins to make it work, but it feels hackish and UX is clumsy.

Ghost as CMS

Website: https://ghost.org/
Technology: ECMAScript, MySQL

Doesn't provide GraphQL, but it is possible to use Gatsby development server as GraphQL proxy. Doesn't support the custom types of content.

Directus as CMS

Website: https://directus.io/
Technology: PHP, ECMAScript, Vue, MySQL

Doesn't provide GraphQL API.

Rails-based admin section

Technology: Ruby on Rails, relational database

There a lot of solutions for the automatic or semiautomatic generation of CMS for Rails, for example:

But not so good with GraphQL API generation (at least I don't know about it). So the trick is to use Rails for CMS and use something else for GraphQL API, for example, postgraphile.

Postgraphile (PostgreSQL-based API)

Website: https://www.graphile.org/postgraphile/

PostGraphile automatically detects tables, columns, indexes, relationships, views, types, functions, comments, and more — providing a GraphQL server that is highly intelligent about your data, and that automatically updates itself without restarting when you modify your database

Can be used together with any CMS which works with PostgreSQL. I also tried to use it with react-admin, but this attempt failed.

Tried to use CockroachDB instead of PostgreSQL, but no luck.

Hasura (PostgreSQL-based API)

Website: https://hasura.io/

Instant Real-time GraphQL on Postgres

Looks impressive. Has built-in CMS (I guess quite primitive, but this is better than nothing).

Can be used together with any CMS which works with PostgreSQL.

Help

What do I miss? Are there good CMSes with GraphQL or OpenAPI support that I'm not aware of? Are there good API providers for databases?

Photo by Mika on Unsplash

Top comments (10)

Collapse
 
kenzobenzo profile image
Makenna Smutz

Hey there! I think GraphCMS would be a great addition to this list as the most advanced graphql headless cms!

Let me know if you need any details :)

Collapse
 
notrab profile image
Jamie Barton

I agree. GraphCMS is awesome! Native mutations API too ❤️

Collapse
 
stereobooster profile image
stereobooster

Open source - I would like to be able to deploy it myself, for example, to use it in intranet application.

It seems doesn't fit the bill. Or I'm wrong about this?

Collapse
 
turnerj profile image
James Turner • Edited

SilverStripe seems to tick every box you've mentioned.

It is an open source CMS, it can be headless, it uses a relational database, assets can use S3 with an official module and GraphQL support is another official module away.

I worked as a web developer where for 7 years this was our CMS of choice. That said, we were using one version back of SilverStripe where some of these features (S3 support and GraphQL) were either not possible or readily used.

Collapse
 
stereobooster profile image
stereobooster

Thanks. I will check it

Collapse
 
stereobooster profile image
stereobooster

I'm waiting for this one github.com/directus/api/pull/1005

Collapse
 
golangch profile image
Stefan Wuthrich

I found and posted this new project, #golang based.
twitter.com/golangch/status/111509...

but it's RESTful API, not GraphQL

Collapse
 
stereobooster profile image
stereobooster

REST would work too if they provide "contract", like OpenAPI

Collapse
 
ronaldaug profile image
ronaldaug

Have you checked prime cms?
It's open source, GraphQL and Relational DB. (But still beta)

Collapse
 
stereobooster profile image
stereobooster

Yes I did ("What I found" section, second item)