ToolUp.Forms.Core
0.32.0
Prefix Reserved
See the version list below for details.
dotnet add package ToolUp.Forms.Core --version 0.32.0
NuGet\Install-Package ToolUp.Forms.Core -Version 0.32.0
<PackageReference Include="ToolUp.Forms.Core" Version="0.32.0" />
<PackageVersion Include="ToolUp.Forms.Core" Version="0.32.0" />
<PackageReference Include="ToolUp.Forms.Core" />
paket add ToolUp.Forms.Core --version 0.32.0
#r "nuget: ToolUp.Forms.Core, 0.32.0"
#:package ToolUp.Forms.Core@0.32.0
#addin nuget:?package=ToolUp.Forms.Core&version=0.32.0
#tool nuget:?package=ToolUp.Forms.Core&version=0.32.0
ToolUp.Forms
Schema-driven forms, validation, persistence, and a small state-machine workflow primitive for ToolUp.Platform. Companion package — apps that don't import ToolUp.Forms.Server.props / ToolUp.Forms.Client.props pay zero runtime cost.
Phase 21 status (2026-05-05): shipped. 17/17 tests pass; six-rule portability audit clean; strip-imports test verified in both directions.
Phase 21b status (2026-05-06): shipped. Adds Publishable surveys — a token-gated public-write surface so anonymous respondents can submit forms without an account. Seven slices total (substrate → API → embed entry → admin dashboard → multi-survey overview); see "Publishable surveys" below.
What this is
CRUD-heavy domains (intake forms, surveys, multi-step wizards, approval chains) duplicate the same render-and-validate-and-persist loop in every module. ToolUp.Forms collapses that duplication into:
FormSchema— typed declaration of fields, validators, choices. Persists as a versioned Phase 19 entity; per-tenant overrides allowed.Submission— entity-store-backed persistence of completed forms. Indexed by FormId / SubmittedBy / State + compound(FormId, State).WorkflowDefinition— small state machine over named transitions, with name-keyed guards (predicates that can veto a transition) and actions (side-effects after persistence).- Feliz
FormRenderer— schema-driven typed inputs (no per-field handlers); React.useState for in-flight values; only dispatches upward on submit.
Modules become "register a FormSchema + a WorkflowDefinition" instead of "write a render-and-validate-and-persist loop."
Shipped surface (commit-stable across Phase 21):
| Concern | File | Module |
|---|---|---|
| Schema types | Shared/FormSchema.fs |
FormSchemaId, FieldKind, ValidationRule, FieldSchema, FormSchema |
| Submission types | Shared/FormSubmission.fs |
SubmissionId, FieldValue, SubmissionState, Submission, FieldError, FormError |
| Workflow types | Shared/Workflow.fs |
WorkflowState, WorkflowId, Transition, WorkflowDefinition |
| Wire contract | Shared/FormApi.fs |
IFormApi (ToolUp.Remoting) |
| Server interface | Server/IFormStore.fs |
IFormStore — six-rule portable |
| Server interface | Server/IWorkflowEngine.fs |
IWorkflowEngine, WorkflowGuard, WorkflowAction — six-rule portable |
| Entity registrations | Server/EntityRegistrations.fs |
formSchemaRegistration, submissionRegistration |
| Default impls | Server/FormStore.fs, Server/WorkflowEngine.fs |
over IEntityStore (Phase 19) + IAuditLog (Phase 9) |
| Validation | Server/FormValidator.fs |
validate, CustomValidator, CustomValidatorRegistry |
| API handler | Server/FormApiHandler.fs |
formApi ToolUp.Remoting handler with Owner/Admin gating |
| Compose pipeline | Server/FormsCompose.fs |
FormsServerApp record + run, DefaultedFormStore decorator |
| Client renderer | Client/FormRenderer.fs |
FormRenderer Feliz component |
| Client list | Client/FormSubmissionsList.fs |
FormSubmissionsList table |
| Client badge | Client/WorkflowBadge.fs |
WorkflowBadge pill |
| Client proxy | Client/FormsClient.fs |
proxy: IFormApi |
| Phase 21b — public-form wire | Shared/PublicFormApi.fs |
IPublicFormApi (token-gated) |
| Phase 21b — public-form handler | Server/PublicFormApiHandler.fs |
publicFormApi over IShareTokenStore |
| Phase 21b — preflight validator | Server/PublishableFormConfigValidator.fs |
warns on Publishable-without-PublicBaseUrl |
| Phase 21b — aggregation | Shared/AggregationTypes.fs, Server/Aggregations.fs |
AggregationSummary, per-kind helpers |
| Phase 21b — analyser stub | Server/IFormSubmissionAnalyser.fs |
reserved extension point — no default impl |
| Phase 21b — embed entry | Client/PublicFormsClient.fs, Client/PublicEmbed.fs |
standalone /r/{token} Feliz component |
| Phase 21b — admin views | Client/SurveyDashboardView.fs, Client/SurveyListView.fs |
per-survey + multi-survey stateless components |
Why a companion, not core SDK
Forms are a domain capability, not platform substrate. Nothing else in the SDK depends on IFormStore. Analytics-only deployments never need forms — charging them the binary weight is wrong-by-default. Same rationale as ToolUp.AI / ToolUp.RAG / ToolUp.KnowledgeBase / ToolUp.Scheduling not living in ToolUp.Platform.
The companion is a consumer of substrate (IEntityStore Phase 19, IAuditLog Phase 9, optionally INotificationSink Phase 6f for transition notifications), not substrate itself.
How to enable
In your server .fsproj:
<Import Project="..\ToolUp.Forms\ToolUp.Forms.Server.props" />
<ProjectReference Include="..\ToolUp.Forms\ToolUp.Forms.fsproj" />
In your client .fsproj:
<Import Project="..\ToolUp.Forms\ToolUp.Forms.Client.props" />
In your server's composition root:
open ToolUp.Forms.FormsCompose
let bugReportSchema = FormSchema.create "bug-report" "Bug report" [
{ Key = "title"; DisplayName = "Title"; Description = None;
Kind = TextField (Some 200); Required = true; Validators = [] }
{ Key = "severity"; DisplayName = "Severity"; Description = None;
Kind = ChoiceField [ "Minor"; "Major"; "Critical" ]; Required = true; Validators = [] }
]
let triageWorkflow = {
Id = "bug-triage"
InitialState = "new"
Transitions = [
{ From = "new"; Event = "triage"; To = "triaged"; Guard = None; Action = None }
{ From = "triaged"; Event = "close"; To = "closed";
Guard = Some "severity-major-or-critical"; Action = None }
]
}
let severityGuard : WorkflowGuard = fun (submission, _ctx) -> async {
match Map.tryFind "severity" submission.Values with
| Some (ChoiceValue v) when v = "Major" || v = "Critical" -> return Ok ()
| _ -> return Error "Only Major or Critical bugs can be closed."
}
let config = { ServerConfig.defaults with
Port = 5000; Surfaces = Surfaces.team
EntityStore = EnabledEntityStore } // REQUIRED — Forms rides on Phase 19
[<EntryPoint>]
let main _ =
FormsServerApp.create ()
|> FormsServerApp.withConfig config
|> FormsServerApp.withAuth (StaticJwtAuthProvider(...))
|> FormsServerApp.withFormSchema bugReportSchema
|> FormsServerApp.withWorkflow triageWorkflow
|> FormsServerApp.withGuard "severity-major-or-critical" severityGuard
|> FormsServerApp.run
The Forms API is mounted at /api/IFormApi/* once FormsServerApp.run boots. Client code calls it via FormsClient.proxy.
How to define a custom validator
Custom predicates ride a server-side registry keyed by name (closures don't cross Fable serialization, so the Shared layer carries names only).
let isStaffEmail : CustomValidator = fun raw ->
if raw.EndsWith "@example.com" then Ok ()
else Error "Email must be on the example.com domain."
// In the compose root:
|> FormsServerApp.withCustomValidator "staff-email" isStaffEmail
// In the schema:
{ Key = "email"; DisplayName = "Work email"; Description = None;
Kind = TextField None; Required = true;
Validators = [ Custom "staff-email" ] }
How to define a workflow guard / action
Same name-keyed pattern as custom validators. Guards veto transitions; actions run after persistence (best-effort, failures logged not rolled back).
let notifyApprover : WorkflowAction = fun (submission, _ctx) -> async {
// ...send email / SMS / push notification...
do! someTransactionalSink.Send (...)
}
|> FormsServerApp.withAction "notify-approver" notifyApprover
Publishable surveys (Phase 21b)
A FormSchema with Visibility = Publishable is a survey — distributable to anonymous respondents via signed share-link tokens. The substrate handles invitation issuance, embed-page rendering, response aggregation, and the multi-survey admin loop. Apps that don't issue tokens leave Visibility = Internal (the default) and pay nothing for the public-form surface.
End-to-end flow:
Author the schema — flip
Visibility = Publishableon aFormSchemaandSaveSchema. Per-tenant configurable so a deployment can carry a global default schema (FormsServerApp.withFormSchema) and let teams override it.Issue invitations —
IFormApi.IssueTokens(Owner/Admin gated) takes a list of opaque recipient handles and returns(handle, tokenId, url, expiresAt)rows. Three real-world distribution flows:- Platform dispatches email —
IFormApi.DispatchInvitationsByEmail(slice 6, optional). Requires a transactional sink (ServerApp.withTransactionalSink); writes ephemeralrespondent:{tokenId}address-book entries so PII never crosses the notification wire. - Creator dispatches via own MTA — call
IssueTokensand ship the returned URLs through your own mailing system. Platform sends nothing. - Third-party survey provider with no panel-id sharing — hash panel ids client-side, call
IssueTokenswith the hashes as opaque handles, hand the resulting CSV to the third-party provider. Platform never sees real emails or panel ids.
- Platform dispatches email —
Respondents submit — embed URL is
{PublicBaseUrl}/r/{token}. The host application'sClient.fschecksToolUp.Forms.PublicEmbed.isEmbedUrland renders the standalonePublicEmbedcomponent instead of the authenticated app shell. No sidebar, no auth UI; just a branded header (ClientConfig.AppName) and the form.Creator monitors progress —
IFormApi.GetAggregations schemaIdreturns response counts, response rate, per-question roll-ups (mean/median/stddev for numeric, vote counts for choice, sample for text), and the recipient progress table.SurveyDashboardViewis the matching stateless Feliz component.Multi-survey admin —
IFormApi.ListSchemasOverviewreturns every survey in scope with status (Draft/Active/Closed) and metric summaries in one call.SurveyListViewis the matching stateless Feliz component.IFormApi.CloseSurveycloses a survey by flippingVisibilitytoInternal, bulk-revoking outstanding tokens, or both.
Required substrate:
ServerConfig.ShareTokenStore = EnabledShareTokenStore— the SDK's HMAC-signed token primitive (Phase 21b slice 1)ServerConfig.PublicBaseUrl = Some "https://your-host.example.com"— forIssueTokensURL compositionServerConfig.AnonymousRoutePrefixesincludes/api/public/forms/—FormsComposeregisters this automatically- Optional:
ServerApp.withTransactionalSink (...)ifDispatchInvitationsByEmailis wanted
The PublishableFormConfigValidator runs at startup and emits a Warning if Publishable schemas are registered but PublicBaseUrl is unset or ShareTokenStore is disabled.
Security posture: every token is HMAC-SHA256-signed against a key auto-resolved from ISecretStore under _platform/share_token_signing_key. The persisted ShareTokenClaim is the source of truth; a valid signature alone isn't sufficient (revocation is server-side). PublicFormApiHandler re-checks Visibility = Publishable on every request, so flipping a schema back to Internal instantly invalidates every outstanding token without per-token bookkeeping. Per-token rate limiting partitions on sha256(token)[..16] so one respondent can't saturate the public endpoint.
The IFormSubmissionAnalyser extension point is reserved for sentiment / NLP companions but the SDK ships no default implementation — a planned analyser companion + persistent results is a tracked follow-up.
What's not in v1
See TECHNICAL_GUIDE.md "Departures from the design spec" for the full list. Headlines:
- Drag-drop form designer UI (Phase 26 follow-up)
- Conditional field visibility ("show field B only if field A == X")
- Computed fields (
field C = field A + field B) - Server-side rendering / static-export (
HTML emit) - Multi-step wizards (model as separate forms with workflow transitions between them)
- AI-backed sentiment / NLP analyser companion (Phase 26 — extension point ships in Phase 21b, no default impl)
- Persistent analyser outputs (Phase 26 — currently computed on-demand by
GetAggregations)
See also
TECHNICAL_GUIDE.md— design decisions, six-rule portability audit verdict, strip-imports test record, departures from specsrc/ToolUp.Forms.Tests/—IFormStoreContract(9),IWorkflowEngineContract(7), worked-example test (1)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- ToolUp.Platform.Core (>= 0.32.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on ToolUp.Forms.Core:
| Package | Downloads |
|---|---|
|
ToolUp.Forms.Server
ToolUp.Forms Server — schema-driven form persistence (IFormStore + BlobFormStore), state-machine workflow engine, validator, public-form API + share-link tokens, FormsCompose. Depends on ToolUp.Platform.Server + ToolUp.Forms.Core. |
|
|
ToolUp.ContentAuthoring
CMS authoring bridge for ToolUp (Phase 89): a content type is a ToolUp.Forms FormSchema, a content entry is a Submission, and publishing projects a validated submission to a ToolUp.PublicRendering PublicPage with a Narrative body. Forms is consumed unforked — validation comes straight from the Forms engine. Opt-in companion so PublicRendering / Forms consumers that don't author content pay nothing. |
|
|
ToolUp.Forms.Client
ToolUp.Forms Client — schema-driven Feliz components (FormRenderer, WorkflowBadge, FormSubmissionsList, public-form embed, survey dashboard + list views). Depends on ToolUp.Platform.Client + ToolUp.Forms.Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.45.0 | 53 | 12/2/2026 |
| 0.44.0 | 101 | 12/1/2026 |
| 0.43.1 | 113 | 11/28/2026 |
| 0.43.0 | 132 | 11/25/2026 |
| 0.42.1 | 125 | 11/16/2026 |
| 0.41.0 | 129 | 11/7/2026 |
| 0.40.0 | 129 | 11/6/2026 |
| 0.39.0 | 127 | 11/4/2026 |
| 0.38.1 | 140 | 11/1/2026 |
| 0.38.0 | 131 | 10/31/2026 |
| 0.37.0 | 130 | 10/29/2026 |
| 0.36.0 | 127 | 10/29/2026 |
| 0.35.0 | 127 | 10/28/2026 |
| 0.34.1 | 127 | 10/27/2026 |
| 0.34.0 | 129 | 10/26/2026 |
| 0.33.0 | 128 | 10/25/2026 |
| 0.32.0 | 132 | 10/24/2026 |
| 0.31.0 | 126 | 10/22/2026 |
| 0.30.0 | 119 | 10/20/2026 |
| 0.29.0 | 129 | 10/19/2026 |