Contact Us

Sitecore XM Cloud provides an excellent platform for developers to create and deploy web applications. To ensure a seamless development process, it is crucial to adopt best practices and select the right repository structure.

This blog post discusses the advantages of monorepos, key factors to consider while choosing a repository structure, best practices for deploying code and publishing sites in Sitecore XM Cloud, serialization considerations, and component design principles.

 

Monorepos in Sitecore XM Cloud

A monorepo in Sitecore consolidates all projects, code, configurations, and components promoting code reusability, and streamlined development for Sitecore implementations. Monorepos offer advantages for Sitecore XM Cloud development such as:

  • Easier version compatibility and scalability.
  • More accurate representation of an XM Cloud environment, as Sitecore isn't multi-tenant.

 

While monorepos have their benefits, there's no one-size-fits-all approach. Your decision should be based on factors like team structure, development workflow, and dependencies management. Additionally, consider the following tips from experienced developers:

  • Maintain a single codebase and deploy often.
  • Use feature toggles to prevent premature code releases.
  • Evaluate separate repos for multiple ‘heads’ or frontends if different teams are working independently.

 

Monorepo Considerations

Some factors to consider when choosing a monorepo include:

  • Managing Dependencies: Monorepos are beneficial when multiple projects have dependencies across each other.
  • Dev Workflow: Monorepos don't limit developers' tool choices, allowing them to work with their preferred tools.
  • Team Structure: Separate repos may be more beneficial if front end and backend devs are part of different teams.
  • CI/CD: Weigh the overhead of setting up multiple CI/CD pipelines against the value of having separate processes and schedules.
  • Debugging and Testing: Monorepos make debugging and testing bug fixes easier across projects.

 

Serialization Considerations

When working with Sitecore XM Cloud, it is essential to consider the serialization of components. As you divide your projects into separate codebases, determine where the serialized items should be stored. This decision will impact how your frontend and backend teams collaborate and how your Sitecore instances interact with the serialized components.

 

Component Design Principles

When designing components in Sitecore XM Cloud, consider the following best practices:

  • Ensure Independence: Create components that are modular, interchangeable, and independent so that Content Authors can move them around on a page freely.
  • Align Naming Conventions: Use consistent naming conventions that parallel Sitecore's structure, making it easier to locate components in both Sitecore and the codebase.
  • Granular JavaScript Components: Frontend developers can create as many JavaScript components in the code as needed, but only export components intendd for use by Content Authors.
  • Avoid Imposing Helix on Front-end Projects: While Helix is beneficial for .NET Core projects, it is less useful for frontend projects built with JavaScript frameworks. Focus on following project structure best practices provided by frontend framework authors.

 

Deployment and Publishing Best Practices

When deploying code or publishing sites, keep the following tips in mind:

  • Publish Larger Batches: Publishing larger batches of items is more efficient due to the time spent connecting to Edge.
  • Be Patient with Content Updates: There may be a short delay between the completion of the publication and content updates being displayed on the site.
  • Use XM Cloud Deploy App: Utilize XM Cloud's GitOps functionality to save time and receive automatic updates. However, consider using your own CI/CD pipelines in specific scenarios, such as non-GitHub source control, leveraging existing setups, deploying complex or multi-site setups, or managing numerous environments.
  • Git Workflow: Embrace continuous deployments instead of the old Git flow model, ensuring every commit is instantly deployed, tested, and can be promoted through environments using XM Cloud deploy app.

 

Conclusion

Selecting the appropriate repository structure and adhering to best practices during Sitecore XM Cloud development is crucial for project success. While monorepos provide substantial advantages, it is essential to assess your team's unique needs and workflows. Moreover, follow the best practices for deploying code, publishing sites, serialization, and component design to ensure a smooth development and release process.

By implementing these guidelines, your Sitecore XM Cloud projects will be well-positioned for success. Reach out to us and our team of certified Sitecore experts will help you with your specific business requirements.

Need Help?

Publications
& Thought Leadership

Workshop
Sitecore XM Cloud
Create unforgettable customer experience with lightning-fast Sitecore XM Cloud by simplifying content authoring and improving businesses performance.
customer experience with Sitecore solutions
Infographic
The 5-Step Strategy to Sitecore XM Cloud Migration
Are you considering moving to Sitecore XM Cloud but not sure about the planning it requires? This infographic reveals what your strategy should look like for a smooth transition to the SaaS CMS.
1-Cover Image Thumbnail 640 x 319px (5)
Publication
The Tech Stack that goes well with Sitecore XM Cloud
With XM Cloud, Sitecore has made sure that customer experience requirements are now hassle-free. It has enabled organizations to narrow down their efforts on providing stellar digital experience.
02 What is a SmartShop_Cover Thumbnail