Introduction to FormGPT

FormGPT is a completely dynamic, schema-driven form engine. Instead of dragging and dropping fields, you describe your form in plain English, and the AI generates a strict JSON representation of your form.

The Architecture

The platform is split into two completely decoupled parts:

  • The AI Generator: Takes user prompts and forces GPT-4o to return data conforming strictly to our Zod schema using OpenAI's Structured Outputs.
  • The React Renderer: A dynamic React component (`<FormRenderer />`) that takes the generated JSON and recursively builds the UI, wiring up validations, conditional logic, and state automatically.

The Schema Structure

At the highest level, a generated form looks like this:

{
  "title": "Job Application Form",
  "description": "Please fill out your details below.",
  "layout": { "columns": 2 },
  "fields": [
    {
      "id": "first_name",
      "type": "text",
      "label": "First Name",
      "required": true,
      "colSpan": 1
    },
    // ...
  ]
}

Why JSON?

By compiling natural language into JSON, forms become perfectly serializable. You can save them to a database, send them over an API, version control them, or render them natively on iOS or Android using the exact same schema.