The company I work for wants to move from their current cms (very expensive and developed and maintained by an external company) to a new one, possibly opensource or for a lower price.

My colleagues and I are looking at headless cms and the options on the table, for now, push us to 2 possible solutions: strapi and graphcms

They are both API first cms, so you create your models with the interface and they expose content through graphql

The problem we see here is that we find quite hard to apply business logic, for example, if an article before being published needs to be approved by some superuser or admin, or blocking a subset of the articles only to registered users

We are thinking of using one of these providers and set up our webserver in front of it that will handle business logic, and external users log in.

The problem with this setup is that we are adding one round trip to each request.

user <-> webserver <-> headless cms

User asks for content to the webserver, the webserver retrieves it from the headless scams and runs all sort of authorization/validation checks and in the case gives it back to the user

This also means that we will need to write all of ours graphql queries twice, one for the user exposed frontend and a second version for contacting the headless cms.

This also feels like we are going to use (whatever the cms we choose) as just a container and the value-added, in the end, possibly is just a friendly UI for writing articles/pages/whatsoever

Is our approach to headless cms wrong?

  • Have you considered a server side solution like Gatsby or next ? Nov 7 '19 at 17:23
  • They are the presentation layer. We were thinking of using nextjs/react for it, but it seems that with business logic in place an api first headless cms is not the right solution?
    – nicecatch
    Nov 7 '19 at 17:27
  • It will solve all your auth and deployment issues because it will all be fetched at build time and all that remains is to deploy a bunch of flat files(for gatsby at least). You just need some kind of auto deploy that triggers on changes in cms Nov 8 '19 at 5:22
  • How do I handle my business logic, that should be server side, with a static website generator like gatsby?
    – nicecatch
    Nov 8 '19 at 9:37
  • With Gatsby there is no serverside except a stupid webserver that serves files Nov 8 '19 at 13:58

I don't think Gatsby is the answer to your problems, it sounds like you might want to put an extra layer between your headless CMS and custom webserver that would handle all this extra logic like authorization and so on.

It's extra work but if you have a lot of auxiliary logic and don't want to just consume the CMS API which would be open to the public this is probably the way to go

Not the answer you're looking for? Browse other questions tagged or ask your own question.