Welcome to the Redakt project setup guide. Setting up a Redakt website is very easy. This guide will get you up and running with a local installation in just a few minutes!
This guide helps you setting up a Redakt project from scratch. Alternatively, you can use one of the skeleton projects as a starting point for your own project to get up and running quickly and easily.
Prerequisites
This guide assumes you are using Visual Studio for Windows, which is available for free for individuals and small businesses. Redakt targets .NET 6 or higher, which requires Visual Studio 2022. You may need to install the .NET 6 SDK if you don't have it already.
If you're using another IDE, such as Visual Studio for Mac or JetBrains Rider, the create project process may be different.
Step 1: Create a new project
If you haven't done so already, go ahead and create a new Visual Studio ASP.NET Core project.
Select the "ASP.NET Core Empty" project template and continue. You may also choose the "ASP.NET Core Web App" or "ASP.NET Core Web App (Model-View-Controller)" templates if you plan on using Razor Pages or MVC alongside Redakt.
In the next dialog, name your project and solution and press "Next".
In the following dialog, you can configure additional settings for the new project. Select ".NET 6.0" or higher from the framework dropdown.
Step 2: Install Redakt NuGet packages
Redakt is installed through a number of NuGet packages. Which packages you require will depend on your specific project infrastructure choices and feature needs.
You can find a full list off all official Redakt packages here.
For convenience, we also provide the Redakt.All
meta-package, which contains all other Redakt packages. For production websites, we recommend installing only the packages that your project requires to keep the dependency tree to a minimum. But for the moment, let's install the Redakt.All
meta-package.
Right-click on your new project, and select "Manage NuGet Packages...". In the Browse tab, search for the Redakt.All
package and install it.
Step 3: Choose a data store
Redakt consists of a large number of pluggable modules, from which you can select the ones you need for your project. The Redakt.All
package you have just installed contains all available Redakt modules. For almost all required module types, Redakt registers a default implementation. Only the database module needs to be registered explicitly. Because Redakt supports several different pluggable database modules, we do not register any specific one by default.
For this guide, we will be selecting Lite DB, a local file database. The Lite DB package is also part of the Redakt.All
meta-package.
See database module configuration for setting up other data stores instead.
Step 4: Register Redakt services
After the packages have been installed, we need to register Redakt services with the .NET dependency injection container. Open the Startup.cs
file of your web project and find the ConfigureServices()
method. In this method, add the following lines:
public void ConfigureServices(IServiceCollection services)
{
// ... framework and other services here
var builder = services.AddRedakt();
builder.AddLiteDbDataStore();
// ... other Redakt services
}
This configures Redakt services and registers services for tthe Lite DB database module. If you have selected a different database package instead, change the call accordingly. The AddRedakt()
call automatically registers the services for all Redakt feature modules that have been installed. You only need to register data provider modules explicitly.
Depending on which project template you chose, other ASP.NET Core service registrations may already be present in the ConfigureServices()
method. The position where you place the Redakt calls is not important.
Step 5: Add Redakt Middleware to the request pipeline
We have now configured our services, but we still need to add the Redakt Middleware to the ASP.NET Core request pipeline. Again in the Startup.cs
file, find the Configure()
method. Some calls have already been added inside this method by the project setup process. Add the Redakt middleware at the end of the method:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// other middleware here...
// Redakt middleware registration
app.UseRedaktIdentityServer();
app.UseRedaktBackOffice();
app.UseRedaktPageRendering();
}
This inserts the Redakt identity server, back-office module, and page rendering middleware into the request pipeline. Middleware gets called in the order it was added in this method, so in contrast to the ConfigureServices()
method, the order of these calls can be important. In any case, the Redakt middleware registration must be placed after the app.UseRouting()
call. If you have chosen a Web App template and want to give priority to MVC or Razor Pages, place the Redakt calls after the app.UseEndpoints(...)
call. Otherwise, if you want to give priority to Redakt, place the Redakt calls before the app.UseEndpoints(...)
call.
Step 6: Start your site
That's all configuration done for now! Press the play button to start your website.
Redakt will detect that this is a first time installation and will come up with an install screen. Enter administrator credentials and your new website information and press "Install". The installation procedure populates the database with system master data. This will be done in a few seconds and you will be taken to the Redakt back office of your new website.
Done!
You are now done with setting up a local website with Redakt. You can access the back office at the default /redakt
URL. This URL can optionally be changed through configuration. The current setup is suitable for small non-distributed websites. See the configuration section for setting up Redakt for more advanced scenarios.
NOTE: You will also need to start implementing content models and views, and the back office application will display a warning until you do. See the implementation guides for further information.