Skip to main content
FastForms uses AI to transform your plain English descriptions into complete, validated form schemas. Simply describe what you need, and the system generates all fields, validation rules, and options automatically.

How It Works

The AI generation system is powered by the Groq SDK with the llama-3.3-70b-versatile model, designed specifically for structured JSON output.
1

Describe your form

Users enter a natural language prompt describing the form they need. For example:
  • “Create a customer feedback form with name, email, rating, and comments”
  • “Job application form with personal info, work experience, and file upload”
  • “Event registration with attendee details and meal preferences”
2

AI processes the prompt

The system sends your prompt to Groq AI with a specialized system prompt that ensures structured JSON output matching the form schema format.
3

Schema validation

The generated JSON is validated using Zod to ensure all fields meet requirements before creating the form in the database.
4

Form creation

The validated form is saved to PostgreSQL via Prisma with a unique slug and set to unpublished by default.

Supported Field Types

The AI can generate 9 different field types, each with appropriate validation and options:
Type: textBasic text input with optional placeholder and validation.
Type: emailEmail input with built-in HTML5 validation.
Type: numberNumeric input with optional min/max validation.
Type: dateDate picker input.
Type: textareaMulti-line text input for longer responses.
Type: selectDropdown with predefined options.
Type: radioSingle selection from visible options.
Type: checkboxMultiple selections allowed.
Type: fileFile upload input.
Field Rendering Status: While the validation schema supports all 9 field types, the current UI implementation fully supports text, email, textarea, number, select, radio, and checkbox types. The date and file types are validated but display as “Unsupported field type” in the form preview and public submission pages.

Example Prompts

Prompt:
Generated Form:
  • Full Name (text, required)
  • Email (email, required)
  • Satisfaction Rating (radio, 1-5 stars)
  • Product Quality (select, Excellent/Good/Fair/Poor)
  • Comments (textarea, optional)

AI System Prompt

The AI uses a carefully crafted system prompt to ensure consistent, valid output:
The response_format: { type: 'json_object' } parameter ensures Groq always returns valid JSON, reducing parsing errors.

Error Handling

The system handles multiple error scenarios:
Common Errors:
  • Empty or missing prompt → 400 Bad Request
  • Invalid JSON from AI → Form generation failed
  • Schema validation failure → Specific validation error
  • Unauthorized access → 401 Unauthorized

Schema Validation

All generated schemas are validated using Zod before database insertion:
The validator ensures that select, radio, and checkbox fields always have options, and that all field IDs are unique.

API Endpoint

POST /api/forms/generate Request Body:
Response:
Implementation: app/api/forms/generate/route.ts