Skip to content

About

A reusable Umbraco foundation for websites and business applications, with shared themes, authentication, forms, interactive reports, and independent site deployment.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Umbraco App Host

AurorisNet.Umbraco.AppHost is a reusable Umbraco 18 foundation for websites and business applications: one library that gives a web project sign-in, page types, themes, forms, reports and the scripts that create and update its sites.

MIT license .NET 10 Umbraco 18 Status: alpha

A web project references the library and makes two calls in Program.cs. The library registers Umbraco with its backoffice and website, the packages listed under What a site gets, the shared views and browser assets, and a saved uSync export that the first start imports into a new database.

The repository holds:

Path Contents
src/UmbracoAppHost The library, packed as AurorisNet.Umbraco.AppHost.
src/UmbracoAppHost.Web The reference website: a Program.cs with the two calls, and the project the site scripts publish.
tests/UmbracoAppHost.Testing AurorisNet.Umbraco.AppHost.Testing, which boots a host in a test process.
Frontend The source of the website and application themes, built into the library.
new-site.ps1, update-site.ps1, refresh-definitions.ps1, reset.ps1, deployment/ The scripts that create, update and reset sites.

This is an alpha, version 1.0.0-alpha.1. The packages are not on nuget.org yet, so a site builds the library from a checkout of this repository. Only the package ids carry the AurorisNet prefix: the assembly, the namespace and the settings section are UmbracoAppHost.

Start a site

Building needs the .NET 10 SDK, Node 20 or newer, and these checkouts beside this repository's folder. The scripts need PowerShell 7.

Sibling checkout Provides Folder property Source switch
../AurorisNet.Umbraco.AppBlocks Forms, data sources, reports and documents AppBlocksRoot UseAppBlocksSource
../AurorisNet.Umbraco.BreakGlass Administrator recovery BreakGlassRoot UseBreakGlassSource
../AurorisNet.Umbraco.IdentityServer.SSO Single sign-on IdentityServerSsoRoot UseIdentityServerSsoSource
../AurorisNet.Umbraco.IdentityServer.Directory Add from directory IdentityServerDirectoryRoot UseIdentityServerDirectorySource

Pass a folder property to use a checkout elsewhere, for example dotnet build -p:AppBlocksRoot=D:\src\AurorisNet.Umbraco.AppBlocks. Each switch is true by default; Developing describes what false does.

Run the reference website. Open UmbracoAppHost.slnx in Visual Studio and start the Website launch profile, or run:

dotnet run --project src/UmbracoAppHost.Web

The first start creates the instance folder reference/, installs Umbraco into a SQLite database and imports the saved export with its sample pages. The site answers at http://localhost:5080/ and the backoffice at /umbraco. Under the Development settings, sign in as admin with any nonempty password. Getting started explains the sign-in and how to reset the instance.

Create independent sites. new-site.ps1 publishes the reference website and creates a site folder from the build. update-site.ps1 installs a newer build into it. Deployment covers both, and IIS.

pwsh -File new-site.ps1 -Name MyWebsite -Destination E:/Sites/MyWebsite
pwsh E:/Sites/MyWebsite/start-site.ps1

Use the library in your own project. Reference src/UmbracoAppHost/UmbracoAppHost.csproj from a web project and call the library from Program.cs:

using UmbracoAppHost;

var builder = WebApplication.CreateBuilder(args);
builder.AddUmbracoAppHost();

await using var app = builder.Build();
await app.UseUmbracoAppHostAsync();
await app.RunAsync();

AddUmbracoAppHost reads the instance settings and registers Umbraco and the shared services. Its optional callback registers the project's own database connections. UseUmbracoAppHostAsync starts Umbraco and builds the request pipeline. Its two optional callbacks add middleware and endpoints inside Umbraco's pipeline. A project that keeps its registrations on a class implementing IUmbracoAppHost calls AddUmbracoAppHost<Program>() and UseUmbracoAppHostAsync<Program>(), so its tests apply the same registrations. Use the library in another repository has the project file, settings and update routine.

Script Purpose
new-site.ps1 -Name <name> -Destination <folder> Publishes the reference website, or the project -Project names, and creates an independent site from the build.
update-site.ps1 -Site <folder> Installs a new build into a site and refreshes the shared uSync definitions in its uSync folder.
refresh-definitions.ps1 -Instance <folder> Refreshes the shared uSync definitions of an instance that a host runs from its own project.
reset.ps1 Deletes the reference instance's data, so the next start installs a new database and imports the saved export.

What a site gets

  • Web Site and Web Page types with a website theme and an application theme, authored menus, page CSS and JavaScript, and language fallback. See Websites, pages and blocks and Themes.
  • Forms, data sources, reports and documents from AppBlocks and its Interactive Reports and Documents companions, with sample pages over a sample orders database. See Websites, pages and blocks and Interactive Reports.
  • Single sign-on for backoffice users and members through an embedded identity server that signs in Windows accounts, with a password fallback, an Add from directory button and administrator recovery through configuration. See Sign-in and accounts.
  • A saved uSync export of the shared definitions and starter content, imported on first start. See uSync exports.
  • An instance folder outside the application for settings, databases, media and uSync files, so updates replace the application alone. See Databases and Deployment.
  • Hosting under a sub-path, such as an IIS application at /portal. See Hosting under a sub-path.
  • A backoffice Welcome dashboard that lists recently changed pages, hooks for branding the login screen, and no telemetry reports. See Login screen and backoffice.
  • Razor previews in the block editors from Umbraco.Community.BlockPreview. See Block previews.
  • A testing package that boots a host on Kestrel with a new database. See Test a host.

People picker

The People picker (appPeoplePicker) is a form companion supplied by AppHost. Add it inside a form on a Website page and bind its identity and name settings to writable text fields. It places a search button beside the name field and opens a separate search window. The picker ships its editor schema, preview, JavaScript and styles with the host.

The published block sets the search OU (or explicitly permits the whole domain), whether to include child OUs, search and returned LDAP attributes, account filters, optional member group names and backoffice group aliases. Empty group lists admit anyone who can access the page, including anonymous visitors on public pages. Otherwise either group list may admit the caller; no linked Windows SID is required. These settings apply to both search and selection and cannot be overridden by browser query parameters.

Map returned attributes with one attribute=formField pair per line. Each picker owns distinct writable text fields in its containing form. An optional mappedField=readOnlyMirrorField fallback allows manual input when the directory supplies no value; the form resource must load the mirror with the directory's value, separately from the typed fallback. Compact-uppercase fields remove whitespace and uppercase their input. Manual entry can be disabled per picker.

GET /api/people-picker/{page}/{block}?s=... searches; ?sid=... validates a selection within the same scope. Both responses prohibit caching. The popup uses the validated response for its field values. At save, AppBlocks' IFormSubmissionProcessor hook runs the shared PeoplePickerService again for every new or changed SID. Unchanged saved identities keep their stored directory-owned fields during an outage, while configured fallback fields remain editable when their mirrors are empty. Search results and application contact caches do not authorize a new saved identity.

Cached selection is off by default. Opting in permits recent validated people during directory outages, isolated by page, picker and all settings, with a configured age of 1–1440 minutes and a process-wide limit of 2,000 people. A live rejection removes that cached identity. The cache does not survive restarts. Directory calls use the Windows process identity, bounded result counts and the block's 1–15 second LDAP client/server timeout; live lookup requires a reachable domain. Search terms and person records are not logged by the picker.

Applications can register IPeoplePickerSelectionObserver to store canonical contact data after save-time validation. They can also check PeoplePickerService.WasValidated in their resource to prevent a changed SID from bypassing the form processor. IPeoplePickerDirectory is the replaceable directory boundary used by tests. The shared types are in UmbracoAppHost.PeoplePicker. Application-specific LDAP filters and attribute mappings belong in the application's block configuration; no global directory filter is registered.

Run the focused server tests with dotnet test --project tests/UmbracoAppHost.Tests/UmbracoAppHost.Tests.csproj --filter-class UmbracoAppHost.Tests.PeoplePickerTests --no-progress. The browser checks run with node --test tests/ui/people-picker.browser.test.mjs, using Playwright installed by npm ci in the sibling AurorisNet.InteractiveReports checkout. Override that folder with INTERACTIVE_REPORTS_ROOT and the browser executable with BROWSER_PATH if necessary.

Settings

The library reads its own settings from the UmbracoAppHost section and from InstanceRoot.

Setting Default What it does
InstanceRoot App_Data/UmbracoAppHost The instance folder, relative to the content root. It holds instance.json, data/, media/ and uSync/. The reference website sets ../../reference, and a site created by new-site.ps1 sets ...
UmbracoAppHost:Samples true Registers the sample.orders form class, the orders report and the sample database, and copies the sample content into a new working uSync folder. Set false in a project of your own.
UmbracoAppHost:HostExport uSync The project's own committed uSync export, relative to the project root. Its files are copied into a new working uSync folder after the library's. Empty turns it off.
UmbracoAppHost:ProjectRoot the content root The folder that holds the project's own files, such as its uSync export and schema scripts. builder.ProjectRoot() returns it. A test site sets it.

Settings are read in this order, and a later source replaces an earlier one: the library's defaults (src/UmbracoAppHost/Hosting/defaults.json), the instance's instance.json, the project's appsettings.json and appsettings.<Environment>.json, environment variables, and the command line. The library then sets the data folder, the media folder and uSync's root folder from InstanceRoot, so a uSync:Settings:RootFolder in a settings file has no effect.

The other sections are described where they apply: BreakGlass, BackOfficeLogin, IdentityServer, EmbeddedIdentityServer, Accounts and Directory in Sign-in and accounts, Attachments, InteractiveReport and ConnectionStrings in Databases and Interactive Reports, and BlockPreview in Block previews.

Supported versions

Directory.Packages.props pins each dependency to one release.

Dependency Release Notes
.NET 10 The SDK to build, the ASP.NET Core runtime to run a published site.
Umbraco 18.3.2 AppBlocks pins the same release. The build stops when the two differ.
AppBlocks 0.1.0-alpha.1 Its four packages share one version. Used when the library builds against packages.
uSync 18.3.1
Umbraco.Community.UmbNav 5.0.3
Umbraco.Community.BlockPreview 6.3.0
AurorisNet.Umbraco.ApplicationVirtualPathFix 18.3.2.1 Its supported Umbraco range must include the pinned Umbraco release.
AurorisNet.Umbraco.DisableTelemetry 18.3.2.1

A new instance keeps Umbraco in a SQLite file. Databases has the steps to move it to SQL Server.

Documentation

Guide What it covers
Getting started Running and resetting the reference website, using the library in another repository, and testing a host.
Deployment Creating a site from a build, the site folder, IIS, and updating a site.
uSync exports The saved export and the working folder, saving a backoffice change, and delivering it to existing sites.
Websites, pages and blocks Web Site and Web Page, templates, menus, Public Access, language fallback, layouts, and the sample pages.
Themes The two themes, registering another, and packaging a theme as a library.
Sign-in and accounts Administrator recovery, login flows, single sign-on defaults, accounts from the directory, and access to protected pages.
Interactive Reports Who administers and reads Interactive Reports in this host, the built-in reports and the Report Page type.
Databases The database files of an instance, a project's own database, and moving Umbraco to SQL Server.
Hosting under a sub-path The virtual path setting and what the host applies it to.
Login screen and backoffice Branding the login screen, the Welcome dashboard and telemetry.
Block previews Razor previews in the block editors and their settings.
Design The decisions behind the content model, and which repository owns each part.
Frontend Building the theme assets and generated layouts.

Developing

Use the .NET 10 SDK, Node 20 or newer and PowerShell 7, with the sibling checkouts listed under Start a site. The .NET build restores and builds the frontend when its sources change.

# Build the library, the reference website and the tests
dotnet build UmbracoAppHost.slnx

# Run the tests, which boot the reference website on the pinned Umbraco release
dotnet test --project tests/UmbracoAppHost.Tests/UmbracoAppHost.Tests.csproj

# Check and test the frontend
cd Frontend; npm ci; npm run check; npm test; cd ..

# Pack both packages
dotnet pack src/UmbracoAppHost/UmbracoAppHost.csproj -c Release -o artifacts/packages
dotnet pack tests/UmbracoAppHost.Testing/UmbracoAppHost.Testing.csproj -c Release -o artifacts/packages

The repository pins one Umbraco release, so its tests run on that release alone. Three checks run on a developer's machine and never on GitHub. deployment/test-sites.ps1 publishes a build, creates two sites and updates one. deployment/test-downstream.ps1 builds a project in a temporary folder that references the library, and takes an upstream change through the update routine. tests/UmbracoAppHost.ProviderTests runs data sources against PostgreSQL and Oracle when UMBRACOAPPHOST_TEST_POSTGRES, UMBRACOAPPHOST_TEST_ORACLE or UMBRACOAPPHOST_TEST_ORACLE11G holds a connection string.

While their packages are unpublished, the four sibling checkouts build as project references. Each has a switch in src/UmbracoAppHost/UmbracoAppHost.csproj, true by default: UseAppBlocksSource, UseBreakGlassSource, UseIdentityServerSsoSource and UseIdentityServerDirectorySource. With a switch at false, the library references the package at the version in Directory.Packages.props. The CI and Release workflows set all four to false, so they build against nuget.org and fail until those packages are published. Once a package is published, set its version in Directory.Packages.props and its switch to false in the project file. AurorisNet.Umbraco.ApplicationVirtualPathFix and AurorisNet.Umbraco.DisableTelemetry already restore from nuget.org.

When AppBlocks builds from its checkout, the library's project checks that AppBlocks pins the same Umbraco.Cms and Microsoft.Extensions.FileProviders.Embedded releases as Directory.Packages.props, and stops the build with both versions when they differ.

Releases

AppHost follows AppBlocks, together with the Umbraco release that both pin. Dependabot checks NuGet each week and groups Umbraco, uSync and the AurorisNet packages into one pull request. ci.yml tests it and merges it, and weekly-release.yml publishes the week's merged updates as one release. Versions continue the prerelease series: 1.0.0-alpha.1, then 1.0.0-alpha.2. Both packages publish under one version, because the testing package must match the library. The first release waits until AppBlocks, BreakGlass and the two Umbraco IdentityServer packages are on nuget.org. See the release guide.

License

MIT

About

A reusable Umbraco foundation for websites and business applications, with shared themes, authentication, forms, interactive reports, and independent site deployment.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages