A visual tool that lets non-developers create, configure, and publish forms without writing code. Drag fields onto a canvas, set validation rules, define conditional visibility, and collect responses — all through a UI. The challenge is not the drag and drop — it's keeping the builder, preview, validation engine, and response pipeline in sync with a single source of truth.
FrontendX EngineeringSystem Design Series
What Are We Building?
A no-code form builder has two distinct personalities. On one side is the builder surface — a visual editor where users drag fields from a palette onto a canvas, click to configure properties, and see a live preview of the form they are building. On the other side is the runtime surface — the form that end-users fill out, with validation, conditional logic, and submission handling.
The fundamental insight is that both surfaces share the same data model. The builder produces a JSON schema; the runtime renderer consumes it. This separation is what makes the architecture scale — the builder can be large and feature-rich while the renderer stays small and fast.
Here is the API shape — a compound component that scopes the four visual layers of the builder:
The consumer slots in a palette, a canvas, a properties panel, and a preview. The root orchestrates state across all four. Let's walk through each decision that shaped this design.
1 · Requirements & Scoping
Before writing a line of code, I asked the clarifying questions that every system design interview demands: "What exactly are we building, and what is explicitly out of scope?"
Functional requirements
Visual form builder: Drag-and-drop interface with a field palette, design canvas, and properties panel. Users create forms without touching code.
Field types: Text, email, number, textarea, select, checkbox, radio, date, file upload, phone. Each type has its own default properties and validation presets.
Field configuration: Click a field on the canvas to edit its label, placeholder, default value, required flag, and type-specific options (e.g., dropdown choices for select).
Drag to reorder: Fields on the canvas can be dragged to new positions. The preview updates in real time.
Conditional logic: Show or hide fields based on the value of other fields. For example, show a "State" dropdown only when "Country" is "US".
Validation rules: Required, min/max length, pattern matching, email format, number range. Rules are applied at runtime when the end-user submits the form.
Form publishing: Generate a shareable link. The form is rendered from the stored schema.
Response collection: Store submissions, view in an admin panel, export as CSV/JSON.
Non-functional requirements
Performance: Smooth drag & drop at 60 fps. No layout thrashing when reordering fields. Debounced preview updates.
Bundle size: The builder (palette, canvas, properties panel, undo/redo) is large — it must be lazy-loaded separately from the form renderer. The runtime renderer should be under 10 kB gzip.
Undo/redo: At least 50 steps of history. Every add, remove, reorder, and property change must be reversible.
Data integrity: Form responses must never be lost. Concurrent submissions must not overwrite each other.
Accessibility: The builder must be keyboard accessible (no mouse-only interactions). Generated forms must meet WCAG 2.1 AA.
Tip
I deliberately scoped out multi-page forms, payment integration, and a formula-based calculation engine. These are extensions that sit on top of the schema model — the architecture should support them without redesign, but they are not required for v1. The GFE source recommends defining a "minimum lovable product" and deferring everything else.
2 · Architecture — Two Surfaces, One Schema
The central architectural decision is: how do the builder and the runtime form share data? The answer is a unified JSON schema that both surfaces understand. The builder reads and writes the schema; the renderer reads it. This is the same pattern that Google Forms, Typeform, and JotForm use under the hood.
Figure 1 — Two surfaces share one JSON schema. The builder produces it; the runtime renderer consumes it. This separation lets the builder be lazy-loaded, keeping the form renderer lightweight.
I considered three architectural patterns:
Option A: Monolithic builder (rejected)
A single component that handles palette, canvas, properties, preview, and form rendering. Simple for the developer, but the bundle is huge. Every form respondent downloads the entire builder UI even though they only need the form renderer. The GFE source notes: "a 200 kB form renderer will be rejected by product teams."
Option B: Schema-only (rejected)
Store the schema as JSON and let the consumer build their own builder UI. Maximum flexibility but no out-of-the-box experience. The consumer must implement drag-and-drop, properties editing, and undo/redo from scratch — exactly the boilerplate a no-code tool is supposed to eliminate.
A compound component for the builder UI, a separate lightweight renderer for the runtime form, and a shared schema in between. The builder is lazy-loaded and only appears on the form-design route. The renderer is a static import — tiny, fast, and independently deployable.
Monolithic builder
Single bundle with builder + renderer. Too heavy for form respondents. Rejected.
Schema-only contract
No builder UI — consumer builds their own. Too much boilerplate. Rejected.
Compound builder + schema renderer
Builder lazy-loaded; renderer is <10 kB. Shared JSON schema. Chosen.
Key Insight
The schema separation is what lets the builder be feature-rich (undo/redo, DnD, properties panel, preview) while the renderer stays minimal. Google Forms does the same: the editor page is a heavy SPA; the response page is a static HTML form. Two surfaces, one schema.
3 · Data Model — Normalized Field State
The data model is the contract between the builder and the renderer. It must be expressive enough to describe any form but simple enough that the renderer can process it in a single pass.
The schema is what persists. The builder state is what the UI needs while the user is editing: which field is selected, where is the drag cursor, what preview mode is active. I keep these separate so the schema can be serialized and stored without UI noise.
example.typescript
interface BuilderState {
/** Current form schema being designed */
form: FormConfig;
/** ID of the field currently selected in properties panel */
selectedFieldId: string | null;
/** Position of the dragged field (null when idle) */
dragState: {
sourceId: string | null; // from palette
dropIndex: number; // target position
isDragging: boolean;
} | null;
/** Undo/redo stack */
history: {
past: FormConfig[];
future: FormConfig[];
};
/** Preview mode: desktop | mobile */
previewMode: "desktop" | "mobile";
}
const initialState: BuilderState = {
form: {
id: "",
title: "Untitled Form",
fields: [],
submitLabel: "Submit",
captchaEnabled: false,
createdAt: Date.now(),
updatedAt: Date.now(),
},
selectedFieldId: null,
dragState: null,
history: { past: [], future: [] },
previewMode: "desktop",
};
Why separate schema from UI state?
Serialization: The schema is a plain JSON object. It serializes directly to the database. No stripping of UI-only fields.
Testing: The renderer can be tested with schema fixtures. No builder state needed.
Versioning: Schema versions are independent of builder versions. An old schema still renders correctly with a new renderer.
History: The undo/redo stack storesFormConfig snapshots. UI state (selected field, scroll position) is not part of history.
Note
I follow the principle of "persist what matters, derive the rest." The order field on eachFieldConfig determines position — the renderer sorts by it. This avoids the complexity of a linked list or position map while being trivially reorderable.
4 · Interface Definition (API)
The API is the contract between the builder component and its consumer. Every prop has a default, a rationale, and a clear boundary between what the builder manages and what the consumer controls.
Builder props
initialForm: A FormConfig object to seed the builder. Pass an existing schema for editing; omit for a blank form.
onChange: Called on every schema mutation. The consumer can auto-save to a draft endpoint. Debounced internally — the consumer does not need to manage save timing.
onPublish: Called when the user clicks "Publish." The consumer receives the final schema and stores it as the live version.
fieldTypes: A registry of available field types. The consumer can add custom types. Each entry specifies the default config, the icon, and the properties panel component.
Renderer props
schema: The FormConfig to render. The renderer is a pure function of the schema — given the same schema, it always produces the same form.
onSubmit: Called with the validated form values. The consumer handles the HTTP request; the renderer manages validation and error display.
values: Optional initial values for pre-populating the form (e.g., editing an existing response).
renderField: Optional custom renderer for individual fields. Allows the consumer to wrap fields with brand-specific styling.
Server API contract
The server exposes three endpoint families:
Schema CRUD:GET/PUT /api/forms/:id — save and load form configurations. The schema is stored as a JSON column in the database.
Response submission:POST /api/forms/:id/responses — submit a form. The server validates against the stored schema before persisting.
Response retrieval:GET /api/forms/:id/responses — list responses with pagination. Optional CSV export via Accept: text/csv.
5 · Drag & Drop Builder
The drag-and-drop system is the heart of the builder UX. It has three actors: the palette (source of new fields), the canvas (where fields live and reorder), and the drag ghost (visual feedback).
Figure 2 — Drag from the palette onto the canvas. The canvas shows a drop-target highlight. On drop, a new field entry is created in the schema and the preview updates instantly.
Two drag modes
The builder supports two distinct drag operations. From the palette to the canvas — this creates a new field. From one canvas position to another — this reorders existing fields. The drag handler detects the source and dispatches the correct action.
The canvas is divided into horizontal drop zones between each field and at the bottom. When dragging over a zone, a blue insertion line appears. The handleDragOver callback uses the mouse Y coordinate relative to the canvas to determine which zone the cursor is in. I use a binary-search over the zone boundaries for O(log n) lookup — important when the canvas has dozens of fields.
Undo/redo for builder actions
Every builder action — add field, remove field, update property, reorder — pushes the previous state onto a history stack. The reducer pattern makes this natural: each action archives the current schema before producing the next one.
The history stack stores full FormConfig snapshots. For a form with 50 fields, each snapshot is roughly 5-10 kB JSON. Storing 50 undo steps means ~500 kB in memory — acceptable for a builder that is already loaded in a separate JavaScript context. An alternative is to store operations (commands) and replay them, but that adds complexity: operations must support inversion, and concurrent auto-save can invalidate the command log.
Warning
Do not store undo history in the same state object as the form schema. If the consumer calls onChange and the parent re-renders with a new initialForm, the undo stack resets. Keep history in a separate ref or context that survives prop changes.
6 · Conditional Logic & Dynamic Validation
Conditional logic is the feature that separates a professional form builder from a simple survey tool. It lets form authors show or hide fields based on the values of other fields. The implementation must be reactive — hiding a field should also skip its validation.
Figure 3 — Conditional logic evaluation tree. When "Country" equals "US", show the State field. When "State" equals "CA", show California-specific disclosures. Rules are composable and evaluated depth-first.
Rule engine
Each field has an optional visibility rule that references another field and a condition. The engine evaluates rules top-down on every value change. Fields whose rules evaluate to false are hidden and excluded from validation.
example.typescript
interface VisibilityRule {
fieldId: string; // source field
operator: "equals" | "notEquals" | "contains"
| "greaterThan" | "lessThan"
| "isEmpty" | "isChecked";
value: string | number | boolean;
}
function evaluateVisibility(
rule: VisibilityRule | null,
formValues: Record<string, unknown>,
): boolean {
if (!rule) return true; // no rule = always visible
const sourceValue = formValues[rule.fieldId];
switch (rule.operator) {
case "equals":
return sourceValue === rule.value;
case "notEquals":
return sourceValue !== rule.value;
case "contains":
return String(sourceValue).includes(String(rule.value));
case "greaterThan":
return Number(sourceValue) > Number(rule.value);
case "lessThan":
return Number(sourceValue) < Number(rule.value);
case "isEmpty":
return sourceValue === "" || sourceValue == null;
case "isChecked":
return sourceValue === true;
default:
return true;
}
}
// Computes the set of visible fields reactively
function computeVisibleFields(
fields: FieldConfig[],
formValues: Record<string, unknown>,
): string[] {
return fields
.filter((f) => evaluateVisibility(f.visibility, formValues))
.map((f) => f.id);
}
Validation engine
Validation runs at submission time on the client and must be re-validated on the server. Each field has an array of validation rules. The engine iterates through them and returns the first error — rule order matters.
example.typescript
interface ValidationRule {
type: "required" | "minLength" | "maxLength"
| "pattern" | "min" | "max"
| "email" | "custom";
value?: string | number;
message: string;
}
interface ValidationError {
fieldId: string;
message: string;
}
function validateField(
field: FieldConfig,
value: unknown,
): ValidationError | null {
for (const rule of field.validation) {
const error = applyRule(rule, field, value);
if (error) return error;
}
return null;
}
function applyRule(
rule: ValidationRule,
field: FieldConfig,
value: unknown,
): ValidationError | null {
switch (rule.type) {
case "required":
if (value === "" || value == null || value === false) {
return { fieldId: field.id, message: rule.message };
}
break;
case "minLength":
if (String(value).length < Number(rule.value)) {
return { fieldId: field.id, message: rule.message };
}
break;
case "maxLength":
if (String(value).length > Number(rule.value)) {
return { fieldId: field.id, message: rule.message };
}
break;
case "pattern":
if (!new RegExp(String(rule.value)).test(String(value))) {
return { fieldId: field.id, message: rule.message };
}
break;
case "email":
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(value))) {
return { fieldId: field.id, message: rule.message };
}
break;
case "min":
if (Number(value) < Number(rule.value)) {
return { fieldId: field.id, message: rule.message };
}
break;
case "max":
if (Number(value) > Number(rule.value)) {
return { fieldId: field.id, message: rule.message };
}
break;
}
return null;
}
Server-side re-validation
Client-side validation is for UX. Server-side validation is for security. The server loads the stored schema, re-runs the same validation engine, and rejects submissions that fail. This prevents bypassing the client via curl or Postman. The server also re-computes visible fields — a hidden field submitted through a crafted request is silently dropped, not stored.
Key Insight
The conditional logic engine and validation engine share the same function signature: they take the schema and the current values, and return a derived result. This makes them isomorphic (runnable on client and server). I ship the same TypeScript code to both environments, which guarantees behavioral parity.
7 · Response Collection
Once a form is published and users start submitting responses, the system must collect, validate, store, and surface those responses. The response pipeline is where data integrity matters most.
Figure 4 — Response pipeline. User submits → server validates against schema rules → stores in database → updates analytics. Invalid submissions return errors without persisting.
I store responses as individual rows in a relational database, with the values column as a JSON blob. This avoids the complexity of an EAV (entity-attribute-value) schema while still supporting querying by form ID and submission date. For field-level analytics (e.g., "how many people selected Option A?"), I run a background worker that materializes aggregates into a separate stats table.
Rate limiting
Published forms are vulnerable to automated submissions. I implement rate limiting at two levels: IP-based (100 submissions per hour per IP) and form-based (configurable max submissions per form). When the limit is reached, the submission endpoint returns HTTP 429. The renderer shows a user-friendly message.
Warning
Always re-validate on the server. Client validation is trivially bypassed. The server must load the stored schema, re-compute visible fields, re-run the validation engine, and only persist if all checks pass. Hidden fields submitted via crafted requests must be silently discarded, not stored.
8 · Performance Optimization
The form builder is a performance-sensitive application because every drag, keystroke in the properties panel, and reorder operation triggers state updates and preview re-renders.
Lazy-loaded builder bundle
The builder — with its drag-and-drop library, properties panel, undo/redo stack, and preview — is lazy-loaded via React.lazy. The runtime form renderer is a static import under 10 kB gzip. This is the single most impactful optimization: the 95% of users who only fill out forms never download the builder code.
Memoized field rendering
Each field on the canvas is wrapped in React.memo. When the user types in the properties panel, only the selected field re-renders — the other fields are untouched. Without memoization, every keystroke re-renders the entire canvas.
Debounced preview updates
The preview re-renders on every schema change. I debounce the preview update by 150 ms — fast enough to feel real-time, slow enough to avoid rendering intermediate states while the user drags a slider or types a label.
Virtual canvas for large forms
Most forms have 5-20 fields. But power users create forms with 100+ fields. Rendering 100 DOM nodes with drag handles, selection states, and error indicators can cause jank. I virtualize the canvas using a fixed-height approach: each field slot gets a measured height, and only the fields within the scroll viewport render. The virtual scroller is a custom 30-line hook — no external dependency needed.
Tradeoff table
Strategy
Pros
Cons
Lazy-loaded builder
Runtime renderer stays under 10 kB gzip
Builder has a loading state on first use
React.memo on canvas fields
Only dirtied field re-renders on property edit
Increased memory from memoization cache
Debounced preview (150ms)
No intermediate renders during fast edits
Preview is slightly behind the schema state
Virtualized canvas
Constant DOM nodes for any form size
Scroll synchronization adds complexity
Snapshot undo/redo
Simple, reliable, no inversion logic
Higher memory per snapshot (~10 kB each)
9 · Testing Strategy
The no-code form builder has four independently testable subsystems: the conditional logic engine, the validation engine, the drag-and-drop handler, and the builder reducer. I test each in isolation before combining them in integration tests.
Conditional logic engine: Test every operator (equals, notEquals, contains, isChecked, etc.). Test nested rules. Test that a rule on a hidden field is not evaluated. Test the edge case where the source field does not exist.
Validation engine: Test every rule type (required, minLength, pattern, email, range). Test that validation skips hidden fields. Test multiple rules on the same field — first rule wins. Test that empty optional fields pass validation.
Builder reducer: Test every action (ADD, UPDATE, REMOVE, REORDER, UNDO, REDO). Test that UNDO after an action restores the previous state. Test that REDO after a new action is cleared. Test that UNDO with empty stack is a no-op.
Drag-and-drop handler: Test that dragging a palette item to the canvas creates a new field. Test that reordering updates the order field. Test that dropping outside the canvas is a no-op.
Submit handler: Test that valid submissions proceed to storage. Test that invalid submissions return errors. Test that hidden field values are stripped before storage.
Note
The conditional logic and validation engines are pure functions with no side effects. They are the easiest to test and the most important to get right. I write these tests first (TDD-style) before implementing the UI. The GFE source calls this "testing the head, not the body" — the core logic is cheap to test; the rendering is expensive.
10 · Accessibility
The form builder has a dual accessibility responsibility: the builder itself must be usable by keyboard-only users, and the forms it generates must meet WCAG 2.1 AA standards.
Keyboard-accessible builder
Palette navigation: Tab through available field types. Enter adds the field to the canvas. Arrow keys move focus within the palette.
Canvas navigation: Tab into the canvas, then Arrow Up/Down to move between fields. Enter or Space selects a field and opens its properties. Delete removes the selected field.
Keyboard reordering: When a field is selected, Alt+Arrow Up/Down moves it up or down in the field order. This is the keyboard equivalent of drag and drop.
Drag via keyboard: For full DnD keyboard support, Space on a field enters "pick up" mode, Arrow Up/Down moves the insertion point, and Space again "drops" it. This matches the ARIA grid pattern.
Generated form accessibility
Labels: Every field renders a <label> element connected via htmlFor. The label text comes from the schema.
Error messages: Validation errors are associated with fields via aria-describedby. Screen readers announce errors when the user tabs to or focuses the field.
Required fields: Marked with aria-required="true" and a visual asterisk. The renderer does not rely on color alone to indicate required state.
Focus management: After submission, focus moves to the success message or the first validation error. The submit button shows a loading state during submission and is disabled to prevent double-clicks.
Live region for builder changes
When a field is added, removed, or reordered on the canvas, a aria-live="polite" region announces the change: "Field added: Email Address" or "Field moved to position 3." Without this, screen reader users have no feedback that the canvas changed.
11 · Key Takeaways
Two surfaces, one schema. The builder and the runtime renderer share a JSON schema. This separation lets the builder be large and the renderer be tiny. It is the single most important architectural decision.
Keep schema separate from UI state. The schema persists; builder state (selected field, drag position, undo stack) is ephemeral. Separating them makes serialization trivial and testing easier.
Lazy-load the builder. The form renderer should load instantly. The builder can afford a loading state. Split them at the route level.
Conditional logic changes everything. It affects which fields are visible, which fields are validated, and which values get submitted. Design the rule engine as a pure function first, then layer the UI on top.
Validate twice — client and server. Client validation is for UX; server validation is for security. Ship the same validation code to both environments to guarantee parity.
Undo/redo with snapshots is simpler than commands. For forms with under 100 fields, storing full schema snapshots is simple, reliable, and requires no inversion logic. Only switch to command-based undo if snapshot memory becomes a measured problem.
A no-code form builder looks like a drag-and-drop toy. It isn't. The version we just designed handles two rendering surfaces, a normalized data model, conditional logic, dynamic validation, undo/redo, response collection, and accessibility across both the builder and the generated forms. The core schema model fits in a few dozen lines of TypeScript — but the system it orchestrates serves two completely different user groups with completely different needs. That is the signature of a well-architected system: simple at the core, capable at the edges.