Scott Hanselman

Headless CMS and Decoupled CMS in .NET Core

October 3, '18 Comments [20] Posted in DotNetCore
Sponsored By

Headless by Wendy used under CC https://flic.kr/p/HkESxWI'm sure I'll miss some, so if I do, please sound off in the comments and I'll update this post over the next week or so!

Lately I've been noticing a lot of "Headless" CMSs (Content Management System). A ton, in fact. I wanted to explore this concept and see if it's a fad or if it's really something useful.

Given the rise of clean RESTful APIs has come the rise of Headless CMS systems. We've all evaluated CMS systems (ones that included both front- and back-ends) and found the front-end wanting. Perhaps it lacks flexibility OR it's way too flexible and overwhelming. In fact, when I wrote my podcast website I considered a CMS but decided it felt too heavy for just a small site.

A Headless CMS is a back-end only content management system (CMS) built from the ground up as a content repository that makes content accessible via a RESTful API for display on any device.

I could start with a database but what if I started with a CMS that was just a backend - a headless CMS. I'll handle the front end, and it'll handle the persistence.

Here's what I found when exploring .NET Core-based Headless CMSs. One thing worth noting, is that given Docker containers and the ease with which we can deploy hybrid systems, some of these solutions have .NET Core front-ends and "who cares, it returns JSON" for the back-end!

Lynicon

Lyncicon is literally implemented as a NuGet Library! It stores its data as structured JSON. It's built on top of ASP.NET Core and uses MVC concepts and architecture.

It does include a front-end for administration but it's not required. It will return HTML or JSON depending on what HTTP headers are sent in. This means you can easily use it as the back-end for your Angular or existing SPA apps.

Lyncion is largely open source at https://github.com/jamesej/lyniconanc. If you want to take it to the next level there's a small fee that gives you updated searching, publishing, and caching modules.

ButterCMS

ButterCMS is an API-based CMS that seamlessly integrates with ASP.NET applications. It has an SDK that drops into ASP.NET Core and also returns data as JSON. Pulling the data out and showing it in a few is easy.

public class CaseStudyController : Controller
{
    private ButterCMSClient Client;

    private static string _apiToken = "";

    public CaseStudyController()
    {
        Client = new ButterCMSClient(_apiToken);
    }

    [Route("customers/{slug}")]
    public async Task<ActionResult> ShowCaseStudy(string slug)
    {
        var json = await Client.ListPageAsync("customer_case_study", slug)
        dynamic page = ((dynamic)JsonConvert.DeserializeObject(json)).data.fields;
        ViewBag.SeoTitle = page.seo_title;
        ViewBag.FacebookTitle = page.facebook_open_graph_title;
        ViewBag.Headline = page.headline;
        ViewBag.CustomerLogo = page.customer_logo;
        ViewBag.Testimonial = page.testimonial;
        return View("Location");
    } 
}

Then of course output into Razor (or putting all of this into a RazorPage) is simple:

<html>
  <head>
    <title>@ViewBag.SeoTitle</title>
    <meta property="og:title" content="@ViewBag.FacebookTitle" /> 
  </head>
  <body>
    <h1>@ViewBag.Headline</h1>
    <img width="100%" src="@ViewBag.CustomerLogo">
    <p>@ViewBag.Testimonial</p>
  </body>
</html>

Butter is a little different (and somewhat unusual) in that their backend API is a SaaS (Software as a Service) and they host it. They then have SDKs for lots of platforms including .NET Core. The backend is not open source while the front-end is https://github.com/ButterCMS/buttercms-csharp.

Piranha CMS

Piranha CMS is built on ASP.NET Core and is open source on GitHub. It's also totally package-based using NuGet and can be easily started up with a dotnet new template like this:

dotnet new -i Piranha.BasicWeb.CSharp
dotnet new piranha
dotnet restore
dotnet run

It even includes a new Blog template that includes Bootstrap 4.0 and is all set for customization. It does include optional lightweight front-end but you can use those as guidelines to create your own client code. One nice touch is that Piranha also includes image resizing and cropping.

Umbraco Headless

The main ASP.NET website currently uses Umbraco as its CMS. Umbraco is a well-known open source CMS that will soon include a Headless option for more flexibility. The open source code for Umbraco is up here https://github.com/umbraco.

Orchard Core

Orchard is a CMS with a very strong community and fantastic documentation. Orchard Core is a redevelopment of Orchard using open source ASP.NET Core. While it's not "headless" it is using a Decoupled Architecture. Nothing would prevent you from removing the UI and presenting the content with your own front-end. It's also cross-platform and container friendly.

Squidex

"Squidex is an open source headless CMS and content management hub. In contrast to a traditional CMS Squidex provides a rich API with OData filter and Swagger definitions." Squidex is build with ASP.NET Core and the CQRS pattern and works with both Windows and Linux on today's browsers.

Squidex is open source with excellent docs at https://docs.squidex.io. Docs are at https://docs.squidex.io. They are also working on a hosted version you can play with here https://cloud.squidex.io. Samples on how to consume it are here https://github.com/Squidex/squidex-samples.

The consumption is super clean:

[Route("/{slug},{id}/")]
public async Task<IActionResult> Post(string slug, string id)
{
    var post = await apiClient.GetBlogPostAsync(id);

    var vm = new PostVM
    {
        Post = post
    };

    return View(vm);
}

And then the View:

@model PostVM
@{
    ViewData["Title"] = Model.Post.Data.Title;
}

<div>
    <h2>@Model.Post.Data.Title</h2>

    @Html.Raw(Model.Post.Data.Text)
</div>

What .NET Core Headless CMSs did I miss? Let me know.

This definitely isn't a fad. It makes a lot of sense to me architecturally. Given the proliferation of "backend as a service" systems, DocumentDBs like Cosmos and Mongo, it follows that a headless CMS could easily fit into my systems. One less DB schema to think about, no need to roll my own auth/auth.

*Photo "headless" by Wendy used under CC https://flic.kr/p/HkESxW


Sponsor: Telerik DevCraft is the comprehensive suite of .NET and JavaScript components and productivity tools developers use to build high-performant, modern web, mobile, desktop apps and chatbots. Try it!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Wednesday, 03 October 2018 08:01:34 UTC
I imagine being able to manage the website with PowerShell could be fun...
Fleet Command
Wednesday, 03 October 2018 08:35:17 UTC
Hi Scott, given that you have listed multiple headless CMSs, which one would you recommend to start with? Thanks!
Matthias
Wednesday, 03 October 2018 10:50:02 UTC
Hi Scott,

I read "I wanted to explore this concept and see if it's a fad or if it's really something useful." in the intro. I'm missing the answer to that question ;)

What do you actually think about them? And the whole concept? Any experience yet? For me this is something I was always thinking about when implementing a CMS. Make your own web app, and have a CMS just for the content. Haven't been able to try it yet so was looking for your opinion. Thanks for the summary though!
Wednesday, 03 October 2018 16:05:36 UTC
Hey Scott, not sure if you are familiar with Kentico, but they are a wonder .NET based CMS platform. They also offer Kentico Cloud which is in Gartner Magic Quadrant for CMS and is a headless CMS solution. https://kenticocloud.com/headless-cms-guide. It's not free, but it is a great solution for this purpose.
Wednesday, 03 October 2018 16:59:54 UTC
Hey Scott, surprised you didn't mention Sitecore. Well, maybe not surprised; Sitecore is a commercial CMS provider. They offer a headless interface as well and are currently in the process of being ported to DotNet Core.
Frank Rosario
Wednesday, 03 October 2018 17:11:03 UTC
Hi Scott,

I’m one step ahead of you, I’m now looking at serverless CMS. It seems like lynicon would be a good option. Although I can’t seem to find examples. That’s what I get for living on the edge
Scott Cowan
Wednesday, 03 October 2018 22:29:31 UTC
If anyone is interested in exploring the whole universe of headless CMS systems, https://headlesscms.org is a great resource from the Netlify folks.

It’s also not a coincidence that one of the leading static site hosts is interested in the headless CMS concept - it’s a great match with static site generators. You author the content and store media in the CMS and then a hook/timer/etc. triggers the static generator, which pulls data for generation from the headless CMS.
Wednesday, 03 October 2018 22:58:34 UTC
I did a similar evaluation a few weeks ago but with a focus on the non-technical content writer experience and found a lot of these new headless CMSs had awful editors. Things like not saving content once the session times out, accidental page refresh clearing all your work, no localization support, and limiting them to the typical tinyMCE controls. Only WordPress, especially with Gutenberg, had a great content writer experience and although it’s not exactly headless with JSON APIs everything is accessible via built-in services that’ll work with static site generators like gatsby.
Karl Romanowski
Wednesday, 03 October 2018 23:11:34 UTC
Hi Scott,
It would be nice if you could add Sitecore CMS as that is widely used by so many companies including banks, travel websites etc.
Rashmi
Thursday, 04 October 2018 08:36:26 UTC
Ive been using ButterCMS and have nothing but good things to say. I love using a headless CMS and the flexibility that it provides.
Matt Sonnhalter
Thursday, 04 October 2018 12:42:31 UTC
Hey Scott,

Thanks for the write-up!

Hi Matt! Thanks for the kind words.

If anyone has any questions about headless / Butter, happy to chime in.
Jake Lumetta (CEO @ ButterCMS)
Thursday, 04 October 2018 13:53:28 UTC
Hi Scott, I work on Cofoundry, it is an open source .NET Core CMS delivered as a NuGet package and is super flexible in how you deliver content. While we do have a visual editor tool for managing content in website pages it's entirely optional and all the data API's are there for you to expose however you want to.

We have a cat-rating sample app that shows how to do this by exposing content data over web api.
Thursday, 04 October 2018 14:51:46 UTC
This is super timely, for me -- it fits well with something I'm tasked with completing at the moment, so thanks for taking the time to put this together!

I had a quick laugh, though, as someone who was developing software going back to when Skype for Business was called Live Communications Server and did so through OCS, Lync and Skype for Business via TAP programs that former employers were involved in. When they switched the name to 'Lync', everyone around me groaned at the verbal disambiguation exercises with 'Link' that were going to all be part of our future.

People unfamiliar with the product never seemed to land on the odd spelling, but I thought I was the only one on the internet that somewhat frequently misspelled other words because of their edit distance from 'Lync'. TIL, I'm not alone (See Lynicon paragraph) -- and not terribly surprised since you're the owner of Can you hear me now which was my go-to for meetings when I was a remote worker relying on Lync/SfB. I'm betting you've typed that strange word more than me and it's pretty stuck muscle memory.

Thanks, again!
Thursday, 04 October 2018 19:54:04 UTC
Hi Scott,

Thank you for covering this topic. We see the headless approach as an excellent option for developers who want to use microservices architecture, but also for front-end developers who want to build lightweight websites using modern frameworks, such as React or Angular, or static site generators, such as GatsbyJS.

That's why we created Kentico Cloud. As Kyle mentioned above, Kentico Cloud is a headless CMS with a strong .NET Core support.

Kentico Cloud runs on Azure, and it leverages many Azure services (Web Apps, Cosmos DB, Storage, Table Storage or - in the near future - Cognitive Services). Its API leverages a global CDN that makes your content available at no time anywhere in the world.

Our .NET SDK targets the .NET Standard 2.0, which means it can be used in .NET Framework 4.6.1 projects and above, and .NET Core 2.0 projects and above.

We also provide ASP.NET Core MVC Boilerplate, Xamarine Boilerplate and .NET model generator.

There's also a sample website in Microsoft Azure Gallery.

Since it's provided as SaaS, developers do not need to worry about installing and maintaining a CMS - they simply call its REST API or use one the SDKs that are available for all major languages.

For the business users, we provide excellent content authoring and collaboration experience (think of "Office online"-like experience for structured content).

Developers can easily get started with our free plan that can be used for commercial projects.

Happy to answer any questions.

Petr Palas, Kentico

Full disclosure: I work for Kentico, and I love headless, so my views may be biased.
Friday, 05 October 2018 02:49:19 UTC
aw shucks now I gotta try 'em all!
Jojo Aquino
Sunday, 07 October 2018 12:44:42 UTC
Hi,

Sebastian here, Main Developer of Squidex Headless CMS.

Thank you this free push and everything you do for the developer community.

Btw: Squidex is hosted with GCE, because they had the easier offer for startups at this time and kubernetes for Azure was not ready yet. Hope to change this soon.
Monday, 08 October 2018 19:59:53 UTC
I'm developing Kaliko CMS which just was released in version 1.2.4 introducing a new headless content API.

Kaliko CMS is a free and open source content management system for ASP.NET MVC and WebForms, and are currently undergoing a major rewrite to add .NET Core compatibility among other features.

A demo project showing the headless feature can be found here: https://github.com/KalikoCMS/DemoSite.Headless

And more information about the content API can be found here: http://kaliko.com/cms/get-started/use-as-a-headless-cms/
Wednesday, 10 October 2018 05:11:57 UTC
It's nice to see this list of .NET CMS platforms but we ended up going with WordPress for a recent project because we needed to monetize our content. The plugin PaidMembershipPro made this easy and turned our WordPress site into a SaaS with full membership and payment functionality. From the limited research I did with this list, it appears these .NET CMS platforms do not have this kind of SaaS functionality but please correct me if I am wrong.
HBCondo
Saturday, 13 October 2018 22:33:05 UTC
thank you best website
Tuesday, 16 October 2018 03:24:20 UTC
I really enjoy reading this post. Thanks for sharing.
Name
E-mail
(will show your gravatar icon)
Home page
2+5

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.