Forms, written once

Describe a licence form in TypeScript. The engine draws it, checks every answer and sends the payload your API expects.

1You write form.ts

import { defineForm } from "#form-engine";

export default defineForm({
  sections: [{
    key: "cafe",
    title: "Café",
    fields: [
      { key: "name", type: "text", label: "Name" },
      { key: "seats", type: "number", label: "Seats" },
    ],
  }],
});

2The engine draws the form

1Café

3Your API gets the payload

name:"Angkor Café"
seats:24

Type in the form and watch the payload change.

What you no longer write by hand

Each of these is one option in the form file. The engine does the rest.

  • Steps

    steps

    A step bar, Back and Continue, from a plain list of steps.

  • Checks

    checks

    Every answer is checked before the person can move on.

  • Conditions

    when

    Questions appear only when an earlier answer calls for them.

  • Payload

    path

    Answers are sent in exactly the shape your API expects.

  • Review

    review

    Every answer is read back once more before it is sent.

  • Drafts

    restoreFiling

    A saved application opens again just as it was left.