Skip to content

External applications and upgrades ​

Use the official template to create an independent application, then update its NuGet/npm dependencies through supported upgrade transitions. This page covers application creation, extension boundaries and the upgrade contract.

New applications include the AI Development Kit. For existing applications, this guide covers the 3.3.0 → 3.4.0 upgrade and the earlier supported transitions.

Create an application ​

From published packages ​

Run these commands in the directory that should contain your new application. The install command selects the latest stable template from NuGet.

sh
dotnet new install NGB.Platform.Templates
dotnet new ngb -n MyApplication
cd MyApplication
node infrastructure/configure.mjs administrator@example.com
node infrastructure/ngb.mjs start

Use .NET 10, Docker Compose v2 and Node 24.19.x. The initializer writes random secrets to an ignored, private .env and refuses to replace an existing file. Open http://localhost:5182, using the configured email and BOOTSTRAP_PASSWORD from the application's .env. Check docker compose ps -a, docker compose logs migrator and http://localhost:5181/health before using the app. The Migrator must exit with code 0. Keycloak is on port 5180 and the worker dashboard is at http://localhost:5184/hangfire.

Starter contents and first login ​

The starter contains API, Migrator, Background Jobs and Vue projects, unit/integration tests, the assembly inspection helper, and AI Kit instructions/skills/references. Its runtime services include Keycloak and PostgreSQL. It provides login, the platform shell, users, roles, permission editing, audit history, Work Center, health endpoints and a real worker. It includes no business vertical, empty extension projects, Watchdog, Seq, MinIO or pgAdmin. platform.schema.validate is the initial registered job. Logs go to stdout. Notes and Attachments are disabled by default; Notes do not require object storage.

From the application directory, docker compose stop stops the local services and docker compose start resumes the existing containers with their saved data. To rebuild and migrate an existing deployment, use the deploy procedure below.

The bootstrap identity has trusted Keycloak role ngb-admin. It works before a platform user exists. Create/link its platform user by email and assign the registered application.administrator role for user-specific Work Center behavior. Active application administrators receive every registered permission, including future permissions. Inactive accounts remain blocked, even with ngb-admin. Changing a role's display name to Administrator grants nothing. Feature flags remain independent of permissions.

Compose is a development deployment: loopback HTTP, Keycloak start-dev, private PostgreSQL and non-root application containers. Production deployments must provide TLS, production Keycloak, protected ingress/dashboard, managed secrets, restricted DB accounts and tested backups. The browser runtime configuration is public. KeycloakSettings:MetadataAddress optionally selects an internal discovery endpoint; it does not change or disable JWT issuer validation.

Grow only when needed ​

ProjectResponsibilityAllowed application references
DefinitionsMetadata, definitions, provider-neutral interfacesNone, or a dedicated abstractions library
RuntimeValidators, handlers, orchestrationDefinitions/abstractions
PostgreSqlSQL, storage adapters, embedded migrationsDefinitions/abstractions
API / Background JobsHTTP/worker compositionDefinitions, Runtime, PostgreSql
MigratorDiscover and execute migration packsPostgreSql migration assembly

Runtime must not reference PostgreSql, Dapper, Npgsql or other concrete database providers. PostgreSql must not reference Runtime. Domain layers must not import hosting projects. Keep direct dependencies explicit. For an executable walkthrough, see Extend an external application.

The template is for new applications. Installing a newer template never rewrites an existing application. Upgrade existing applications through package, configuration and source changes documented for the selected transition.

Public frontend tooling ​

The public entry points include the root, contracts, editor, layout, lazy, navigation, work-center, styles, vite-public-assets and tailwind-preset. Use the packaged declarations and components; avoid private paths and monorepo aliases. The preset extends the current Tailwind 3.4 architecture. PostCSS remains app-owned. The generated Vite configuration installs the public asset plugin, and Tailwind content includes application sources and node_modules/@ngbplatform/ui/src.

js
import ngbPreset from '@ngbplatform/ui/tailwind-preset'

export default {
  presets: [ngbPreset],
  content: ['./index.html', './src/**/*.{vue,js,ts}', './node_modules/@ngbplatform/ui/src/**/*.{vue,js,ts}'],
}

The packed-package gate checks every entry point, declarations, assets, CSS tokens, Vue props/emits/slots, peers, local PostCSS and production compilation outside the workspace. Negative tests prove that incompatible changes fail the checker.

Compatibility and supported transitions ​

Compatibility, certification and support are different promises:

  • Compatibility: existing supported public APIs remain compatible within a major line. Every runtime NuGet package is compared against its first stable version in the major line and the selected previous release. npm contracts are compared with the published previous consumer.
  • Certified transition: the exact source and target versions, app patch and persistent state pass the named runtime profiles.
  • Supported path: the published migration guides identify the transitions users can follow. Adjacent certified steps do not imply a certified direct jump.

For a minor release, select the latest supported patch of the previous supported minor and freeze its exact version. For a patch, select the previous supported patch in that minor. Major upgrades require an explicit source range and migration guide, including manual changes. No promise covers automatic compatibility of every historical application.

The checked-in matrix selects 3.3.0 → 3.4.0. Most runtime packages have 3.0.0 as their major baseline. Attachments, Notes and Attachments.MinIO were first published at 3.1.0. MCP packages start at 3.3.0 and use that published version as their baseline. NGB.Platform.Templates was first published at 3.2.0; assembly compatibility and symbols do not apply to that content package. These exceptions are explicit in packaging/nuget/baselines.json; there are no blanket runtime exemptions.

The tool also retains 3.1.0 → 3.2.0 and 3.2.0 → 3.3.0. Historical matrices, baselines and frozen source fixtures remain unchanged. These adjacent transitions do not register a direct jump from 3.1.0 to 3.4.0.

Migrate 3.3.0 to 3.4.0 ​

Follow the AI Kit upgrade procedure to acquire the exact npm CLI without a platform checkout, preview conflicts and apply coordinated SDK/UI/CLI/Kit changes. Existing root instructions and application custom skills are preserved.

The upgrade validates isolated builds before committing a recoverable transaction. It does not run migrations, start services or introduce the new starter's tests into an existing business application. Integrate application-owned ngb.config.json and test projects explicitly. Run business acceptance and the deployment/backup procedure below against the matching target. Candidate release evidence must also prove preservation of real persisted data, permissions, history and jobs.

Reference-register storage update ​

3.4.0 includes platform migration V2026_11_09_0100__reference_register_recorder_cancellation.sql. It discovers periodic SubordinateToRecorder registers from the application's own metadata, including registers unknown to the platform authors, and adds internal column __is_recorder_cancellation boolean NOT NULL DEFAULT false to existing records tables. Newly created tables receive it through the standard schema service. Independent and nonperiodic registers do not require this column.

Updating NuGet packages or running the SDK/Kit upgrade command does not execute SQL. Use this deployment sequence:

  1. Update and build matching packages for the API, workers and Migrator. Take and verify the consistent backup described in the deployment procedure.
  2. Stop all old API/worker writers and schedule the migration in a maintenance window: adding the column and its constraint acquires table locks.
  3. Run the updated Migrator against the existing application database. Its platform pack applies the migration automatically; application developers do not write a separate migration for each register.
  4. If migration fails, keep the target hosts stopped. A conflicting business or unowned column is reported rather than silently overwritten; inspect it and resolve the conflict before retrying.
  5. After successful migration, start all matching target hosts and check schema health and application acceptance. Do not mix old and new RR readers/writers.

The standard SDK's handler signatures, write/read DTOs and business Values remain unchanged. Custom SQL depending on the complete physical row shape (for example copying SELECT * into an old archive table) needs review. Custom readers and providers must implement the corresponding cancellation semantics; recompiling an old reader alone does not fix its selection algorithm.

The migration preserves every previous field value and treats old rows as unmarked. It cannot safely infer whether an old deletion represented intentional business deletion or automatic cancellation. Previously incorrect current states are not automatically repaired. Investigate a confirmed affected document and use an authorized lifecycle correction, respecting closed-period restrictions; do not bulk-relabel or delete historical records. Trade's price-reader fixes require no Trade-specific schema migration.

Migrate 3.2.0 to 3.3.0 ​

Use the application tool bundled with the 3.3.0 NuGet template for this transition.

The automated tool expects one root .sln/.slnx, a root Directory.Build.props with one unconditional NgbPlatformVersion, NuGet.Config with explicit sources and source mapping, and web/package.json with an exact @ngbplatform/ui dependency. Backend and frontend must both start at 3.2.0. Explicit and centrally managed NGB package versions are supported within that layout. Other layouts, conditional versions and custom version expressions require a reviewed manual migration; the tool refuses them.

From the directory containing your existing MyApplication, install the 3.3.0 template from NuGet and generate the matching tool in a separate directory. Use it to preview the update, then apply the reviewed plan.

sh
dotnet new install NGB.Platform.Templates@3.3.0
dotnet new ngb -n UpgradeTool -o UpgradeTool
node UpgradeTool/infrastructure/ngb.mjs upgrade --app MyApplication --to 3.3.0
node UpgradeTool/infrastructure/ngb.mjs upgrade --app MyApplication --to 3.3.0 --apply

Preview is read-only. Apply validates both builds in an isolated copy before updating dependency files and lockfiles. The tool preserves application source, runtime configuration and secrets. It saves the original files under .ngb/upgrades. Concurrent edits, inconsistent versions and unsupported transitions are rejected. Build validation does not run the application's business tests. Applying does not stop services or run migrations.

  1. Back up PostgreSQL, Keycloak state and optional object storage consistently. Test restore before the maintenance window. Record the current app/configuration and package versions. Stop API and worker writers before target migration.
  2. Review the command's changes: NgbPlatformVersion, direct NGB dependencies and @ngbplatform/ui must resolve to exact 3.3.0. Commit the dependency files and regenerated lockfiles. Preserve application code, data and storage volumes.
  3. Keep existing application configuration and source. For an API container using a public localhost issuer during development, configure the internal MetadataAddress; production still requires a valid trusted issuer. MCP remains opt-in: dependency upgrades alone do not add MCP host composition or enable the endpoint. Follow the MCP opt-in steps below when it is needed.
  4. Build the matching hosts/frontend and run the target Migrator once. Keep API and workers stopped if it fails. Resolve the reported issue and follow the migration's documented retry procedure. Repeating successful migrations must preserve checksums/history and must not duplicate seed data or effects.
  5. Start the target API, worker and frontend. Verify health, login, role/audit flows, pending jobs and the application's own business scenarios before reopening traffic.

After reviewing the dependency diff, testing the app and taking a consistent backup, deploy the generated Compose topology with:

sh
node infrastructure/ngb.mjs deploy --backup-confirmed

For an app without the bundled tool but with the compatible Compose topology, use node /path/to/NGB/ngb.mjs deploy --app /path/to/MyApplication --backup-confirmed. This requires buildable services named api, jobs, web and migrator, with API and jobs depending on successful migration. PostgreSQL and Keycloak must already be running; deploy does not start dependencies. The command builds images, stops writers, runs Migrator and starts hosts only after successful migration. Custom Compose/Kubernetes topologies retain their deployment procedure. An ordinary start refuses existing containers; use docker compose start to resume them. During deploy, Migrator output is streamed to the terminal from a temporary container that is removed afterwards. The migrator service's old logs are not evidence of this deployment; retain the deploy output and check current API/worker health before reopening traffic.

New apps generated at 3.3.0 are already on the target; the 3.2.0 → 3.3.0 upgrade command is not a refresh command for those apps. A future target requires a registered transition and, where specified, a newer CLI. Template installation or dependency upgrade does not replace an existing app's bundled tool or source files.

Do not use down --volumes against application data. Downgrading binaries does not undo database migration. Recovery restores the complete consistent backup set unless the transition publishes and validates a more specific recovery path. Mixed-version workers, rolling deployments and zero-downtime upgrades are outside this upgrade contract.

Opt in to MCP after upgrading ​

An existing application must reference NGB.Platform.Mcp.AspNetCore at the same exact 3.3.0 version as its other platform packages. Add AddNgbMcp(configuration) to the API's service registration and MapNgbMcp() to its endpoint mapping, using the existing authentication and authorization middleware. Set the common Ngb:Hosting:PublicApiUrl and explicitly enable FeatureManagement:Mcp in the API environment. New 3.3.0 templates already contain this composition and default the feature to disabled.

MCP executes authorized reads as the existing user through the API's bearer authentication scheme. See the MCP guide for host composition, user access tokens, HTTPS, local-development settings and supported read tools. The upgrade tool preserves user source and configuration; apply this opt-in explicitly rather than expecting a dependency update to rewrite them.

Migrate 3.1.0 to 3.2.0 ​

This historical transition remains registered in the application tool. Use the 3.2.0 release guide and the corresponding published packages and evidence. Apps starting at 3.1.0 must complete that step before following the 3.2.0 → 3.3.0 instructions above. Historical source fixtures and certification results are not relabelled as 3.3.0.

Certification scope and evidence ​

Five mandatory profiles run outside the repository, using exact packed artifacts, fresh application/package extraction directories, explicit package sources and no workspace/source fallback. Download caches may be shared within the same candidate; the clean-starter profile and registry smoke also use fresh download caches.

ProfileEvidence
clean-starterInstalled template, real login/role lifecycle/audit, admin contract, worker job, health/logs, migration sequencing; no MinIO
generated-extensionFresh generated app plus custom catalog, Runtime validator/handler, PostgreSQL provider and app migration
core-upgradeFrozen published 3.3.0 app upgraded to 3.4.0, maintenance stop, target migration on the same state, preserved data/grants/audit/history, continued custom behavior and queued-job idempotence
notes-upgradeExisting and new Notes, history and authorization; Attachments disabled and no MinIO
attachments-upgradeExisting/new attachment metadata and objects, matching download SHA-256, authorization and private MinIO

The source fixture's files and registry provenance are immutable. Candidate patches are recorded separately. Infrastructure container/volume identities remain constant across each upgrade. The original UI flow runs before the version change; recreating target state is not an upgrade test.

The fixture migration V2026_10_06_0100__certification_checkpoint.sql belongs to the certification app, not to the default starter or platform migration pack. During upgrade certification its Migrator applies it to the disposable certification database on local port 5183 before creating source-version data. The same database is then reused for the target-version migration and preservation checks. The generated-extension profile installs the example's DDL separately. Normal template creation does not create either checkpoint table. Following the extension tutorial intentionally adds them to that application's own database.

The current matrix retains mcp-external, an independent package-only consumer with real Keycloak. MCP platform contract and vertical API host tests belong to the maintainer's manual Backend regression. Historical 3.3.0 evidence retains its original three MCP gates. Upgrade profiles verify explicit MCP opt-in on the preserved application state; their assertions do not turn every existing business feature into a certified external upgrade scenario.

Documents, relationships, accounting, operational/reference registers, reporting and projections retain their broader regression suites. In 3.4.0, the maintainer runs platform and application Backend/Frontend tests and full coverage independently. FULL Certification neither invokes these suites nor requires their reports. These product regressions also remain outside the generic AI Development Kit. The candidate's Compose gate builds the generated starter. It does not build the existing vertical Docker images, including CRM; those have a separate container-build gate after package publication.

quality/external-consumer/matrix.json binds 23 candidate gates and two post-publication gates to commands and assertions. quality-inventory.json classifies measured executable helpers, generated code, static content and process orchestration. Certification retains helper tests and performance-tooling contracts. Four Kit profiles verify artifacts, contracts, the independent application and coordinated upgrades. AI Kit Certification separately verifies real agent results for the sealed candidate. Manual backend/frontend coverage thresholds remain 100%. Certification validates its own candidate-bound tooling/performance and consumer reports without claiming full platform regression or coverage. Process orchestration uses real behavior and failure tests, not synthetic coverage.

Certified package identity ​

Certification records exact NuGet/npm package identities, the frozen source fixture and the upgrade matrix. Registry verification checks published NuGet signatures and canonical payloads and npm integrity. The optional local registry certification also starts a clean consumer restoring only from registries.

The maintainer runs FULL Certification, AI Kit Certification, Backend/Frontend tests and full coverage locally before release. GitHub builds NuGet/npm packages from the release commit, publishes that build's archives and verifies their registry identities. It does not repeat certification or import local packages/reports. Its build manifest records CI provenance, not proof that the separately built local archives have identical bytes.

Released under the Apache License 2.0.