Helixbase to Headless Helixbase

We are all excited about Sitecore 10 and the direction the platform is taking towards .Net Core and Headless. However the task of updating your existing solution to conform to the new headless approach, might seem overwhelming.

Sitecore 10 Headless is now split to into two project types, Platform and Rendering Host.

Platform

Platform is specific to Sitecore (CM), and only configurations and code directly related to either extending or configuring Sitecore should exist here.

Rendering

Rendering (Rendering Host) is specific to the Application and should contain all code and configurations required for the application to run.

Helix

Following Helix conventions you’ll now most likely need to have two projects (.csproj) per module. See Hero example below;

  • Helixbase.Feature.Hero.Platform – .Net Framework
  • Helixbase.Feature.Hero.Rendering – .Net Core

Making the Move to Headless (NetCore)

Updating an existing Helix MVC solution the new Headless approach is a time consuming task. I have written a Powershell script to take some of the pain away.
Simply run the script within a Helixbase solution from the ./tools directory and it will update your solution ready for Headless development.

Before Running

  1. Update the variable in the script $solutionName to match you solution name, if its not equal to Helixbase.
  2. Close the solution
  3. Execute Powershell script with elevated privileges (Admin)

The script will perform the following tasks:

  • Converts all existing Helix modules into Platform relative projects, updating the Framework reference to .Net Framework 4.8
  • Creates a new Rendering .Net Core project for each Module (Includes nuget packages for Rendering Engine and Layout Service)
  • Updates any (HPP) Helix Publishing Pipeline projects and sets them to only work with Platform modules.
  • Creates a new Rendering Host .Net Core web app along side the HPP site.
  • Updates all namespace reference to meet the new naming conventions of SolutionName.Layer.Module.Platform and SolutionName.Layer.Module.Rendering

On Completion

Once complete open the solution and you’ll see changes to each module. See below

You now have a solution that is ready to start being used for Headless development. All of your existing code is in the Platform (CM) project, you will now need to decouple this, moving the application over to the Relevant Rendering project.

Rendering Host

The rendering host project will need configuring and setting up as the script currently only generates a vanilla .NetCore Web App. You can use Sitecores documentation as guide for this here or check Helixbase Headless for an example. Helixbase headless is currently work in progress but I intend to have the Rendering Host available shortly.

Download

Get the scrip here

Umbraco: Modular Solution Architecture – Introduction

Introduction

From my experience of working with various digital agencies and numerous Umbraco websites, there has never been a defined guide on solution design when working with Umbraco, which has been the case when working with a lot of CMS’s.

Agencies & individuals sometimes have their preferred way of working when it comes down to the Visual Studio Solution Design, but often I’ve seen no thought put into it at all.


Sitecore’s Helix

This has very much been the case in the world of Sitecore, until a couple of years ago Helix was released. Helix is a set of overall design principles and conventions for Sitecore development.

Sitecore’s Helix Principes are not rocket science and essentially nothing new. These have evolved from Robert Martins “Principles of Package Design” outlined in “Agile Software Development Principles, Patterns and Practices”.

Principles of Package Design book by Matthias Noback

Principles of Package Design

I strongly recommend reading up about these principles. Matthias Noback has written up a fantastic book on these that cover better class design using SOLID along with package design. You can get the book here.


Umbraco & Modular Architecture

Packages

When I refer to Packages, I do not mean Umbraco Packages, but just Packages of code. In context to Visual Studio, this is a Libary.

Why?

Many digital agencies and software houses develop with both Sitecore and Umbraco. So to me, it makes complete sense to follow the same design principles, thus keeping consistency through all projects.

The Helix principles have been proven a success, and now widely used across most new Sitecore implementations.

It’s not for all projects

The solution is quite complex, I am not recommending its a way to fix everyone’s problems. This should be definitely considered when building a large to enterprise project when using Umbraco. Using it on a small website, such as blog will be overkill.

Getting started

In a nutshell, the Helix Solution design separates out the Visual Studio Studio solution into areas of business responsibility and has clear and easily maintainable dependencies.

For just under a year now, I’ve been looking into implementing a flavor of Helix solution design into Umbraco projects. I made mistakes on the way and now have a close to a perfect setup. I hope these guides will be of use.

I will cover how to set up a solution for Umbraco that follows a modular architecture using package design over a number of the next few blogs.

  1. The Solution Design & Layers (In Progress)
  2. Creating a Module / Package (In Progress)
  3. Decouple Umbraco from you Solution (In Progress)
  4. Development Automation (In Progress)