About

When we initially created Webiny we started by building every app as a separate module with its own backend system. This included the Page Builder, Form Builder and File Manager. Eventually we created our own Headless CMS.

Over time, we tried using Headless CMS as a backend for our new applications, like the Advanced Publishing Workflow and the Advanced Content Organization.

This had proven to be very beneficial as it mean we drastically reduced the backend code, potential for bugs, and lowered the effort required to maintain those applications. One other very important benefit we also gained with this approach was that the API was way more powerful and it was easy to extend it, which was important to users that wanted to add and store additional attributes and build new features on top of those existing applications.

Our goal is to now move all existing applications to use the Headless CMS to use it as the backend. We have already refactored and moved the File Manager app, and the next one we want to tackle is the Form Builder.

Approach

The high-level approach is as follows:

How to think about the implementation

Imagine you’re a 3rd party developer, and you’re using Headless CMS as your data store, via GraphQL API. Think of how you would implement the content model for the Form, and Form Submissions. Then simply transfer that into the code models.

On the topic of revisions

Revisions in the Form Builder map nicely onto revisions in the Headless CMS. There’s one problem though: Form Builder is the only app that allows multiple revisions to be published at the same time. The trick here will be to have a published: Boolean field on your Form content model and update that field accordingly. Then you can query published revisions using that field. Publishing of HCMS records will never really be happening; you will always be using draft revisions in the Headless CMS itself.