Introduction
Nowadays, we all see and hear tons of PoC and software solutions based on front-end frameworks, .NET backend, and containerization; with the spreading of .net core and its multi-platform nature, we have now opened a whole world of solutions that we couldn’t see before and that will speed up our developments and open us the possibility of developing better and faster web apps. I really love developing on macOS with Visual Studio Code, exploiting an API/backend solution with .NET Core and a front end made with Angular, putting all in a Docker container...fast, eventually scalable, light and friendly with all the most recent DevOps technologies.
But one of the biggest faults in Microsoft world is CMS. One of the best solutions by now is Umbraco CMS, which unfortunately in its last version (8) has not been ported to .NET Core yet.
So what could we do? Do we have to forget about Angular and containers since we are jailed inside Microsoft OS?
Of course not! In this guide, thanks to Docker Windows containers, I’ll show you how to make a little web page sample with Angular front end and data taken from the API layer served by Umbraco CMS, all developed and deployed inside a single Docker container.
This is the reason why we use a package plug-in for Umbraco called Umbraco HeadRest, developed by Matt Brailsford (https://github.com/mattbrailsford/umbraco-headrest).
Note that Umbraco has now a cloud solution like this - called Heartcore - but the HeadRest solution is definitely better for developing purposes and deep website customization since you have control over all features of the API layer.

Let’s start!
Software and products needed on your dev machine,
- Docker for Win
- Visual Studio 2019 (for the .NET code)
- Visual Studio Code (suggested for the Angular code but you can choose your favorite dev environment)
I suggest you Azure SQL database service DB, which is mostly the best solution but you can choose your own one. For example, keep the DB on the same container of the web app or put it in another separate container.
After you set up the DB, you can create a new Web Application directly from Visual Studio 2019. Enable the Docker support in order to debug and deploy the application inside a container.
Then, install Umbraco CMS from Nuget Package Manager (version used in this article is 8.4.0, but is already available v8.5.3 with some major changes). We also need the API layer package installed that will serve the Angular frontend, the “magic” one, so search for Our.Umbraco.HeadRest.
Then, let’s start the website inside the container to create some backend stuff.
I started creating a home page sample with a proper title and a first-level page sample with, again, a proper title.
Now, let's move to configuration to let HeadRest do its work. If you read the GitHub project page info you can understand it's mandatory, I’ll explain what I have done to set it up properly, in order to make the process easier.
We have to implement the Umbraco 8 Component and Composing method: essentially, these are the new ways that Umbraco gives us to register and configure components at the application startup.
For further info, read:
- https://our.umbraco.com/documentation/implementation/composing/
- https://creativewebspecialist.co.uk/2018/06/15/umbraco-v8-bye-bye-applicationeventhandler-hello-umbraco-components/
- https://www.perplex.nl/en/blog/2019/umbraco-v8-changes-for-developers/
So we configure our HeadRest like this:
- public class HeadRestConfigComponent : IComponent
- {
- private readonly HeadRest _headRest;
- public HeadRestConfigComponent(HeadRest headRest)
- => _headRest = headRest;
- public void Initialize()
- {
- // Configuration goes here
- _headRest
- .ConfigureEndpoint("/api/", "/root//homePage[1]", new HeadRestOptions
- {
- //CustomRouteMappings = new HeadRestRouteMap()
- // .For("^/(.*)?$").MapTo("/"),
- ViewModelMappings = new HeadRestViewModelMap()
- .For(HomePage.ModelTypeAlias).MapTo<HomePageViewModel>()
- .For(FirstLevelPage.ModelTypeAlias).MapTo<FirstLevelPageViewModel>()
- });
- }
- public void Terminate() { }
- }
We’ll have an API layer configured on the path/API of our web app, starting from the homepage node of the Umbraco tree; we also configure our view model map, which should be the view model that will be on our document type (HomePage and FirstLevelPage document types) and will be outputted in the API layer data.
I usually put all the “compiled” items (like controllers and the component initialization in this case) in an external project, to have cleaner code and a better solution organization.
The HomePage and FirstLevelPage classes have been automatically generated by Umbraco with the ModelsBuilder live DLL method, and the DLL has been imported in the external project.

In order to let Umbraco pick up the component, it must be added to the Composition like this:
- [ComposeAfter(typeof(HeadRestComposer))]
- public class HeadRestConfigComposer : IUserComposer
- {
- public void Compose(Composition composition)
- {
- composition.Components()
- .Append<HeadRestConfigComponent>();
- composition.WithCollectionBuilder<MapDefinitionCollectionBuilder>()
- .Add<HeadRestMapDefinition>();
- }
- }

Join the conversation! Your thoughts help the community grow.