Redakt is designed around a highly modular architecture. This means that the Redakt ecosystem consists of many separate modules, that you can include in your project individually. Each module is of a specific type. For example, a database module contains the components to access a database product from a specific vendor. For many of these module types, Redakt contains several different implementations that you can choose from, for example, Cosmos DB, Mongo DB, or Raven DB for the database module type. This way, you can select the module that best fits your preference or expertise. Or you can develop your own module implementation if needed.
Some module types need to be configured explicitly, like the database module. Others have a default implementation that can be swapped out for another, such as the image processing module. Some modules are optional features, such as the Content Delivery API, which you only need for headless operation.
For most projects, you will want to start out by selecting and configuring a database and file storage module, and installing the most commonly used feature modules: content management, back office, and identity server. Together, these form a fully functional content management system.
If you have not created a Redakt .NET Core project yet, please follow the project setup guide first. This guide will assume that you have a basic Redakt project in place.
Module installation
Setting up a module is generally done with a few simple steps:
- Install the appropriate NuGet package.
- Register the module implementation with the services collection through the Redakt builder.
- Set configuration in the
appsettings.json
file or through a configuration delegate. - Add module middleware to the ASP.NET Core request pipeline.
Depending on the module, not all of these steps may be required. Consult the specific module's documentation page for detailed installation & configuration instructions.
1. Install the NuGet package
If you want to use a specific module implementation, you first have to install the appropriate NuGet package. You can find the NuGet package you need on the specific module's documentation page. Default module implementations are already part of the core packages and do not require any additional package to be installed. Some packages contain multiple module type implementations. See the full list of Redakt NuGet pakages here.
Alternatively, you can install the Redakt.All
meta-package. This package contains all current Redakt modules. If you install this package, you don't need to install any other Redakt package. As this also installs all dependencies for every module, it is recommended to install only the Redakt packages that you specifically need for your application once you are up and running.
2. Add to services collection
Now that you have installed the module's NuGet package, Redakt needs to be informed that you will be using that package. This is done by registering the module's services with the services collection in the ConfigureServices()
method in the Startup.cs
file of your project.
You always start out with a services.AddRedakt(...)
call to register Redakt core services, which returns an IRedaktBuilder
instance for further configuration. Additional Redakt modules can be registered in one of the following ways:
Recommended: call AddRedakt()
to register feature modules automatically
The default AddRedakt()
call registers Redakt core services. Additionally, services for installed feature packages will be registered automatically by the Redakt system. This is the recommended way to register Redakt services.
Data provider modules (f.e. database, file storage) still need to be registered explicitly by calling the appropriate method on theIRedaktBuilder
instance returned from theAddRedakt()
call. The specific module's documentation page indicates if the module is registered automatically, or if explicit registration is required.
The following code example registers Redakt services including all installed feature packages, and also adds the Cosmos DB database module.
public void ConfigureServices(IServiceCollection services)
{
// ... framework and other services here
var builder = services.AddRedakt(); // Registers Redakt core services and all installed feature modules.
builder.AddCosmosDbDataStore(); // Registers the Cosmos DB database module.
}
Alternative: call AddRedakt(false)
for manual module services registration
Pass false
as the first parameter to the AddRedakt()
call to prevent automatic registration of installed Redakt feature modules. In this case, the AddRedakt(false)
call will only register Redakt core services. This enables you to pass a configuration delegate to the individual module registrations. You will need to register any module that you want to use explicitly. All Redakt modules have a single extension method that will do that for you. This is done by calling that method on the IRedaktBuilder
instance returned from the AddRedakt(false)
call. You can find the exact method name on the specific module's documentation page.
The following code registers several Redakt modules explicitly.
public void ConfigureServices(IServiceCollection services)
{
// ... framework and other services here
var builder = services.AddRedakt(false); // Registers Redakt core services only.
builder.AddIdentityServer(); // Registers the identity server module.
builder.AddBackOffice(); // Registers the back office module.
builder.AddContentManagement(); // Registers the content management module.
builder.AddCosmosDbDataStore(); // Registers the Cosmos DB database module.
// ... other Redakt services
}
3. Set module configuration
Most modules allow configuration options to be set in the project's appsettings.json
file, or through an optional Action<TOptions>
delegate parameter. In many cases, the default configuration may be sufficient for your project, but some modules require explicit configuration to be set, such as connection settings for database modules. Consult the module's documentation for available configuration options.
4. Add to middleware pipeline
Some modules contain middleware that needs to be added to the ASP.NET Core pipeline in order to process incoming requests. This is done in the Configure()
method of your project's Startup.cs
file. Consult the module's documentation for available middleware. The following example registers identity server, and back office, and (CMS) page rendering middleware.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// other middleware here...
// Redakt middleware registration
app.UseRedaktIdentityServer();
app.UseRedaktBackOffice();
app.UseRedaktPageRendering();
}
Module types
The module types below are part of the Redakt ecosystem. You can find a full list of Redakt modules here.
Database modules
Primary Redakt data and content is persisted in a document (NoSQL) database. A database connection is required for Redakt to function, and therefore your application will not start up unless you have correctly installed and configured a database module. Redakt supports several different document databases out of the box. The database module is the only module type that does not have a default selected implementation, so explicit configuration is required for the database module type.
Click here for database module options and configuration
File Storage modules
The file storage module is responsible for storing and retrieving media files and other blob data. Redakt supports several different file storage modules. If none is configured explicitly, files are stored on the local file system by default. For most projects, you will likely want to set up a cloud file storage module.
Click here for file storage module options and configuration
Application Cache modules
To ensure optimal performance, Redakt makes heavy use of application-level caching. By default, in-memory caching is used. For extensive distributed applications, an out-of-process cache may be considered. The default module and configuration will work well in most scenarios.
Click here for application cache module options and configuration
Service Bus modules
In distributed hosting environments, the different Redakt instances need a way of communicating with each other. This is done through a service bus implementation. By default, no service bus module is selected. For distributed applications, a service bus module must be configured explicitly for proper operation.
Click here for service bus module options and configuration
Full-Text Search modules
Redakt can save published content to a full-text search index. The index can then be queried when a website visitor performs a site search query. A full-text search module is optional and is only required if you want to perform full-text searching on your website.
Click here for full-text search module options and configuration
Feature modules
Feature modules are different from other module types because there is only a single implementation of each of them. Rather than providing an alternative implementation for a specific component, they add a feature to the application. All feature modules are optional, although usually, you will need most of them in one or another application instance of your platform.
The following feature modules are available:
- The Content Management module is required for almost all applications.
- The Back Office application is the user interface to the Redakt system.
- The Identity Server authenticates back-office users and is normally set up together with the back office application.
- The Content Delivery API enables retrieval of published content for headless operation.
- The URL Management module tracks 404 (not found) results and manages redirects.
Other modules
Redakt contains other modules that have a default implementation but can be swapped for another one. In most cases, the default module is fine and does not need to be changed. Only in specific scenarios do you need to select a different module implementation.
- The Image Processor handles server-side resizing and processing of images.
- The View Provider determines how and from where Razor views are loaded.
- The Event Store persists all system events for logging and auditing.