Restructuring the Sitecore XM Cloud Foundation Head

Friday, September 20, 2024

Restructuring the Sitecore XM Cloud Foundation Head: A Logical Approach to structuring code for Headless Sites

Anyone who watches the Sitecore XM Cloud Foundation head repositories would have seen this PR get approved on the dev repo recently. This has implemented a significant restructuring, aimed at providing a more logical and streamlined approach to building sites with XM Cloud. This update brings several key changes and benefits for developers.

We’ve been talking about these changes for a while now, Liz Nelson discussed these changes in detail at SUGCON EU and SUGCON India. For those interested in a deeper dive, you can watch the recording of her presentation at SUGCON EU below

Let’s take a look at what we've changed and why…

Favouring FED-First development

The changes made to the repo are designed to drive a shift towards FED-First development. This is when the developer just runs the “head” application locally, pulling data directly from XM Cloud, instead of mocking some of the services locally using Docker. This switch makes it much simpler for new developers to get up and running with Sitecore XM Cloud and improves the speed of development cycles for developers building day-to-day.

Avoiding Customizations on the CM Instance

This switch makes more sense from a customization standpoint as well. This new structure is better aligned with the recommendation to avoid customizations on the Content Management (CM) instance where possible and push changes externally - either down to the head or to an Integration Platform as a Service (iPaaS) provider like Sitecore Connect. Mocking a bunch of application Instances like SQL and the CM locally, when we’re moving customisations away from them, adds a bunch of unnecessary overhead and restrictions to the developer machine e.g. forcing developers to use Windows machines to support Windows based containers.

Does this mean Docker is Dead?

A common question we’ve heard with this approach is whether Docker is now dead? The answer is NO! Docker remains a perfectly valid development approach, we’re just changing the default development approach. If you have a well-established development flow using Docker, feel free to stick with it. The restructuring simply changes the default approach, but Docker continues to be a great tool for many development teams who are skilled in it, and are already using it day-to-day.

Should existing projects update?

Another question we’ve heard is whether customers with existing projects built on the previous structure should update to match to the new one? To me, this is a matter of personal preference and not a requirement. The Starter Kits are template repositories, so when you start a project from one, you don’t have an upstream link to the original repository by default. However, if you like to pull in changes from the starter kit into your repository as they are updated to keep yours in sync, the process will be simpler if you migrate to the new structure.

Guidance for Restructuring

For those are interested in restructuring their existing projects, there will be guidance available. I recently went through the process for the XMC Introduction Repo, and you can see the pull request here. Once the review is complete and it’s merged, I’ll release a follow-up blog post covering how we found the process and what was entailed.

The future…

This is one of the first of a few changes that you will see rolling out for the starter kits and the Getting Started process for XM Cloud in General. Anyone who has visited the Sitecore Documentation Site recently would have seen that we also published a new Getting Started Guide for XM Cloud that also aligns to the FED-First development approach.

Stay tuned for further developments in the coming weeks and months as we look to make developers lives easier when working with the Sitecore products!