Extensions
Introduction
This document describes how to write extensions for Squidex. We assume that you know the basic principles of C# and ASP.NET Core. Otherwise, it might be very hard to write custom extensions.
We use interfaces for all components, which can then be replaced with custom implementations. The default dependency injection system is used to register services. (see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection).
Furthermore, you can extend Squidex with custom HTTP endpoints. Due to the static nature of the Management UI (which is built with Typescript and Angular and has a compilation and bundling process), you cannot extend the UI, except in a few cases where its been made possible.
Read the following article to understand how to write custom editors for the Management UI:
How to Write a Custom Plugin
So far (as of October 2019), Squidex has a limited plugin architecture that can be used for most cases. In this section we will give you an introduction how to write this type of plugin, and how to register it in Squidex.
In this tutorial we use Squidex.Extensions project as an example, which also contains a sample plugin.
1. Clone the source code
Checkout the source code from GitHub:
git@github.com:Squidex/squidex.git
You only need the source code for development. There are other approaches on how to deploy the newest version of Squidex with your plugin.
2. Create a .NET Core Class Library
First, you need to create a new .NET class library to the backend solution:

Ensure that you target netcoreapp3.0.
Then add references to the following other projects in the solution:
Squidex.Domain.Apps.EntitiesSquidex.Web
This will implicitly create references to all other projects that might be needed.
The reference projects contain interfaces as well as implementations - which is a problem, because it's hard to figure out which classes should be used in custom plugins. Implementations are subject to change and should not be used directly. Therefore we plan to restructure the content and create implicit contract projects, which don't contain implementation details.
3. Create a New Plugin Class.
A plugin class is used to register all implementations to Squidex. In this example we create a custom plugin which registers an asset store and keeps all files in memory. We register it only when it's activated via the configuration system, so either from the appSettings.json file, command line arguments or environment variables.
namespace Squidex.Extensions.Samples.AssetStore
{
public sealed class MemoryAssetStorePlugin : IPlugin
{
public void ConfigureServices(IServiceCollection services, IConfiguration config)
{
var storeType = config.GetValue<string>("assetStore:type");
if (string.Equals(storeType, "Memory", StringComparison.OrdinalIgnoreCase))
{
services.AddSingletonAs<MemoryAssetStore>()
.As<IAssetStore>();
}
}
}
}
You can also add multiple implementations to your class library if you have multiple extensions in one project and want to group them together.