How to Build a Form Builder App with AI
Build a conversational form builder in Layerwise. Validate answers on the server, version published forms, control shared links, then test and publish.
Table of contents
A form builder looks small: a list of questions and a submit button. The decisions that shape it are less visible. Which checks run on the server, where a respondent can't skip them? What happens to last week's responses when you rename a question? Who can read the answers, how do you stop collecting them, and what stops a public link from collecting junk? Answer those before asking an AI to write code, and the first version is much easier to test.
This guide builds a conversational form builder, the kind that asks one question at a time, with Layerwise. You will define the form and response records, plan validation and versioning, decide who sees what and how a form is shared and closed, start from the Formpop template or a prompt, test, and publish. If you are weighing hosted tools first, see our guide to the best Typeform alternatives.

1. Define the question and response records
Owners edit forms, respondents answer them, and both depend on two records. These are Formpop's question and response types, slightly simplified:
type FormField = {
id: string; // created with crypto.randomUUID(); answers are keyed by it
type:
| 'short_text'
| 'long_text'
| 'email'
| 'number'
| 'single_choice'
| 'multiple_choice'
| 'yes_no'
| 'rating' // 1 to 5 stars
| 'opinion_scale' // 0 to 10
| 'date';
label: string;
description: string;
required: boolean;
options: string[]; // used by the two choice types
condition: { fieldId: string; value: string } | null; // show after a matching answer
};
type Submission = {
id: string; // created in the respondent's browser
formId: string;
publicationId: string; // the published version that was answered
answers: Record<string, string | string[]>; // keyed by field id
createdAt: number;
};A form stores its title, link preview description, questions, colors, and welcome and thank-you screens as one JSON document. Three fields matter more than they look. Answers are keyed by question id, not label, so renaming a question doesn't orphan old answers. publicationId ties each response to the version it answered. The submission id is created once in the browser and reused on retry, so a flaky connection can't create two responses.
A third, smaller record feeds analytics: one row per form and browser tab, with the time the form was viewed and, after the first answer, the time it was started. It stores no answers or personal data, and reloading the tab doesn't count a new visit.
2. Validate questions and answers on the server
Formpop keeps validation in one shared module. The browser uses it to show an error, such as "Please enter a valid email address.", before someone moves on; the server runs it again before saving, because a public link accepts requests from anyone, not only from your form.
A saved form needs 1 to 50 questions, and choice questions can have up to 30 unique options. A submission is rejected if it answers unknown questions or skips required ones. Each answer must also fit its type: a valid email, number, or calendar date, a listed choice, Yes or No, a rating from 1 to 5, or a scale value from 0 to 10. Text answers are limited to 1,000 characters, or 10,000 for long text.
Conditional questions can only refer to an earlier question and use an exact match; for multiple choice, any selected option matches. The server works out which questions were visible, validates only those, and drops answers to hidden ones. If you add a question type, such as a phone number, give it a rule in the same module.
3. Decide what happens when a published form changes
If the live form reads the same record you edit, every typo fix reaches people mid-answer, and old responses show labels their respondents never saw.
Formpop keeps them apart. Save, or Cmd/Ctrl+S, updates only the draft, and the live form is unchanged. The editor header shows "Unsaved changes" until you save, and asks before you leave with unsaved edits. Publish saves any pending edits, then stores an immutable snapshot of the draft and points the public link at it in one atomic database batch. Each response keeps its snapshot, so its details show the labels the respondent answered, even after later edits. CSV export combines the questions from every answered version.
Each draft also has a revision number, so a save from a stale tab is rejected instead of overwriting newer work. If someone has the form open while you publish again, their submission is rejected with a message to refresh. Responses stay consistent, but those respondents start over. Turn on Plan mode, described in Direct the agent, to review a different trade-off before code changes:
Explain how submissions are handled when a form is republished while someone is
answering it. Then propose a change: accept a submission for the previous
published version for 30 minutes after a new publish, and store it against that
version so its labels stay correct.4. Decide who sees forms and responses
Forms belong to one owner. Every management function reads the owner from the signed-in session, never from the browser, and filters by it. That includes responses and analytics. Sign-in uses the project's authentication, and forms, published versions, responses, and visits are stored in the project's built-in database. Formpop has no teams, so sharing responses with a coworker is a change you would ask for.
Respondents don't need an account. A published form lives at /f/<slug>, where the slug is 16 random characters rather than the form title. The Share tab copies that link, gives you an iframe snippet to embed the form in another page, and lets you edit the description that chat apps and search engines show in link previews.
There are three ways to stop collecting answers, from lightest to heaviest. Turning off Accepting responses on the Share tab closes the form right away without unpublishing it; visitors see a closed message, and the server rejects new submissions. Archive, in the form card's actions menu, takes the link offline and moves the form, with its responses, to the Archived filter, where Restore brings it back. Delete removes the form with all its responses. A response stores answers and a timestamp, not a user or IP address, so add an email question if you need to follow up.
Formpop validates every answer, caps submission size, escapes answers that start with a formula character in CSV export, and rejects submissions that fill a hidden field people never see, which stops simple bots. It has no rate limit, CAPTCHA, response cap, or closing date. That may be fine for an internal survey; for a form linked from a public page, add limits before sharing it.
5. Choose a starting point
Download Layerwise, sign in, and select a team.
Formpop includes everything above, plus a landing page and a templates page where visitors can answer the six starter forms without saving anything: Product feedback, Contact form, Event RSVP, Research screener, Job application, and Team pulse. The editor has drag-and-drop ordering, a live desktop and mobile preview, six theme presets with custom colors and a contrast warning, and welcome and thank-you screens. Respondents can answer with the keyboard. Owners get a dashboard with filters, search, and sorting, a Responses tab with search and CSV export, and an Analytics tab. File uploads, payments, teams, and external integrations are not included.
To start from it, open Formpop, choose Use this template, pick a team and project name in Layerwise, then choose Copy to Layerwise. The records, validation, and snapshot publishing are already implemented, so your work is adapting them. Other workflows are in the template gallery.
To start from scratch, enter a description in Describe the app you want to build... on the team home page, including the decisions above:
Build a form builder that shows one question at a time. Signed-in users create
forms with short text, long text, email, number, date, single choice, multiple
choice, yes/no, 1-5 rating, and 0-10 scale questions, each with a required flag
and an optional condition on an earlier answer. Saving edits a draft;
publishing saves a snapshot that a public link serves to anyone without an
account, and owners can stop accepting responses at any time. Store each
response with the snapshot it answered and validate every answer on the
server. Owners see only their own forms, responses, and analytics.A blank start lets you choose each behavior, but you must verify each one yourself. The prompting guide explains how to describe users, data, and screens.
6. Test with two accounts and an anonymous respondent
Once the local preview loads, choose Try a template on the landing page. Each starter form opens the way a respondent sees it, and nothing you type is saved, so you can judge the layout and keyboard flow right away: letters pick choices, Y and N answer yes/no questions, and Enter moves on.

Sign up from the landing page, then:
- Choose New form, pick Event RSVP under Start from, and choose Create form. In the Build tab, select the guest-count question. Under Show this question, it appears only when "Will you be there?" is Yes. Choose Try it and take both branches; preview answers aren't saved.
- Choose Publish. Formpop saves your edits, publishes, and opens the Share tab with the link. Open the preview in your default browser from the preview header. That browser doesn't share your session, so open the link there as an anonymous respondent. Skip a required question, enter an invalid email, and submit. The response should appear in Responses, and Analytics should count a view, a start, and a completion.
- Rename a question and choose Save. The public link should still show the old label, and the Share tab should offer Publish changes. Publish them, and confirm the earlier response's details keep the original label. Submit from a public-link tab opened before that publish to see the refresh message.
- On the Share tab, turn off Accepting responses and reload the public link; it should say the form is closed, and its card on the dashboard should show Closed. Turn it back on, choose Archive from the card's actions menu, and confirm the link stops working. The form should appear under Archived with its responses, and Restore should reopen the link.
- Sign up as a second user and confirm none of the first user's forms appear. You can also create test accounts with Add user in Authentication. Open Database, select Local, and confirm each submission references a publication.
If a check fails, open the preview console from Project actions, or find the failed request in Logs. If the console shows an error you don't recognize, look it up in the vibe coding errors reference.
7. Publish and improve it
Choose Publish in the Layerwise preview header, then Publish in the menu, and open the live URL when the release finishes. Local and Online use separate databases, so test forms and responses are not copied. Create your real form on the live app, copy its link or embed code from Share, and answer it from a phone. The publishing guide covers release status.
Choose the next change from what you observe. Formpop's Analytics tab shows how many visitors viewed, started, and completed a form over 7, 30, or 90 days, and summarizes the answers to every question. Layerwise Analytics shows pageviews and visitors across the whole app. If submissions fail, select Online in Logs and find the failing request.

Formpop closes a form only when you turn off Accepting responses, so automatic closing rules are a useful addition:
Add an optional closing date and an optional maximum number of responses to
each form's Share tab. When either is reached, stop accepting responses so the
public link shows the closed message and the server rejects new submissions.
Show the remaining response count next to the Accepting responses switch.Start from Formpop if a one-question-at-a-time form fits your respondents, or from a prompt if you need a different model. Either way, settle validation, versioning, and access before adding question types. For the full project workflow, follow the Quick start.