# jayesh-2404/formai architecture

> Architecture diagram of the GitHub repository jayesh-2404/formai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jayesh-2404/formai
- Repository: https://github.com/jayesh-2404/formai

## Overview

AI Form Builder turns a user’s description into a saved form, which can then be customized, previewed, shared, and used to collect submissions. The dashboard also supports form management, response viewing/export, and analytics; the landing page presents plans and upgrade options. The excerpts show generation, editing, live rendering, and persistence. Response export, analytics details, and plan upgrades are README-documented capabilities whose implementation is not shown in the sampled source.

Main entry points: [`configs/schema.js`](https://github.com/jayesh-2404/formai/blob/main/configs/schema.js) (Form data store), [`app/edit_form/_components/FormUi.jsx`](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/FormUi.jsx) (Form renderer), [`app/edit_form/[formId]/page.jsx`](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/%5BformId%5D/page.jsx) (Form editor), [`app/edit_form/_components/Controller.jsx`](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/Controller.jsx) (Style controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and accounts"]
  node_landing["Landing page<br/>[page.js]"]
  node_auth_pages["Sign in/up<br/>[page.jsx]"]
  node_clerk["Clerk auth"]
end

subgraph group_authoring["Form authoring"]
  node_generation["AI generation<br/>[generateAiForm.js]"]
  node_gemini["Gemini AI"]
  node_editor["Form editor<br/>[page.jsx]"]
  node_form_ui["Form renderer<br/>[FormUi.jsx]"]
  node_field_edit["Field editing<br/>[FieldEdit.jsx]"]
  node_style_control["Style controls<br/>[Controller.jsx]"]
  node_themes["Theme options<br/>[Themes.jsx]"]
  node_backgrounds["Background options<br/>[GradientBg.jsx]"]
  node_styles["Form styles<br/>[Style.jsx]"]
end

subgraph group_collection["Sharing and responses"]
  node_live_form["Shared form page<br/>[page.jsx]"]
  node_responses["Response submissions<br/>[FormUi.jsx]"]
  node_database[("Form data store<br/>[schema.js]")]
  node_db_client["Neon/Drizzle client<br/>[index.js]"]
end

subgraph group_management["Dashboard and plans"]
  node_dashboard["Forms dashboard<br/>[page.jsx]"]
  node_form_list["Form list<br/>[FormList.jsx]"]
  node_response_dashboard["Response viewing/export<br/>[page.jsx]"]
  node_analytics["Form analytics<br/>[page.jsx]"]
  node_plans["Plans and upgrades<br/>[PricingSection.jsx]"]
end

node_visitor(("Form builder user"))

node_visitor -->|"browses"| node_landing
node_visitor -->|"signs in"| node_auth_pages
node_auth_pages -->|"authenticates with"| node_clerk
node_visitor -->|"manages forms"| node_dashboard
node_dashboard -->|"requests generation"| node_generation
node_generation -->|"requests JSON"| node_gemini
node_generation -->|"saves form"| node_database
node_dashboard -->|"renders"| node_form_list
node_visitor -->|"customizes form"| node_editor
node_editor -->|"renders editor"| node_form_ui
node_editor -->|"configures style"| node_style_control
node_form_ui -->|"renders field editor"| node_field_edit
node_style_control -->|"uses themes"| node_themes
node_style_control -->|"uses backgrounds"| node_backgrounds
node_style_control -->|"uses styles"| node_styles
node_editor -->|"reads and updates"| node_database
node_visitor -->|"opens shared link"| node_live_form
node_live_form -->|"loads form"| node_database
node_live_form -->|"renders live form"| node_form_ui
node_visitor -->|"submits answers"| node_form_ui
node_form_ui -->|"stores response"| node_database
node_visitor -->|"views responses"| node_response_dashboard
node_response_dashboard -.->|"reads responses"| node_database
node_visitor -->|"views analytics"| node_analytics
node_analytics -.->|"queries form data"| node_database
node_visitor -->|"reviews plans"| node_plans
node_db_client -->|"maps schema"| node_database

click node_landing "https://github.com/jayesh-2404/formai/blob/main/app/page.js"
click node_auth_pages "https://github.com/jayesh-2404/formai/blob/main/app/(auth)/sign-in/%5B%5B...sign-in%5D%5D/page.jsx"
click node_dashboard "https://github.com/jayesh-2404/formai/blob/main/app/dashboard/page.jsx"
click node_form_list "https://github.com/jayesh-2404/formai/blob/main/app/dashboard/_components/FormList.jsx"
click node_generation "https://github.com/jayesh-2404/formai/blob/main/actions/generateAiForm.js"
click node_editor "https://github.com/jayesh-2404/formai/blob/main/app/edit_form/%5BformId%5D/page.jsx"
click node_form_ui "https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/FormUi.jsx"
click node_field_edit "https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/FieldEdit.jsx"
click node_style_control "https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/Controller.jsx"
click node_themes "https://github.com/jayesh-2404/formai/blob/main/app/_data/Themes.jsx"
click node_backgrounds "https://github.com/jayesh-2404/formai/blob/main/app/_data/GradientBg.jsx"
click node_styles "https://github.com/jayesh-2404/formai/blob/main/app/_data/Style.jsx"
click node_live_form "https://github.com/jayesh-2404/formai/blob/main/app/aiform/%5Bformid%5D/page.jsx"
click node_responses "https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/FormUi.jsx"
click node_response_dashboard "https://github.com/jayesh-2404/formai/blob/main/app/dashboard/responses/page.jsx"
click node_analytics "https://github.com/jayesh-2404/formai/blob/main/app/dashboard/analytics/page.jsx"
click node_plans "https://github.com/jayesh-2404/formai/blob/main/app/_components/landing/PricingSection.jsx"
click node_database "https://github.com/jayesh-2404/formai/blob/main/configs/schema.js"
click node_db_client "https://github.com/jayesh-2404/formai/blob/main/configs/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_landing,node_auth_pages,node_clerk,node_visitor toneBlue
class node_generation,node_gemini,node_editor,node_form_ui,node_field_edit,node_style_control,node_themes,node_backgrounds,node_styles toneAmber
class node_live_form,node_responses,node_database,node_db_client toneMint
class node_dashboard,node_form_list,node_response_dashboard,node_analytics,node_plans toneRose
```

## Components

### Entry and accounts

- [Landing page](https://github.com/jayesh-2404/formai/blob/main/app/page.js): `app/page.js`
- [Sign in/up](https://github.com/jayesh-2404/formai/blob/main/app/(auth)/sign-in/%5B%5B...sign-in%5D%5D/page.jsx): `app/(auth)/sign-in/[[...sign-in]]/page.jsx`
- **Clerk auth**

### Form authoring

- [AI generation](https://github.com/jayesh-2404/formai/blob/main/actions/generateAiForm.js): `actions/generateAiForm.js`
- **Gemini AI**
- [Form editor](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/%5BformId%5D/page.jsx): `app/edit_form/[formId]/page.jsx`
- [Form renderer](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/FormUi.jsx): `app/edit_form/_components/FormUi.jsx`
- [Field editing](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/FieldEdit.jsx): `app/edit_form/_components/FieldEdit.jsx`
- [Style controls](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/Controller.jsx): `app/edit_form/_components/Controller.jsx`
- [Theme options](https://github.com/jayesh-2404/formai/blob/main/app/_data/Themes.jsx): `app/_data/Themes.jsx`
- [Background options](https://github.com/jayesh-2404/formai/blob/main/app/_data/GradientBg.jsx): `app/_data/GradientBg.jsx`
- [Form styles](https://github.com/jayesh-2404/formai/blob/main/app/_data/Style.jsx): `app/_data/Style.jsx`

### Sharing and responses

- [Shared form page](https://github.com/jayesh-2404/formai/blob/main/app/aiform/%5Bformid%5D/page.jsx): `app/aiform/[formid]/page.jsx`
- [Response submissions](https://github.com/jayesh-2404/formai/blob/main/app/edit_form/_components/FormUi.jsx): `app/edit_form/_components/FormUi.jsx`
- [Form data store](https://github.com/jayesh-2404/formai/blob/main/configs/schema.js): `configs/schema.js`
- [Neon/Drizzle client](https://github.com/jayesh-2404/formai/blob/main/configs/index.js): `configs/index.js`

### Dashboard and plans

- [Forms dashboard](https://github.com/jayesh-2404/formai/blob/main/app/dashboard/page.jsx): `app/dashboard/page.jsx`
- [Form list](https://github.com/jayesh-2404/formai/blob/main/app/dashboard/_components/FormList.jsx): `app/dashboard/_components/FormList.jsx`
- [Response viewing/export](https://github.com/jayesh-2404/formai/blob/main/app/dashboard/responses/page.jsx): `app/dashboard/responses/page.jsx`
- [Form analytics](https://github.com/jayesh-2404/formai/blob/main/app/dashboard/analytics/page.jsx): `app/dashboard/analytics/page.jsx`
- [Plans and upgrades](https://github.com/jayesh-2404/formai/blob/main/app/_components/landing/PricingSection.jsx): `app/_components/landing/PricingSection.jsx`

### Other components

- **Form builder user**

## Connections

- Form builder user → Landing page: browses
- Form builder user → Sign in/up: signs in
- Sign in/up → Clerk auth: authenticates with
- Form builder user → Forms dashboard: manages forms
- Forms dashboard → AI generation: requests generation (evidence: `app/dashboard/page.jsx`)
- AI generation → Gemini AI: requests JSON (evidence: `actions/generateAiForm.js`)
- AI generation → Form data store: saves form (evidence: `actions/generateAiForm.js`)
- Forms dashboard → Form list: renders (evidence: `app/dashboard/page.jsx`)
- Form builder user → Form editor: customizes form
- Form editor → Form renderer: renders editor (evidence: `app/edit_form/[formId]/page.jsx`)
- Form editor → Style controls: configures style (evidence: `app/edit_form/[formId]/page.jsx`)
- Form renderer → Field editing: renders field editor (evidence: `app/edit_form/_components/FormUi.jsx`)
- Style controls → Theme options: uses themes (evidence: `app/edit_form/_components/Controller.jsx`)
- Style controls → Background options: uses backgrounds (evidence: `app/edit_form/_components/Controller.jsx`)
- Style controls → Form styles: uses styles (evidence: `app/edit_form/_components/Controller.jsx`)
- Form editor → Form data store: reads and updates (evidence: `app/edit_form/[formId]/page.jsx`)
- Form builder user → Shared form page: opens shared link
- Shared form page → Form data store: loads form (evidence: `app/aiform/[formid]/page.jsx`)
- Shared form page → Form renderer: renders live form (evidence: `app/aiform/[formid]/page.jsx`)
- Form builder user → Form renderer: submits answers
- Form renderer → Form data store: stores response (evidence: `app/edit_form/_components/FormUi.jsx`)
- Form builder user → Response viewing/export: views responses
- Response viewing/export → Form data store: reads responses (evidence: `app/dashboard/responses/page.jsx`)
- Form builder user → Form analytics: views analytics
- Form analytics → Form data store: queries form data (evidence: `app/dashboard/analytics/page.jsx`)
- Form builder user → Plans and upgrades: reviews plans
- Neon/Drizzle client → Form data store: maps schema (evidence: `configs/index.js`)
