Dashboard Overview
The dashboard displays all your forms with key metrics and quick actions.
What You See
Each form card displays:- Form title - The AI-generated or custom title
- Response count - Total number of submissions received
- Creation date - When the form was generated
- Delete button - Remove the form permanently
Data Fetching
Forms are fetched from the/api/getAllForms endpoint on page load:
1
Component mounts
The
useEffect hook triggers on component mount.2
API request
Axios fetches all forms for the authenticated user.
3
State update
Forms are stored in React state and rendered as cards.
The dashboard uses optimistic UI updates - when you delete a form, it’s immediately removed from the view while the API request processes in the background.
Publishing & Unpublishing Forms
Forms must be published before they can receive responses. This gives you control over when forms go live.Form States
- Unpublished
- Published
Default state when a form is first generated.
- Cannot receive public submissions
- Shareable link is not active
- Shows “Publish Form” button
Publishing Flow
1
Click Publish/Unpublish button
User clicks the toggle button in the form preview.
2
API request
A PATCH request is sent to
/api/forms/{formId} to toggle the isPublished field.3
Database update
The form’s
isPublished field is toggled in PostgreSQL via Prisma.4
UI update
The component state is updated to reflect the new publish status, showing/hiding the shareable link.
Form Preview
Each form has a preview page at/forms/{formId} where you can:
- See exactly how the form will appear to respondents
- All fields are disabled (preview mode)
- Toggle publish status
- Copy the shareable link (when published)
Form Deletion
Deleting a form permanently removes it and all associated responses.Deletion Flow
1
Click Delete button
User clicks the red “Delete” button on a form card.
2
Confirmation dialog
Browser confirmation dialog prevents accidental deletion.
3
API request
DELETE request sent to
/api/forms/{formId}.4
Database cascade
Prisma deletes the form and all related responses (cascade delete).
5
UI update
The form card is immediately removed from the dashboard via optimistic update.
Database Schema
Forms are stored in PostgreSQL using Prisma ORM:Key Fields
id (String)
id (String)
Primary key using CUID (Collision-resistant Unique Identifier) for secure, unpredictable IDs.
userId (String)
userId (String)
Links the form to its creator via Clerk authentication. Used for authorization checks.
slug (String)
slug (String)
Unique, URL-friendly identifier used in public form URLs (
/f/{slug}). Auto-generated on creation.fields (Json)
fields (Json)
JSON column storing the complete form schema as an array of field objects. Allows flexible field types without schema migrations.
isPublished (Boolean)
isPublished (Boolean)
Controls whether the form is accessible via public URL. Defaults to
false for safety.responses (FormsResponses[])
responses (FormsResponses[])
Relation to the responses table. Enables cascade deletion when a form is removed.
Error Handling
The dashboard handles various error states:- Loading State
- Error State
- Empty State
Navigation
Clicking a form card navigates to its responses page:The delete button uses
e.stopPropagation() to prevent triggering navigation when clicking delete.