Published on

Formly

avatar for Jigar PatelJigar Patel
2 min read

Context

Formly is a private repository (jpatel98/Formly) focused on building form experiences without rebuilding backend logic per form. The goal is to let teams ship validated workflows with versionable schema artifacts and predictable operational behavior.

Architecture

  • Schema registry + validator pipeline
    • Canonical JSON Schema stored with semantic versioning.
    • Backward-compatible migration metadata per schema revision.
  • Workflow execution layer
    • API gateway + service layer separate from schema compiler to keep payload validation independent from UI render logic.
  • Multi-tenant isolation
    • Tenant namespace in every form domain object.
    • Tenant-aware RBAC checks at read/write boundaries.
  • Observability path
    • Structured logs for submit attempts, validation rejects, and rule engine decisions.

Implementation Notes

  1. Schema-first contracts
    • Define field definitions in a normalized structure (field id, type, constraints, visibility rules, defaults).
    • Compile to API validation schemas and frontend render configs.
  2. Rule graph execution
    • Conditional visibility/requiredness handled as a dependency graph to avoid circular evaluation.
    • Deterministic evaluator pass with stable node ordering.
  3. Submission lifecycle
    • Inbound payload -> pre-validation -> business rule pass -> persistence -> post-submission event.
    • Events are emitted for audit + async downstream processing.
  4. Security
    • Strict input normalization and schema allowlisting.
    • Signed tenant tokens + least-privilege claim checks.

What made it hard

  • Keeping render semantics and backend validation perfectly aligned.
  • Preventing schema drift between environments.
  • Managing migration-safe updates for active workflow versions.

Code