This is headless 2.0
That’s a bold title, but it’s high time to change how we work with headless technology. I wrote about the MACH monolith before. Here, I’ll describe how to avoid ending up in a codebase full of technical debt, aka glue code—chores that overburden and frustrate developers.
The why
Headless technology has gained prominence in web development, offering benefits like higher performance, front-end freedom, DX features, and management through APIs—a thrill for techies. However, at scale, complexities arise due to an endless need for glue code for connecting content sources, let alone authoring issues caused by disconnects between content editors and front-end presentation.
In particular, separation of content authoring and presentation results in a steep learning curve for content editors, who would need help to preview their work and ensure a correct display. But how do you preview content that connects to multiple sources, all offering some form of preview capability? As a fix, people do either of the following:
For web projects to succeed, since developers, marketers, and content editors boast different strengths, teams must be able to collaborate harmoniously and seamlessly. For all that headless promises freedom and excellent developer experience, it pushes the pain threshold of marketers.
The how
Two things are paramount as a fix:
In other words, content editors need a page-composition process similar in concept to that of GraphQL, i.e., one that returns only the needed properties and content of all page components. All the editors need to do is add the component props with data from external sources—with no need to know the data’s origin. The result is curated, page-specific JSON output that can be consumed by the front end, which need not connect to external data sources.
What emerges is a transparent and simple platform on which to compose pages based on design components, whose props point to a field in an external API endpoint. That platform would not be a CMS or data-federation tool. All it needs to know is which component points to which data source for a specific page composition.
领英推荐
A visual workspace
Therefore, the job of the platform, which represents all the design components with linked data sources (CMS, PIM, DAM), is to connect them and store the result like a curated GraphQL query on a CDN edge. The only data this platform would potentially store are one-off content strings like “latest blog posts” or the fact that a particular component variant, e.g., the image on the left or right, is shown in a specific context.
That setup gives rise to a streamlined workflow:
To make it all visual for content editors, match the naming of the design-system components in the codebase to the ones in the platform and have the SDK show the components in a preview window. Simultaneously, content editors can bind data from external sources to the props and design how the components should look and behave.
With solid cache purging for data sources, you can create dynamic pages that connect to any amount of data and deliver in less than 50ms from a CDN edge near you. In case of external data-source changes, the TTL on the field or a webhook purges the cache, resulting in fresh data.?
If used in conjunction with the latest Next, NuxtJS, or Astro features, this approach leads to a robust yet no-frills front end with no need to connect to data sources in code or mapping their data to component props. Talk about happy developers!
A recap
Connecting everything code-first at scale is painful for developers and content editors alike, the former having to maintain the connections and content mappings, and the latter getting lost in the abstract tools with no clues of what happens on a click to publish.
A composable architecture of headless sources must be a team buy, not just a developer choice. What’s needed is a visual workspace that’s—
In other words, we need a modern, composable form of the old-school DXPs like Adobe AEM. I believe what I described above resembles digital experience composition as coined by Gartner.
This is Headless 2.0
Co-founder Lab Digital
1 年What do you think about the content source maps specification, which was recently introduced by Sanity & Vercel, for providing front-end editing capabilities? https://github.com/sanity-io/content-source-maps
Precomposable is the new composable
1 年This actually describes very closely what commercetools Frontend is doing :)
Global VP @ Uniform | #ecosystem #growth #APIs #integrations #partnerships
1 年In everyone’s defense… headless 1.0 often required trade offs. 1. Code complexity: glue code in a BFF. Hard to maintain at enterprise scale, but one website with few connections and this is okay. 2. Query complexity: some BFF + GraphQL with caching to mitigate GraphQL performance issues. ^ I’m still not in favour of this approach as it deepens dependency on specialist devs that know how to construct graph queries, then store them in the BFF to bind props. ^ Maybe Matthew Gargano can change my mind! 3. XDP/DXO/SVA(single-vendor-acronyms): disconnected from channels so they still require a tonne of glue code to bind payload to view. Then repeat across channels. ^ Solves query complexity but I’m not convinced this meets customer needs yet. 4. Content model complexity: a content type per component avoids some glue code challenges, but pushes the pain to content Ops. Lots of copy paste, low component reuse, low content reuse. ^ watch out for blocks, slices, etc… 5. DXC: not all DXCs remove the need for glue code. Some of the prominent ones require more glue code and are fully dependent on content type per component… so you have both glue code AND copy paste/low content reuse. Uniform for the win! Mitigates all of the above.
Builder of Brands in Tech
1 年Point taken in the ‘doing it wrong’ examples, yet headless should also be versionless ;)
Co CEO@Amplience | AI | Composable & MACH
1 年We are starting to see more Monolithic architecture thinking as businesses are looking at platform replacements with all the dependencies what that entails. Then as you say the frontend store front ends up being the nexus of integration with lots of hardwiring. It feels like the mach composable monolith half the time.