DSL compiler never distributed — consumers receive precompiled JS bundles only
decisionactive
owner: philip · updated 2026-11-14
relates: edge-via-seam
DSL compiler never distributed — consumers receive precompiled JS bundles only
Context
- The form/application DSL (qform/qapp, UIForm DSL v2) and its compiler are core IP; the compiled JavaScript runtime is the distributable artifact.
- Distribution targets include third-party sites embedding forms (JotForm-style model) and client workspaces — neither should ever receive DSL source or the compiler.
- The submission endpoint is already a seam (works standalone or serverless, env-selected adapters).
- Edge distribution (Cloudflare Pages/R2) serves static assets at $0 egress behind the
edge-via-seam seam.
Decision
- The DSL→JS compiler, DSL schemas, and DSL source of every form stay server-side in the repo; they are never shipped to consumers or embed targets.
- Consumers receive only precompiled, self-contained JS bundles (render + validate + collect + submit). Bundles carry no DSL text, no compiler, no build tooling.
- Bundles are produced at build time in CI and distributed as static assets via the edge seam (Pages/R2), versioned by content hash.
- Bundle updates are atomic: a new bundle version is published alongside its submission-endpoint contract version; the endpoint accepts only contracts it knows.
- Obfuscation is not a substitute: the protection is that the compiler and DSL never leave the repo, not that the bundle is unreadable.
Consequences
- Form changes require a recompile + redeploy of the bundle; consumers cannot self-modify forms (by design).
- The bundle must be fully self-contained: inlined runtime, no runtime fetch of DSL or compiler assets.
- Source maps must not be published with bundles (they would reconstruct the compiler's output structure).
- The submission contract (payload schema, upload flow) becomes the public API — versioned and documented; the DSL stays private.
- Hot-fix path: an urgent form fix is a new bundle version through CI, same as any release.
Sources
- factory/AGENTS.md (dual deployment, store adapters)
- knowledge-base/decisions/edge-via-seam.md
- forms/form-engine, forms/form-edit-custom, app-builder UIForm DSL v2