Skip to content
Menu
Search
Browse documentation & this page

Developer Guide

Add Cendia to an existing app

Install the CMS packages in an ASP.NET Core host, configure the database and endpoints, and keep your application data separate.

Use this path when you already have an ASP.NET Core application and want to add content management. You need the .NET 10 SDK and SQL Server or LocalDB. If your frontend uses another stack, run Cendia in a separate .NET host and follow Build headless.

Install the package

Run this from the host project's directory. The public feed needs no key or sign-in:

dotnet add package Cendia.CMS --source https://nuget.cendia.com/index.json

Keep https://nuget.cendia.com/index.json in your solution's nuget.config for subsequent restores, alongside nuget.org and any feeds your application already uses. Keep the installed release version pinned in the project file. See Packages and versions.

Register the CMS

Merge these registrations into your existing Program.cs, before builder.Build():

using Microsoft.EntityFrameworkCore;
using Cendia;
using Cendia.Data;

var connectionString = builder.Configuration.GetConnectionString("CendiaConnection")
    ?? throw new InvalidOperationException("Connection string 'CendiaConnection' not found.");

builder.Services.AddDbContext<CmsDbContext>(options =>
    options.UseSqlServer(connectionString));
builder.Services.AddCendia(options =>
    builder.Configuration.GetSection("Cendia").Bind(options));

Configure ConnectionStrings:CendiaConnection for your SQL Server database using development user secrets or your deployment's configuration store. Keep your application's data and migrations in its own DbContext; the cms_ table prefix belongs to Cendia.

Configure the request pipeline

After builder.Build(), merge these calls into the existing pipeline in this order. Keep your own middleware and endpoint mappings where appropriate; avoid duplicating middleware already present:

app.MigrateCendiaInDevelopment();

app.UseHttpsRedirection();
app.UseResponseCompression();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapCendia();

// Keep your application's own endpoint mappings here.
app.Run();

AddCendia registers CMS services and the authoring surface. MapCendia maps /cms, preview and delivery endpoints, the sitemap, and the content-rendering catch-all when enabled. Review route ownership and authentication configuration alongside your application's existing routes and sign-in schemes before deploying. In particular, avoid assigning the same endpoint to both your application and the CMS.

In Development with a database on your machine, the migration call applies the packaged CMS migrations. It does not migrate a remote database just because the application is running locally. See Database changes for shared and deployed databases.

Choose how content is rendered

Set Cendia:EnableRendering to true for CMS-managed Razor pages. Add C# page types and their matching templates using Content types and Templates.

Set it to false for a headless host and use the delivery APIs from your existing frontend. With rendering disabled, the bare CMS host root redirects to /cms; plan the host boundary if your existing application already owns /. See Build headless.

Verify the integration

Run the application locally, open /cms, and complete the first-account setup on a fresh database. Create a content type, configure the website's hostname and language, and publish a page. Check a rendered page or Delivery API request as appropriate, then check your existing routes and sign-in flow too.

Local development needs no license key. A public hostname, including staging, needs a suitable license. Before deployment, also configure a strong Cendia:PreviewSigningKey through the host's configuration store; the application requires it outside Development. Read Licensing and Hosting and deployment.