Server composition and integration surface
Elsa is hosted as an ASP.NET Core web application that combines workflow services with several external interfaces. A host can expose workflow authoring and runtime control through a REST API, receive or send work through HTTP and webhooks, stream execution changes to clients, and provide dashboard data for operations. The host chooses which interfaces to enable.
Hosting model
Application hosts
An Elsa application host assembles the workflow engine, workflow management, runtime, storage, security, and web-facing features into one process. The standard server enables the workflow API, dashboard API, runtime dashboard, and HTTP workflow handling. The modular server uses shells and package loading so that the same web process can compose platform, dashboard, diagnostics, authentication, and workflow features as separate host capabilities. See Server applications for the application-level composition model.
The two hosts serve different deployment goals:
- The standard server is a direct Elsa server with a fixed feature set and sample configuration.
- The modular server is a platform host that can load and change feature packages through its shell model.
References: src/…/Program.cs• L46-159 src/…/Program.cs• L34-111
Feature boundaries
Each integration is an optional host capability. Enabling a feature adds its workflow-facing services and endpoints; mapping its application component makes the interface reachable through ASP.NET Core. This keeps a host from exposing routes that it has not chosen to support.
The main capability groups are:
| Capability | Main purpose | Typical consumer |
|---|---|---|
| Workflow API | Manage definitions and instances, and start or control work | Elsa Studio or an external service |
| Real-time updates | Stream execution and log changes for an observed instance | Elsa Studio or an operator tool |
| HTTP workflows | Turn inbound HTTP requests into workflow starts or resumes | Business systems and browsers |
| Webhooks | Turn provider events into workflow stimuli | External event providers |
| Dashboard API | Return operational summaries and findings | Operational dashboard clients |
| API client | Give .NET callers typed access to the REST surface | .NET applications |
References: src/…/WorkflowsApiFeature.cs• L18-47 src/…/HttpFeature.cs• L34-39 src/…/WebhooksFeature.cs• L11-18 src/…/DashboardApiFeature.cs• L6-19
Server interfaces
Workflow API
The workflow API is the control surface for workflow definitions and workflow instances. It supports the lifecycle that a client needs to author, inspect, publish, execute, dispatch, cancel, export, and import workflows. Its endpoints use permissions that separate read access from changes and execution, while read-only hosts can block write operations.
The API also supplies the data needed by a workflow designer and operator view. Definition resources expose versions, graphs, references, and import or export operations. Instance resources expose state, journals, variables, execution state, and lifecycle actions. The route prefix is host-configurable, so clients must use the host's configured API base rather than assume a fixed deployment path.
flowchart LR
Client[Designer or service client] --> API[Workflow REST API]
API --> Definitions[Workflow definitions]
API --> Instances[Workflow instances]
API --> Runtime[Workflow runtime]
Definitions --> Runtime
References: src/…/WorkflowsApiFeature.cs• L21-47 src/…/Program.cs• L248-256 src/…/IWorkflowDefinitionsApi.cs• L15-24 src/…/IWorkflowInstancesApi.cs• L13-27
Real-time updates
The real-time surface lets an authenticated client observe one workflow instance and receive progress without polling. A client joins an instance-specific group after the server checks workflow-instance read permission and tenant access. The server then sends activity execution events, activity-log changes, workflow-log changes, and instance updates to that group.
SignalR support is optional. The feature registers the real-time service, but the host must map the hub before clients can connect. The standard sample host currently keeps this mapping disabled until its client authentication flow is ready.
sequenceDiagram
participant C as Client
participant H as Workflow instance hub
participant R as Workflow runtime
C->>H: Observe instance
H-->>C: Access granted or denied
R-->>H: Instance or execution change
H-->>C: Instance-group update
References: src/…/WorkflowInstanceHub.cs• L14-74 src/…/BroadcastWorkflowProgress.cs• L12-20 src/…/IWorkflowInstanceClient.cs• L8-44 src/…/ApplicationBuilderExtensions.cs• L10-15 src/…/Program.cs• L35-39 src/…/Program.cs• L287-291
HTTP workflows
The HTTP integration turns an HTTP request into workflow input or a workflow resume signal. It matches the request method and path against indexed workflow triggers first. If no new trigger matches, it looks for a saved bookmark so a waiting workflow can continue. Requests outside the configured workflow base path pass to the rest of the web application.
This makes HTTP both an ingress path and a workflow activity surface. Workflows can receive request data, return an HTTP response, and call other HTTP services. Hosts can also apply authentication, request time limits, and rate limits at this boundary. See Workflow HTTP integration for the workflow-facing transport behavior.
flowchart TD
Request[Inbound HTTP request] --> Gate[Base path and ingress gate]
Gate --> Match[Match method and route]
Match -->|Trigger| Start[Start workflow]
Match -->|Bookmark| Resume[Resume waiting workflow]
Match -->|No match| Next[Continue web pipeline or return not found]
Start --> Response[Workflow HTTP response]
Resume --> Response
References: src/…/HttpWorkflowsMiddleware.cs• L26-138 src/…/HttpFeature.cs• L130-159 src/…/ApplicationBuilderExtensions.cs• L13-44 src/…/Program.cs• L135-139 src/…/Program.cs• L258-264
Webhook ingress
The webhook integration accepts provider events through a shared webhook endpoint and maps each event type to the webhook source that owns it. A matching source produces a workflow notification, which makes the event available to workflows through a webhook trigger. An event with no configured source is accepted without starting work.
Webhook sources define which provider event types are meaningful to Elsa. The integration can expose those event types as workflow activities, so workflow authors select a provider-specific trigger while the server keeps provider routing at the edge.
References: src/…/Endpoint.cs• L11-40 src/…/WebhooksFeature.cs• L61-78 src/…/WebhookEventActivityProvider.cs• L8-18 src/…/WebhookEventReceived.cs• L13-47
Dashboard API
The dashboard API is a read-only operational surface for runtime health and workflow activity. It returns overview metrics, trends, recent activity, attention items, and workflow hotspots under /dashboard/*. Dashboard data is composed from feature-owned contributors, so a host can add diagnostics or other panels without changing the dashboard's core contract.
The dashboard treats optional data sources as separate capabilities. A missing or failing diagnostic provider does not prevent workflow metrics or runtime status from appearing. Clients should therefore treat unavailable dashboard panels as a supported state rather than as proof that the server is down.
References: src/…/README.md• L1-40 src/…/README.md• L63-90 src/…/Endpoint.cs• L9-23 src/…/DashboardApiFeature.cs• L8-19
Client integration
REST API clients
The .NET API client turns the REST contract into typed resource clients for definitions, instances, execution, descriptors, identity, shells, and other server features. A caller supplies the Elsa server base address and can use an API key or a custom authentication handler. The client also supports HTTP client customization and retry behavior so it can fit into the caller's service setup.
The client is a consumer of the server contract. It does not enable server features, so a client call can fail when the target host did not install the matching feature or when the caller lacks the required permission. This distinction is important for modular hosts, where the available API surface can differ between deployments.
References: src/…/DependencyInjectionExtensions.cs• L42-101 src/…/ElsaClientOptions.cs• L6-21 src/…/ElsaClientBuilderOptions.cs• L11-47 src/…/IWorkflowDefinitionsApi.cs• L15-24 src/…/IWorkflowInstancesApi.cs• L13-19
Integration flow
The server's integration surface connects external requests and operator tools to the same workflow definitions and runtime. The entry path differs by interface, but each path ends in workflow state, runtime work, or a client-visible result.
flowchart LR
External[HTTP or webhook event] --> Ingress[Ingress integration]
Operator[Studio or API client] --> Control[Workflow API]
Ingress --> Runtime[Workflow runtime]
Control --> Runtime
Runtime --> Store[Definitions and instances]
Runtime --> Updates[Optional real-time updates]
Store --> Dashboard[Dashboard summaries]
Updates --> Operator
Dashboard --> Operator
Boundary selection
Use the interface that matches the source and purpose of the interaction:
- Use the workflow API for control, authoring, inspection, and lifecycle actions.
- Use HTTP triggers when a request must start or resume a workflow and receive a workflow response.
- Use webhooks when an external provider publishes typed event notifications.
- Use real-time updates when a client needs live progress for a known instance.
- Use the dashboard API for read-only operational views.
- Use the .NET API client when a .NET service needs typed access to the REST surface.
References: src/…/Program.cs• L97-139 src/…/Endpoint.cs• L18-39 src/…/ApplicationBuilderExtensions.cs• L10-15 src/…/README.md• L5-61
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the host feature registration and its ASP.NET Core route mapping aligned. A registered capability without mapping is not externally reachable.
- Keep workflow API route changes aligned with the typed contracts in
Elsa.Api.Client; the client uses literal route templates. - Keep real-time event names and instance-group behavior aligned between
IWorkflowInstanceClient, the hub, and the broadcast handler. - Keep HTTP workflow base-path and rate-limit settings aligned. The middleware match boundary and the rate-limit boundary must protect the same ingress paths.
- Keep webhook event-type registration aligned with the generated workflow trigger activities and the source matching rules.
- Keep dashboard capability states and contributor behavior aligned with clients that render optional panels.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A host enables an API feature but does not map its endpoints | Clients receive missing-route responses even though services are registered | Treat feature registration and application mapping as one host change |
| An HTTP request matches more than one trigger or waiting bookmark | The server returns an ambiguity error instead of choosing a workflow | Keep route and method combinations unique |
| A request reaches HTTP workflow ingress while the runtime is paused or draining | New work is rejected with 503 Service Unavailable | Use the readiness and quiescence signals before sending new work |
| A real-time client observes an instance without read permission or tenant access | The hub rejects the observation | Authenticate the client and grant the workflow-instance read permission for its tenant |
| A webhook event has no configured source | The event is accepted but no workflow starts | Register the provider source and its event type before relying on the event |
| A dashboard contributor or diagnostic provider cannot return data | One dashboard capability is unavailable while other panels can still load | Render capability state and preserve the available parts of the response |
| A client targets routes not installed by a modular host | The typed client call cannot complete against that deployment | Check host feature availability before using optional resource clients |
Key files
| File | Why to read it |
|---|---|
| src/…/Program.cs | Shows how a direct Elsa web host selects workflow, API, dashboard, HTTP, security, and health capabilities. |
| src/…/Program.cs | Shows how the modular host composes shell features and loaded packages. |
| src/…/WorkflowsApiFeature.cs | Defines the workflow REST API boundary and its relationship to management and runtime services. |
| src/…/HttpWorkflowsMiddleware.cs | Shows the high-level request-to-start or request-to-resume workflow path. |
| src/…/Endpoint.cs | Shows how external webhook events enter Elsa and become workflow notifications. |
| src/…/WorkflowInstanceHub.cs | Defines the secured real-time observation boundary for workflow instances. |
| src/…/README.md | Describes dashboard capabilities, optional data states, and extension boundaries. |
| src/…/DependencyInjectionExtensions.cs | Shows how .NET callers obtain typed clients for the server REST surface. |