Server applications and hosting
Elsa provides two web application shapes for running workflow features: a standard server with a fixed feature set and a modular server that loads feature packages at startup. A separate load balancer can place several server instances behind one address, while hosting management helps those instances detect liveness in a shared deployment. Together, these applications compose Elsa capabilities during startup and expose them through HTTP.
Application shapes
The server applications share the same goal: provide a running host for workflow management, workflow execution, HTTP triggers, identity, persistence, and operational views. They differ in how the feature set is selected.
| Application | Feature model | Primary use |
|---|---|---|
| Standard server | A fixed set of Elsa modules is composed in application code. | A ready-to-run workflow server with a known feature set. |
| Modular server | Shell features are composed from the host and active packages. | A server that can add or change features through packages. |
| Load balancer | HTTP requests are forwarded to configured server destinations. | One entry point for several server instances. |
The server composition page explains the broader feature model. This page focuses on the applications that turn that model into a running web host.
Standard server
The standard server is a reference Elsa host for workflow design and execution. At startup it composes identity, tenant resolution, workflow management, workflow runtime, scheduling, scripting, HTTP workflow support, dashboards, and the workflow API into one application (src/…/Program.cs• L46-159). The host also enables distributed workflow runtime support and can apply separate ingress limits to the workflow API and HTTP workflow traffic (src/…/Program.cs• L89-97, src/…/Program.cs• L177-215).
The host also supplies the web behavior around those features. It exposes workflow and health endpoints, applies authentication and authorization, resolves tenants, handles workflow requests, and can apply ingress limits to API and HTTP workflow traffic (src/…/Program.cs• L218-279). Readiness checks include Elsa services and distributed locks, so deployment systems can distinguish a live process from a server ready to handle workflow work (src/…/Program.cs• L213-215, src/…/Program.cs• L230-243). The result is a single application that can receive workflow requests and give operators and designers access to workflow state.
The standard server uses SQLite in its reference setup and includes example workflow definitions that are copied to the running application (src/…/Program.cs• L82-101, src/apps/Elsa.Server.Web/Elsa.Server.Web.csproj#L31-L45). Its configuration also demonstrates tenant-specific HTTP paths and shared persistence settings (src/…/appsettings.json• L15-67). A namespaced ClassicServerHost marker also lets component tests boot this host without ambiguity when they reference both server shapes (src/…/ClassicServerHost.cs• L5-12).
References: src/…/Program.cs• L46-159 src/…/Program.cs• L177-215 src/…/Program.cs• L218-300 src/…/appsettings.json• L15-107 src/…/Elsa.Server.Web.csproj• L1-45 src/…/ClassicServerHost.cs• L5-12
Modular server
The modular server is a package-driven Elsa host. It loads active packages from configured directory feeds, obtains feature assemblies from the package set, and gives those assemblies to the shell system that builds the application (src/…/Program.cs• L59-92, src/…/NuplaneAssemblyProvider.cs• L8-14). A package can therefore add a service or an HTTP endpoint without changing the host application.
The host configures a base set of workflow, identity, runtime, dashboard, authentication, secret, and diagnostic features for every shell. It then maps shell endpoints and starts package loading as part of the web application's startup (src/…/Program.cs• L70-107). Package changes are observed and reported through MyPackageObserver, which gives operators a signal when a package changes or fails to load (src/…/MyPackageObserver.cs• L7-25).
The sample package shows the package contract at a small scale. SampleFeature registers a service, while SampleEndpointFeature depends on it and maps /sample-endpoint; this demonstrates how a package joins service setup and endpoint setup into the shell lifecycle (src/…/SampleFeature.cs• L7-14, src/…/SampleEndpointFeature.cs• L12-28). The modular server also exposes sample catalog routes for active packages, load state, assemblies, and discovered plugin types (src/…/SampleCatalogEndpointExtensions.cs• L6-39).
The modular configuration can describe more than one shell. Each shell can have its own route path, feature set, and persistence settings, so one process can present separate application surfaces (src/…/appsettings.Example.json• L21-81).
References: src/…/Program.cs• L32-107 src/…/NuplaneAssemblyProvider.cs• L8-14 src/…/MyPackageObserver.cs• L7-25 src/…/SampleCatalogEndpointExtensions.cs• L6-39 src/…/SampleFeature.cs• L7-14 src/…/SampleEndpointFeature.cs• L12-28 src/…/appsettings.Example.json• L21-81
Load balancing
The load balancer is a thin HTTP gateway. It accepts a request, selects a destination from a configured cluster, and forwards the request to that server instance using a round-robin policy (src/…/Program.cs• L1-5, src/…/appsettings.json• L9-33). It does not compose Elsa workflow features itself.
This separation lets the standard or modular server own workflow state and behavior while the gateway presents one public address. The configured destinations must therefore point to compatible server instances that can serve the same routed paths and share the state or transport setup required by the deployment.
References: src/…/Program.cs• L1-5 src/…/appsettings.json• L9-33
Hosting management
Hosting management gives a distributed Elsa deployment a shared view of running application instances. The clustering feature starts one service that writes a timestamp for its instance and another that checks all timestamps for expiry (src/…/ClusteringFeature.cs• L14-59, src/…/InstanceHeartbeatService.cs• L13-71, src/…/InstanceHeartbeatMonitorService.cs• L15-90).
The monitor uses a distributed lock so only one instance performs the check at a time. When an instance misses its timeout, the monitor sends a HeartbeatTimedOut notification and removes the old record (src/…/InstanceHeartbeatMonitorService.cs• L61-89). Other Elsa services can use that notification to react to a lost host without each server making the same decision independently.
Each process needs an instance name. The name can be configured directly or read from an environment variable; a stable and unique name lets per-instance transport resources survive restarts without creating a new resource each time (src/…/ApplicationInstanceOptions.cs• L5-44, src/…/ConfiguredApplicationInstanceNameProvider.cs• L9-70). If no stable name is available, the provider falls back to a random name.
The feature is opt-in through UseApplicationCluster. Hosts that enable it must provide the shared key-value store and distributed lock services that the heartbeat services use (src/…/ModuleExtensions.cs• L7-16).
References: src/…/ClusteringFeature.cs• L14-59 src/…/InstanceHeartbeatService.cs• L13-71 src/…/InstanceHeartbeatMonitorService.cs• L15-90 src/…/ApplicationInstanceOptions.cs• L5-44 src/…/ConfiguredApplicationInstanceNameProvider.cs• L9-70 src/…/ModuleExtensions.cs• L7-16
Startup composition
Application startup turns a host choice into a running Elsa surface. The standard server registers a fixed feature graph before it builds the web app. The modular server first establishes package and shell sources, then applies shell features and maps the resulting endpoints.
The main startup relationships are:
flowchart LR
Config[Host configuration] --> Shape{Server shape}
Shape --> Standard[Standard server]
Shape --> Modular[Modular server]
Standard --> Elsa[Elsa services and workflow features]
Modular --> Packages[Active feature packages]
Packages --> Shells[Shell feature composition]
Shells --> Elsa
Elsa --> Web[HTTP endpoints and workflow runtime]
Web --> Gateway[Optional load balancer]
Gateway --> Instances[Server instances]
Elsa -. optional .-> Hosting[Hosting management]
Hosting --> Heartbeats[Shared instance liveness]
The standard path is direct: application code selects Elsa features, then the web pipeline exposes their APIs and workflow triggers. It also adds health and readiness surfaces plus optional request limits around those entry points (src/…/Program.cs• L177-279). The modular path adds a package and shell stage, which allows the same host to assemble different feature sets from configuration and active package content (src/…/Program.cs• L58-159, src/…/Program.cs• L61-107).
For HTTP workflow behavior, the application host is the outer boundary and Elsa's HTTP integration supplies the workflow-facing request path. See workflow HTTP integration for the request and response behavior inside that boundary.
References: src/…/Program.cs• L46-159 src/…/Program.cs• L177-279 src/…/Program.cs• L32-107 src/…/Program.cs• L1-5 src/…/ClusteringFeature.cs• L45-59
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to the standard server feature registration must stay aligned with the endpoint and middleware stages that expose those features.
- Changes to modular shell feature names or package loading must stay aligned with shell configuration and package manifest discovery.
- Changes to server route prefixes or shell paths must stay aligned with load balancer routes and external workflow trigger URLs.
- Changes to application instance naming must preserve both restart stability and uniqueness across live instances.
- Changes to heartbeat storage or lock behavior must preserve a single monitor decision across all server instances.
- Changes to readiness checks or ingress rate-limit policy names must stay aligned with deployment health probes and the endpoint options that consume those policies.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A modular package fails to load. | Its features are absent from the shell and package-dependent routes do not work. | Monitor package load failure logs from MyPackageObserver. |
| A shell route path or API prefix differs from the gateway route. | Requests reach the wrong surface or return not found. | Keep shell routing, workflow API prefixes, and reverse-proxy paths consistent. |
| An ingress policy is selected but its policy is not registered. | API or HTTP workflow requests can fail before reaching workflow handling. | Keep ingress settings, policy registration, and endpoint policy names aligned. |
| Several live instances use the same configured instance name. | Per-instance transport resources can collide. | Use a name that is stable across restarts but unique for each live instance. |
| A distributed host lacks a shared lock or key-value store. | Heartbeats cannot coordinate or the monitor cannot identify stale instances. | Enable hosting management only with shared storage and lock services. |
| No server destination is healthy behind the gateway. | The public entry point cannot serve workflow requests. | Keep the destination list aligned with live standard or modular servers. |
Key files
| File | Why to read it |
|---|---|
| src/…/Program.cs | Shows the fixed feature set, request controls, health surfaces, and web pipeline for the standard server. |
src/apps/Elsa.Server.Web/Elsa.Server.Web.csproj | Shows the standard server's workflow sample assets and module-level feature dependencies. |
| src/…/appsettings.json | Shows the reference tenant, HTTP, identity, scripting, and persistence shape. |
| src/…/Program.cs | Shows package loading, shell composition, diagnostics, and endpoint startup. |
| src/…/appsettings.Example.json | Shows how multiple shells can use different routes and feature settings. |
| src/…/SampleFeature.cs | Shows how a package adds a service to a shell. |
| src/…/SampleEndpointFeature.cs | Shows how a package adds an endpoint with a feature dependency. |
| src/…/Program.cs | Shows the gateway boundary around Elsa server instances. |
| src/…/appsettings.json | Shows cluster destinations and request distribution. |
| src/…/ClusteringFeature.cs | Shows how host liveness services enter the Elsa module lifecycle. |
| src/…/InstanceHeartbeatMonitorService.cs | Shows how stale instances are detected and announced. |
| src/…/ConfiguredApplicationInstanceNameProvider.cs | Shows the rules for stable per-instance identity. |