EnglishFrançais

Headless Java CMS: In depth guide for developers

Headless CMSCMS

Romain Gauthier

Introduction

Headless CMSs have gained in popularity over the last 7 years; however, many are pure SAAS products that can’t be extended nor heavily customized; the others are based on node.js. Consequently, organizations using Java as their main backend language are left without any obvious solution. In this article, you’ll read about the key features of a good headless Java CMS. And, of course, how does Jahia match these criteria. 

Modularity with OSGi

The most important attribute of a Java CMS, headless or not, is its modularity. Modularity is what enables Java developers to customize and extend the CMS. In the Java world, there is only one technology that supports modularity properly: OSGi. 

Let’s review the main requirements of good modularity, nicely covered in OSGi:

Content modeling

One of the differences between a CMS and a regular application is the agility required to manage the data model, referred to as content modeling or content types. There are typically 2 approaches to this requirement: 

  1. CMS that provides a UI to build content types. This approach allows one to learn content modeling quickly.
  2. CMS that allows content types to be deployed as code, making sure that the content types are versioned at the same time as the rest of your code. 

Jahia is the 2nd kind, providing many options for content modeling. You can learn more on our developer experience page.

API Extension

Once you have a way to deploy Java code - thanks to good modularity - the most usual requirement for a headless Java CMS would be to create custom API endpoints. 

Jahia mostly uses GraphQL, and you can extend existing endpoints or create new ones. The capability applies to queries, mutations, and subscriptions. If you want to have a look at what a GraphQL extension looks like, a sample is available in our GraphQL Github repository.

Other integration patterns

Besides customizing APIs, a good headless Java CMS will also support other integration patterns, such as:

If you want to see what it looks like in Jahia, there is a dedicated repository: OSGi modules samples

Open source / open core

Being able to access the source code of a product that you want to extend or customize is often very valuable. It makes debugging easier and the relationship with the vendor more straightforward. 

Most of Jahia’s code is open source, and our entire codebase is accessible to our customers. 

Authoring experience

You should not forget that a good headless Java CMS needs to be a good CMS. So don’t forget to check the features for the business users you’re working with. For more information, read the article Headless CMS - Which features for Marketers?.

Presentation layer / The head

If you’re reading this post and looking for a headless CMS, you might not agree with all the lines below.. and that’s ok. At Jahia, we believe a presentation layer (generating HTML from content items) is always convenient and often essential. The capability to render full HTML Pages or HTML fragments provides much more flexibility than a CMS that can only output JSON. 

Jahia provides 2 presentation (aka templating) technologies: 

Complementary components 

A CMS alone is sometimes not enough. If your project involves working with customer data, especially with high write frequency, you should never store that data in a CMS. Managing content and managing customer data requires different kinds of architecture. In other words, the best complement to a good CMS is a good CDP (Customer Data Platform). 

Jahia is contributing heavily to the Apache Unomi project. Our customers use it to store and manage form data, user-generated content, behavioral data, visitor preferences, etc.

Conclusion

In short, a good Headless Java CMS needs to:

If you want to know more, you can: