create-visualbuild-app 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,984 +1,990 @@
1
- # VisualBuild
2
-
3
- [![npm version](https://img.shields.io/npm/v/create-visualbuild-app.svg)](https://www.npmjs.com/package/create-visualbuild-app)
4
- [![GitHub source](https://img.shields.io/badge/GitHub-source-181717?logo=github)](https://github.com/LORD-JINXXX/builder-app)
5
-
6
- VisualBuild is a local visual development framework for building React and
7
- Tailwind applications with drag and drop while retaining normal, editable
8
- source code. It combines a component library, recursive canvas, properties
9
- editor, responsive preview, project explorer, source editor, generator, and
10
- safe source-to-canvas synchronization in one workflow.
11
-
12
- VisualBuild is not a runtime that must be shipped with the application. The
13
- result is an ordinary React/Vite project: developers own its files, can edit
14
- them in any code editor, commit them to Git, build them without the visual
15
- editor, and deploy the generated application independently.
16
-
17
- ## Why VisualBuild was created
18
-
19
- Visual development tools are fast for composing interfaces, but many make the
20
- tool's private format or runtime the permanent owner of the application.
21
- Traditional code-first development gives developers full ownership, but
22
- repetitive layout construction and styling can slow early product work.
23
-
24
- VisualBuild was created to bridge those two workflows:
25
-
26
- - use a visual canvas for the work that is naturally visual;
27
- - generate readable React source instead of hiding the result;
28
- - keep the developer-owned application separate from editor tooling;
29
- - make ownership explicit so the editor never silently replaces arbitrary
30
- files;
31
- - support safe two-way synchronization for a documented static JSX/TSX subset;
32
- - provide direct code-editing escape hatches when visual controls are not
33
- enough;
34
- - keep the production application free of a VisualBuild runtime dependency.
35
-
36
- The central idea is **visual speed without surrendering source ownership**.
37
- VisualBuild deliberately does not claim that every possible React program can
38
- be reconstructed visually. Dynamic application logic stays in normal
39
- developer-owned components, while the visual system manages the static
40
- structure it can understand safely.
41
-
42
- ## Architecture
43
-
44
- VisualBuild is schema-driven, registry-powered, and code-generating. Its
45
- architecture separates the deployable application from the local editor and
46
- uses explicit boundaries for state, source ownership, synchronization, and
47
- deployment.
48
-
49
- ### Workspace boundary
50
-
51
- ```text
52
- workspace/
53
- my-app/ developer-owned React application
54
- src/ real application source
55
- visualbuild/ schema, component registry, ownership metadata
56
- visualbuild.config.ts typed project configuration
57
- package.json application dependencies only
58
-
59
- visual-builder/ optional local development tool
60
- visual-app-builder/ canvas and editor interface
61
- scripts/ generator and launch commands
62
- package.json editor-only dependencies
63
- ```
64
-
65
- The application and editor have independent dependency trees. Drag-and-drop,
66
- editor state, parsing, and generator dependencies belong to
67
- `visual-builder/`; they do not enter the application's production dependency
68
- graph.
69
-
70
- ### Forward visual-to-code flow
71
-
72
- ```text
73
- Elements panel + Canvas + Properties
74
- |
75
- v
76
- Recursive VisualNode tree
77
- |
78
- v
79
- visualbuild/pages.json
80
- |
81
- Component registries
82
- |
83
- v
84
- Babel AST code generator
85
- |
86
- v
87
- React pages, App, layout, and imports
88
- |
89
- v
90
- Standard Vite application
91
- ```
92
-
93
- 1. Built-in elements and presets come from registries that define their label,
94
- category, editable defaults, canvas rendering contract, and generated
95
- structure.
96
- 2. Dragging or editing an element changes a recursive `VisualNode` tree in the
97
- editor.
98
- 3. Top-bar **Save** persists that tree to `visualbuild/pages.json`, the
99
- canonical state for canvas-managed pages.
100
- 4. The generator combines schema data, registered custom-component metadata,
101
- and project configuration.
102
- 5. Babel AST generation writes deterministic React source rather than
103
- concatenating fragile JSX strings.
104
- 6. The generated app runs with Vite and does not import a VisualBuild runtime.
105
-
106
- The canvas and generated source are two views of the same managed structure:
107
- the canvas is optimized for composition, while the source files remain useful
108
- to developers and normal tooling.
109
-
110
- ### Component registry architecture
111
-
112
- VisualBuild has two related registry paths:
113
-
114
- - **Built-in registry:** HTML primitives and page-block presets expand into
115
- editable node trees. A preset is not an opaque screenshot; its nested
116
- headings, text, links, images, containers, classes, IDs, and attributes can
117
- be selected and edited.
118
- - **Custom-component registry:** a local `.jsx` or `.tsx` file is registered
119
- in `visualbuild/components.json` with its export, source path, editor label,
120
- and editable props. Generated pages import that local component directly.
121
-
122
- Registered custom components keep their implementation in the developer's
123
- application. VisualBuild adds no runtime wrapper. Definition-owned static JSX
124
- is selectable on the canvas, and elements dropped into the definition are
125
- written back to the component source. Pages reuse the definition with imports
126
- and self-closing component instances.
127
-
128
- ### Safe reverse synchronization
129
-
130
- ```text
131
- Supported static JSX/TSX edit
132
- |
133
- Watcher
134
- |
135
- v
136
- Babel parser
137
- |
138
- Static-contract validation
139
- |
140
- Stable node-ID reconciliation
141
- |
142
- v
143
- pages.json and the visual canvas
144
- ```
145
-
146
- The file watcher observes managed pages and registered custom components.
147
- Supported static JSX/TSX can be parsed, validated, reconciled with existing
148
- node IDs, and reflected back into the canvas. Equivalent formatting changes do
149
- not rewrite the schema.
150
-
151
- Hooks, runtime expressions, conditional rendering, mapped collections, spread
152
- props, and other arbitrary behavior are outside this importer contract. When
153
- source is unsupported, VisualBuild pauses reverse sync, preserves the source
154
- file and last valid schema, and reports a diagnostic instead of guessing or
155
- overwriting code.
156
-
157
- ### Source ownership
158
-
159
- VisualBuild treats ownership as a safety rule:
160
-
161
- | Source | Owner | Visual behavior |
162
- | --- | --- | --- |
163
- | Managed page source | Canvas/schema | Top-bar Save regenerates it; supported static edits can reverse-sync |
164
- | Registered custom component | Component definition | Root, props, and definition children update its local source |
165
- | Generic project file | Developer | Editable in File mode; never regenerated merely because it exists |
166
- | App and layout outputs | Configuration-dependent | Generated only when their generation switches are enabled |
167
- | Schema and registry metadata | VisualBuild | Stores page state, registration, and ownership information |
168
-
169
- Generated-file metadata lets the generator update or remove only files it
170
- owns. Unregistered developer files are preserved.
171
-
172
- ### Editor state and Save semantics
173
-
174
- The editor keeps immediate canvas state locally so drag, reorder, selection,
175
- and property changes feel responsive.
176
-
177
- - Top-bar **Save** commits canvas/schema state and regenerates managed source.
178
- - **Save file** writes the exact File-editor buffer.
179
- - External file changes refresh clean buffers.
180
- - If canvas or File mode contains unsaved work, VisualBuild shows an explicit
181
- conflict choice instead of selecting a winner silently.
182
- - Generation and managed move operations use rollback behavior when a write
183
- fails.
184
-
185
- ### Preview and code workspace
186
-
187
- The responsive canvas renders the editable node tree at mobile, tablet, and
188
- desktop widths. Preview removes editor chrome without changing application
189
- styles. The Code panel exposes generated Page, App, Layout, and JSON views,
190
- while File mode and the larger code workspace edit the exact selected source
191
- file.
192
-
193
- Editor themes are scoped to the editor interface. They do not recolor the
194
- canvas content, generated application, or production build.
195
-
196
- ### Production and deployment boundary
197
-
198
- VisualBuild's Vercel workflow saves and generates locally, runs the
199
- developer-owned application's production build, audits the output, and uploads
200
- only the configured static build directory.
201
-
202
- It excludes the editor source, `visual-builder/`, `visualbuild/`,
203
- `node_modules/`, project configuration, and credentials. The Vercel token
204
- stays in the local builder process and is never written to generated source or
205
- browser storage.
206
-
207
- ## Public CLI
208
-
209
- ### Requirements
210
-
211
- - Node.js and npm.
212
- - A terminal. The examples use PowerShell and `npm.cmd` on Windows. On macOS
213
- or Linux, use `npm` in the same commands.
214
- - A modern browser.
215
- - A Vercel account and access token only if you want one-click deployment.
216
-
217
- The examples use `my-app` as the application folder. Replace it with the name
218
- you supplied to the create command.
219
-
220
- ### Create a project
221
-
222
- Create a named project from the public package:
223
-
224
- ```powershell
225
- npm create visualbuild-app@latest my-app
226
- ```
227
-
228
- The equivalent `npx` command is:
229
-
230
- ```powershell
231
- npx create-visualbuild-app@latest my-app
232
- ```
233
-
234
- If you omit the name, VisualBuild creates `my-app`:
235
-
236
- ```powershell
237
- npm create visualbuild-app@latest
238
- ```
239
-
240
- Maintainers testing an unpublished local checkout can run this from an empty
241
- folder:
242
-
243
- ```powershell
244
- npm.cmd --prefix "D:\path\to\builder-app" run create-visualbuild-app -- my-app
245
- ```
246
-
247
- The command creates two sibling projects. It does not install dependencies.
248
-
249
- ## Scaffold output
250
-
251
- ```text
252
- workspace/
253
- my-app/ deployable React application
254
- src/ application source
255
- visualbuild/ schema, registry, and ownership metadata
256
- pages.json visual page schema
257
- components.json registered custom components and prop metadata
258
- generated-files.json files managed by the generator
259
- visualbuild.config.ts typed project configuration
260
- package.json application dependencies only
261
- visual-builder/ optional local editor and generator
262
- visual-app-builder/ VisualBuild interface and local API
263
- scripts/ editor and generation commands
264
- package.json editor-only dependencies
265
- my-app-README.md workspace-specific quick start
266
- VISUALBUILD-GUIDE.md a copy of this complete guide
267
- ```
268
-
269
- The separation is a production boundary, not only an organizational choice:
270
-
271
- | Location | Owner and purpose | Deploy it? |
272
- | --- | --- | --- |
273
- | `my-app/src` | Real React application source | Yes |
274
- | `my-app/visualbuild` | VisualBuild schema, registry, and generation metadata | No runtime requirement |
275
- | `my-app/visualbuild.config.ts` | Local editor/generator configuration | No runtime requirement |
276
- | `visual-builder` | Visual editor, watcher, generator, and editor-only dependencies | No |
277
-
278
- The app does not install drag-and-drop, editor state, or generator packages.
279
- It remains runnable after the sibling `visual-builder` directory is removed.
280
-
281
- ## Run a generated project
282
-
283
- Open the first terminal in the workspace root, then install and run the
284
- application:
285
-
286
- ```powershell
287
- cd my-app
288
- npm.cmd install
289
- npm.cmd run dev
290
- ```
291
-
292
- Open a separate second terminal in the workspace root, then install and run
293
- the visual editor:
294
-
295
- ```powershell
296
- cd visual-builder
297
- npm.cmd install
298
- npm.cmd run visual-builder
299
- ```
300
-
301
- If the second terminal opens inside `my-app` instead of the workspace root,
302
- use this path to reach the sibling editor:
303
-
304
- ```powershell
305
- cd ..\visual-builder
306
- ```
307
-
308
- Do not run both development processes sequentially in one occupied terminal.
309
- Use two terminals so the app and VisualBuild can remain running together. If
310
- you stop the app and reuse its terminal, then `cd ..\visual-builder` is the
311
- correct command because that terminal is still inside `my-app`.
312
-
313
- The app normally uses Vite's development URL. VisualBuild opens at:
314
-
315
- ```text
316
- http://127.0.0.1:7371
317
- ```
318
-
319
- Keep the builder terminal open while editing. It runs the file watcher,
320
- generation API, reverse-sync importer, and optional deployment service.
321
-
322
- ## Complete user guide
323
-
324
- The preceding sections explain the product, architecture, installation,
325
- workspace, and startup flow. The sections below complete the self-contained v1
326
- guide for using every major VisualBuild workflow.
327
-
328
- 1. [Understand the interface](#understand-the-interface)
329
- 2. [Build and edit a page](#build-and-edit-a-page)
330
- 3. [Create and register pages](#create-and-register-pages)
331
- 4. [Use built-in elements](#use-built-in-elements)
332
- 5. [Create and register custom components](#create-and-register-custom-components)
333
- 6. [Use the code panel and larger editor](#use-the-code-panel-and-larger-editor)
334
- 7. [Understand source ownership and synchronization](#understand-source-ownership-and-synchronization)
335
- 8. [Reverse-sync support and limits](#reverse-sync-support-and-limits)
336
- 9. [Configure VisualBuild](#configure-visualbuild)
337
- 10. [Use editor themes and responsive previews](#use-editor-themes-and-responsive-previews)
338
- 11. [Deploy to Vercel](#deploy-to-vercel)
339
- 12. [Generate and build without the editor](#generate-and-build-without-the-editor)
340
- 13. [Upcoming versions](#upcoming-versions)
341
- 14. [Recover from errors and conflicts](#recover-from-errors-and-conflicts)
342
- 15. [Troubleshooting](#troubleshooting)
343
-
344
- ## Understand the interface
345
-
346
- ### Top bar
347
-
348
- - **Preview** hides editor panels and displays the active page as the user
349
- will see it.
350
- - **Code** opens or closes the right Code panel.
351
- - The palette button changes the editor theme only.
352
- - **Save** writes the visual schema and regenerates managed source.
353
- - **Deploy** builds the developer-owned app and publishes its static output to
354
- Vercel.
355
-
356
- ### Left panel
357
-
358
- - **Files** is the project explorer. Create, select, rename, move, and delete
359
- files or folders here.
360
- - **Elements** contains global elements, registered custom components,
361
- reusable page blocks, and HTML primitives grouped by category.
362
- - Collapse the panel with its arrow when more canvas space is needed.
363
-
364
- ### Canvas and page bar
365
-
366
- - Drag elements from the Elements panel onto insertion zones.
367
- - Click an element to add it to the selected container. If no valid container
368
- is selected, drag it to the desired insertion zone.
369
- - Select a canvas node to show its controls and Properties.
370
- - Drag selected nodes to reorder or nest them in compatible containers.
371
- - Use **Mobile**, **Tablet**, and **Desktop** above the canvas to test the
372
- configured responsive widths.
373
- - Use the page bar along the bottom to switch pages, add a page, or delete a
374
- page when more than one exists.
375
-
376
- ### Right panel
377
-
378
- - **Properties** edits the selected node's text, ID, component fields,
379
- Tailwind classes, arrays, booleans, select values, and supported additional
380
- attributes.
381
- - Selecting the page root exposes **Page root tag**, allowing `div`, `main`,
382
- `section`, `article`, `header`, `footer`, `nav`, `aside`, or `form`.
383
- - Registered custom components expose their managed component root tag, ID,
384
- Tailwind classes, additional attributes, and configured prop fields.
385
- - **Code** shows generated views and the editable source file associated with
386
- the current selection.
387
- - Collapse the panel with its arrow when more canvas space is needed.
388
-
389
- ## Build and edit a page
390
-
391
- 1. Open **Elements**.
392
- 2. Drag a reusable page block, such as Hero, Grid, or Pricing, onto the canvas.
393
- 3. Select the block or one of its nested elements.
394
- 4. Open **Properties** and edit its text, values, ID, or Tailwind classes.
395
- 5. Drag primitives such as `h2`, `p`, `button`, `section`, or `div` into a
396
- compatible insertion zone.
397
- 6. Reorder a node with its drag handle or move it upward with the canvas
398
- control.
399
- 7. Select the page root to change its semantic root tag and root classes.
400
- 8. Switch between Mobile, Tablet, and Desktop.
401
- 9. Click **Preview** to inspect the page without editor chrome.
402
- 10. Click **Save** to persist the schema and generated React source.
403
-
404
- Tailwind changes are stored as ordinary `className` strings. The class editor
405
- offers suggestions as you type; variants such as `sm:`, `hover:`, and `focus:`
406
- remain part of the generated source. Editor themes never modify these classes.
407
-
408
- ## Create and register pages
409
-
410
- VisualBuild supports two page workflows.
411
-
412
- ### Create a managed page from the page bar
413
-
414
- 1. Click **+ Add page** at the bottom of the editor.
415
- 2. Enter a unique page name.
416
- 3. Enter a unique route such as `/about`.
417
- 4. Click **Add**.
418
-
419
- VisualBuild creates a page schema entry and a generated file under the
420
- configured `pagesDir`, normally `src/pages`. The new page becomes active and
421
- is managed from the canvas.
422
-
423
- ### Register an existing React file as a page
424
-
425
- 1. Create or select a `.jsx` or `.tsx` file inside the configured `sourceDir`.
426
- 2. Ensure it exports a React component whose returned JSX follows the
427
- [supported static contract](#reverse-sync-support-and-limits).
428
- 3. Select the file in **Files**. The Code panel switches to **File**.
429
- 4. Click **Register**.
430
- 5. Choose **Page** in **Register as**.
431
- 6. Enter the page name and route.
432
- 7. Click **Register page**.
433
-
434
- VisualBuild parses the returned static JSX into the page registry, adds the
435
- page to `visualbuild/pages.json`, and treats the source as a managed page from
436
- that point onward. Duplicate names and routes are rejected.
437
-
438
- ### Page files in the project explorer
439
-
440
- - Renaming or moving a managed page file through VisualBuild updates its
441
- `sourcePath`, imports, schema, and selected File view together.
442
- - External moves are detected and reconciled when VisualBuild can identify
443
- the matching file.
444
- - Deleting a managed page file unregisters that page. VisualBuild restores the
445
- file if it is the only registered page, because a project must retain at
446
- least one page.
447
-
448
- ## Use built-in elements
449
-
450
- The Elements panel contains three main levels:
451
-
452
- - **Global**: Navbar and Footer. These belong to the shared app layout and
453
- appear across pages.
454
- - **Page Blocks**: Hero, Card, Button, Grid, Testimonials, Pricing, Form,
455
- Image, Features, Gallery, FAQ, Contact Form, and Login Form.
456
- - **Primitives**: semantic, layout, text, media, form, table, and interactive
457
- HTML elements used for detailed composition.
458
-
459
- Every built-in page block expands to an editable primitive tree. You can
460
- select nested elements, change their properties, add compatible children,
461
- reorder them, preview them, and generate normal React source.
462
-
463
- ## Create and register custom components
464
-
465
- ### Create the source file
466
-
467
- Create a `.jsx` or `.tsx` file inside the app's `src` directory. Files created
468
- from VisualBuild receive filename-derived component boilerplate automatically.
469
- For example, `src/components/First.tsx` starts as a valid default-exported
470
- component.
471
-
472
- A component can contain authored static JSX and an optional `children` slot:
473
-
474
- ```tsx
475
- import type { ReactNode } from 'react'
476
-
477
- export default function First({ children }: { children?: ReactNode }) {
478
- return (
479
- <section className="w-full rounded-lg p-6">
480
- <h2 className="text-2xl font-bold">First component</h2>
481
- {children}
482
- </section>
483
- )
484
- }
485
- ```
486
-
487
- ### Register the component
488
-
489
- 1. Select the file in **Files**.
490
- 2. Click **Register** in the Code panel.
491
- 3. Choose **Component** in **Register as**.
492
- 4. Confirm the detected export.
493
- 5. Click **Register component**.
494
-
495
- VisualBuild records the registration in `visualbuild/components.json`. The
496
- component appears immediately under **Elements > Custom**. Default and named
497
- exports are supported when they can be detected from the source.
498
-
499
- Do not add registrations to `visualbuild.config.ts`. The project registry file
500
- is the single registration source used by the editor.
501
-
502
- ### Edit and use the registered component
503
-
504
- - Drag or click the component from **Elements > Custom** to add it to a page.
505
- - Select the component to edit its root tag, ID, Tailwind classes, additional
506
- JSON attributes, and registered prop schema.
507
- - Static JSX authored in the component file appears on the canvas and is
508
- selectable.
509
- - Elements dragged into the custom component become part of the reusable
510
- component definition and are written into its source on Save.
511
- - Selecting the component or one of its definition-owned children opens the
512
- component source in the File tab.
513
-
514
- VisualBuild treats these canvas edits as definition edits. If the component is
515
- used on multiple pages, the updated definition applies everywhere. Generated
516
- pages import the local source directly and render a self-closing reference such
517
- as `<First />`; they do not copy the component's internal JSX into every page.
518
-
519
- Registration supplies root tag, ID, Tailwind class, and additional-attribute
520
- fields. Advanced prop metadata lives in that component's `props` object in
521
- `visualbuild/components.json`. Supported field types are `string`, `text`,
522
- `number`, `boolean`, `color`, `select`, `array`, and `attributes`. A custom
523
- field affects runtime output only when the React component accepts and uses
524
- the corresponding prop.
525
-
526
- ## Use the code panel and larger editor
527
-
528
- The Code panel has several views:
529
-
530
- | View | Purpose | Editable here? |
531
- | --- | --- | --- |
532
- | **Page** | Generated source preview for the active page | No |
533
- | **App** | Generated application entry/router preview | No |
534
- | **Layout** | Generated shared Navbar/Footer layout preview | No |
535
- | **JSON** | Current visual schema preview | No |
536
- | **File** | Exact selected project file | Yes |
537
-
538
- Generated views are useful for understanding and copying output. Use **File**
539
- when you want to change actual source.
540
-
541
- Selection follows source ownership:
542
-
543
- - Selecting a normal page node opens the active managed page file.
544
- - Selecting a registered custom component or its internal node opens that
545
- custom component file.
546
- - Selecting a file from **Files** opens that exact file.
547
-
548
- The File tab shows `*` when it has unsaved text. Use **Save file** or
549
- `Ctrl+S`. The top-bar **Save** is different: it saves canvas/schema state and
550
- regenerates managed files.
551
-
552
- Click **Open editor** for the full-screen code workspace. It contains a larger
553
- editable File view and a live project explorer, which is more practical for
554
- long components and page files. Close it with the `x` button to return to the
555
- canvas without losing unsaved File text.
556
-
557
- Text files up to 2 MB are editable. Binary files, symbolic links, files outside
558
- the app root, and oversized files are protected from browser editing.
559
-
560
- ## Understand source ownership and synchronization
561
-
562
- VisualBuild is bidirectional only across documented, safe boundaries.
563
-
564
- | Change | Result |
565
- | --- | --- |
566
- | Canvas/Properties change, then top-bar **Save** | Writes `pages.json`, regenerates managed pages/App/layout, and synchronizes definition-owned custom component JSX |
567
- | Managed page source changes in File, VS Code, or another editor | Static returned JSX is parsed into the schema and canvas |
568
- | Registered custom component source changes | Its static preview, root defaults, and definition tree refresh on the canvas |
569
- | Generic project file changes | The project explorer and File view refresh; the file is not converted into canvas nodes |
570
- | Managed page file is renamed or moved | Schema `sourcePath` and generated imports are updated |
571
- | Managed page file is deleted | The page is unregistered, except the only remaining page is restored |
572
-
573
- ### Ownership rules
574
-
575
- - `visualbuild/pages.json` is the safe visual schema boundary.
576
- - Files listed in `visualbuild/generated-files.json` are generator-managed.
577
- - Managed page files can be edited visually or through the supported static
578
- source importer. A later canvas Save can regenerate them.
579
- - Registered custom component files remain local React source, but canvas
580
- edits to their managed root and definition tree intentionally update those
581
- files.
582
- - Unregistered components and ordinary project files are developer-owned and
583
- are never rewritten merely because they exist under `src`.
584
- - Set `generator.emitApp` or `generator.emitLayout` to `false` when you want to
585
- retain developer ownership of those outputs.
586
-
587
- Commit application source, `visualbuild.config.ts`, and the `visualbuild`
588
- metadata to Git so schema and source changes can be reviewed and recovered.
589
-
590
- ## Reverse-sync support and limits
591
-
592
- Reverse sync is intentionally a static JSX importer, not a JavaScript runtime
593
- or a full React compiler.
594
-
595
- ### Supported
596
-
597
- - `.jsx` and `.tsx` managed page files inside the configured source directory.
598
- - Function and arrow components with a discoverable returned JSX element or
599
- fragment.
600
- - Standard supported HTML tags and registered PascalCase custom components.
601
- - Recursive static element trees and fragments.
602
- - Static text.
603
- - Boolean attributes and static string, number, boolean, `null`, negative
604
- number, and expression-free template literal values.
605
- - `className`, ID, supported component props, and supported plain attributes.
606
- - The special `{children}` slot used by registered custom component previews.
607
-
608
- ### Not supported for source-to-canvas import
609
-
610
- - Unknown or unregistered custom component tags.
611
- - Member-expression or namespaced tags such as `<UI.Card>`.
612
- - Spread attributes such as `<div {...props}>`.
613
- - Runtime JSX expressions such as `{items.map(...)}`, `{condition && ...}`,
614
- ternaries, function calls, state-dependent values, or fetched data.
615
- - Arbitrary hook behavior, event-handler logic, render props, portals, or
616
- runtime component factories as visual nodes.
617
- - Dynamically computed attribute values.
618
-
619
- Unsupported source is not partially imported. VisualBuild displays **Reverse
620
- sync paused**, keeps the last valid schema, and leaves the edited source file
621
- untouched. This prevents a best-effort import from silently deleting code.
622
-
623
- You can still keep complex React in developer-owned files. Register only the
624
- static components that should participate in the visual canvas, or disable a
625
- generated output and own it entirely in code.
626
-
627
- ## Configure VisualBuild
628
-
629
- Each app contains a typed `visualbuild.config.ts`. Every field is optional.
630
- Restart the builder after changing paths because its file watchers are created
631
- at startup.
632
-
633
- ```ts
634
- import type { VisualBuildConfig } from './visualbuild/config'
635
-
636
- export default {
637
- paths: {
638
- sourceDir: 'src',
639
- pagesDir: 'src/pages',
640
- layoutsDir: 'src/layouts',
641
- appFile: 'src/App.tsx',
642
- schemaFile: 'visualbuild/pages.json',
643
- componentRegistryFile: 'visualbuild/components.json',
644
- generatedManifestFile: 'visualbuild/generated-files.json',
645
- },
646
- editor: {
647
- theme: 'default',
648
- defaultViewport: 'desktop',
649
- responsiveWidths: {
650
- mobile: 390,
651
- tablet: 768,
652
- desktop: 'fluid',
653
- },
654
- panels: {
655
- leftOpen: true,
656
- leftTab: 'elements',
657
- rightOpen: true,
658
- rightTab: 'properties',
659
- codeView: 'page',
660
- },
661
- },
662
- generator: {
663
- emitApp: true,
664
- emitLayout: true,
665
- cleanStaleFiles: true,
666
- },
667
- deployment: {
668
- provider: 'vercel',
669
- outputDirectory: 'dist',
670
- projectName: 'my-app',
671
- // teamId: 'team_abc123',
672
- },
673
- } satisfies VisualBuildConfig
674
- ```
675
-
676
- ### Configuration reference
677
-
678
- - `paths.sourceDir`: application source boundary.
679
- - `paths.pagesDir`: default generated page directory.
680
- - `paths.layoutsDir`: generated shared layout directory.
681
- - `paths.appFile`: generated app/router path.
682
- - `paths.schemaFile`: page schema path.
683
- - `paths.componentRegistryFile`: custom component registry path.
684
- - `paths.generatedManifestFile`: generated-file ownership manifest.
685
- - `editor.theme`: `default`, `codex-dark`, `vs-light`, `vs-dark`, or `system`.
686
- - `editor.defaultViewport`: `mobile`, `tablet`, or `desktop`.
687
- - `editor.responsiveWidths`: widths from 240 through 4096; desktop may be
688
- `fluid`.
689
- - `editor.panels`: initial open tabs and initial Code view.
690
- - `generator.emitApp`: whether VisualBuild owns and emits the App file.
691
- - `generator.emitLayout`: whether VisualBuild owns and emits the shared layout.
692
- - `generator.cleanStaleFiles`: whether obsolete managed files are removed.
693
- - `deployment.outputDirectory`: application build output to upload.
694
- - `deployment.projectName`: stable lowercase Vercel project name.
695
- - `deployment.teamId`: optional Vercel team identifier beginning with `team_`.
696
-
697
- Paths must stay inside the app. Page, layout, and App paths must remain inside
698
- `sourceDir`. Invalid values stop builder startup with a focused configuration
699
- error instead of falling back silently.
700
-
701
- ## Use editor themes and responsive previews
702
-
703
- The palette menu offers:
704
-
705
- - VisualBuild Default
706
- - Codex Dark
707
- - VS Code Light
708
- - VS Code Dark
709
- - System
710
-
711
- The selected theme is stored per project and restored after refresh. The
712
- configuration theme is the initial fallback until the user selects one.
713
- Editor theme variables are scoped to editor chrome; they never recolor the
714
- canvas, generated source, preview, or deployed application.
715
-
716
- Mobile, Tablet, and Desktop use `editor.responsiveWidths`. They change the
717
- canvas viewport, not the application's generated Tailwind classes.
718
-
719
- ## Deploy to Vercel
720
-
721
- VisualBuild performs a production deployment of the developer-owned app. It
722
- saves and generates source, runs `npm run build` locally, creates a digest
723
- manifest from the configured static output directory, uploads those files,
724
- creates a production Vercel deployment, and waits until Vercel reports
725
- `READY`.
726
-
727
- ### Configure credentials
728
-
729
- Create a Vercel access token. Set it only in the terminal that starts the
730
- builder:
731
-
732
- ```powershell
733
- cd visual-builder
734
- $env:VERCEL_TOKEN = 'your-token'
735
- npm.cmd run visual-builder
736
- ```
737
-
738
- For a team-owned project, optionally set:
739
-
740
- ```powershell
741
- $env:VERCEL_TEAM_ID = 'team_abc123'
742
- ```
743
-
744
- You can also enter the Team ID in the deployment dialog. The access token is
745
- never accepted in project configuration, browser storage, or the dialog.
746
-
747
- On macOS or Linux:
748
-
749
- ```bash
750
- cd visual-builder
751
- VERCEL_TOKEN='your-token' npm run visual-builder
752
- ```
753
-
754
- ### Deploy
755
-
756
- 1. Open VisualBuild.
757
- 2. Click **Deploy**.
758
- 3. Review the lowercase Vercel project name.
759
- 4. Leave Team ID blank for a personal account, or provide the owning team ID.
760
- 5. Click **Deploy production**.
761
- 6. Wait for `READY` and open the returned production URL.
762
-
763
- Only the configured static output, normally `dist`, is uploaded. VisualBuild
764
- rejects builder, metadata, config, dependency, Git, symlink, and other
765
- builder-only paths at the deployment boundary. A virtual SPA fallback is added
766
- to the deployment without modifying application source.
767
-
768
- The following never enter the production upload:
769
-
770
- - `visual-builder`
771
- - `visual-app-builder`
772
- - `visualbuild`
773
- - `visualbuild.config.*`
774
- - `node_modules`
775
- - `.git`
776
- - `.vercel`
777
- - the Vercel access token
778
-
779
- ## Generate and build without the editor
780
-
781
- Generate managed source from the schema without opening the browser:
782
-
783
- ```powershell
784
- cd visual-builder
785
- npm.cmd run vb:generate
786
- ```
787
-
788
- Build the deployable application independently:
789
-
790
- ```powershell
791
- cd ..\my-app
792
- npm.cmd run build
793
- ```
794
-
795
- This independence is the quickest way to verify the production boundary: the
796
- app build must succeed using only the app package and its dependencies.
797
-
798
- ## Upcoming versions
799
-
800
- The features in this section are planned roadmap items, not capabilities in
801
- the current v1 release. Their final scope and release order may change as the
802
- implementation is validated.
803
-
804
- ### v1.1: application package installation interface
805
-
806
- VisualBuild will add an editor interface for finding, installing, updating,
807
- and removing npm packages used by the developer-owned application. Package
808
- operations will target the application workspace and its `package.json`; they
809
- will not add editor-only packages to the production application.
810
-
811
- This is different from installing the `create-visualbuild-app` CLI itself and
812
- from publishing VisualBuild to npm. It is package management for the React
813
- application being built. This interface is a new addition to the current
814
- roadmap; the locked PRD's original v1.1 item was Vercel deployment, which is
815
- already available in the current v1 implementation.
816
-
817
- ### v2: generated-application state management setup
818
-
819
- VisualBuild will offer setup flows for application state management with
820
- Zustand and Redux. The generated stores, providers, hooks, and configuration
821
- will belong to the developer's application and remain usable without a
822
- VisualBuild runtime.
823
-
824
- VisualBuild already uses Zustand internally for editor state. That internal
825
- implementation is separate from the planned v2 feature, which configures
826
- state management in the generated application. Redux support and this
827
- generated-application setup flow are additions to the current roadmap rather
828
- than features specified by the locked PRD.
829
-
830
- ### v2: AI help
831
-
832
- VisualBuild will introduce contextual AI help for building and understanding
833
- the project. The v2 scope is assistance inside the existing visual-and-code
834
- workflow, such as explaining errors, suggesting edits, and helping configure
835
- components. AI changes must remain reviewable and must produce ordinary
836
- developer-owned project files.
837
-
838
- The PRD also describes a later, broader AI-native phase: natural-language page
839
- generation, AI-assisted layout generation, and generation through the project
840
- schema. That full generation workflow remains a later roadmap item rather
841
- than part of the initial v2 AI-help scope.
842
-
843
- ### Additional PRD roadmap items
844
-
845
- The longer-term PRD also identifies these directions:
846
-
847
- - data and authentication integration, including protected routes;
848
- - a component marketplace and publishing developer components;
849
- - team collaboration through shared project state;
850
- - full natural-language-to-project generation and AI layout suggestions;
851
- - multi-framework output such as Vue, Svelte, and Solid; and
852
- - a VisualBuild experience integrated into VS Code.
853
-
854
- Some PRD milestones have already been delivered earlier than originally
855
- planned in this repository, including Vercel deployment, local custom component
856
- registration, drag and drop, editor themes, and limited reverse sync. They are
857
- documented as current v1 features elsewhere in this guide and are therefore
858
- not repeated as upcoming work.
859
-
860
- ## Recover from errors and conflicts
861
-
862
- ### Reverse sync paused
863
-
864
- The edited managed source contains unsupported or invalid JSX. The file is not
865
- overwritten and the last valid schema remains active.
866
-
867
- 1. Read the notice for the unsupported tag or attribute.
868
- 2. Fix the file so its returned JSX matches the static contract, or move the
869
- dynamic behavior to a developer-owned component.
870
- 3. Save the file again and wait for **Source synced**.
871
-
872
- ### Source changed while the canvas has unsaved edits
873
-
874
- VisualBuild does not choose a winner automatically.
875
-
876
- - Click **Load source changes** to discard unsaved canvas state and import the
877
- source version.
878
- - Dismiss the notice to keep working from the canvas state. A later top-bar
879
- Save regenerates managed source from that canvas/schema state.
880
-
881
- ### File changed while the File editor has unsaved text
882
-
883
- VisualBuild preserves the browser text and displays **Reload disk**.
884
-
885
- - Click **Reload disk** to discard browser edits and load the external file.
886
- - Keep editing and use **Save file** to make the browser version the file
887
- version.
888
-
889
- ### Generation failed during Save
890
-
891
- Schema writes are transactional. VisualBuild restores the previous
892
- `pages.json` and regenerates the last valid managed source. Read the diagnostic,
893
- fix the duplicate route, invalid schema, or reported source issue, and save
894
- again.
895
-
896
- ### Rename or move failed
897
-
898
- Managed file moves update filesystem paths, schema paths, and imports as one
899
- operation. If persistence or generation fails, VisualBuild rolls the move back.
900
- Refresh the project tree, resolve the reported conflict, and retry.
901
-
902
- ### Deployment failed
903
-
904
- The deployment dialog shows whether failure occurred during local generation,
905
- the app build, file upload, deployment creation, or Vercel processing. The
906
- last successful production deployment stays live.
907
-
908
- Check:
909
-
910
- 1. The builder was started after `VERCEL_TOKEN` was set.
911
- 2. App dependencies are installed.
912
- 3. `npm run build` succeeds in the app directory.
913
- 4. `deployment.outputDirectory` matches the build output.
914
- 5. Project name is lowercase and valid.
915
- 6. Team ID and token belong to the same Vercel scope.
916
-
917
- ## Troubleshooting
918
-
919
- ### Deploy is disabled
920
-
921
- Stop the builder, set `VERCEL_TOKEN` in that same terminal, and restart it.
922
-
923
- ### A newly created test app does not contain recent local changes
924
-
925
- Scaffolds copy the current editor into `visual-builder`. An existing scaffold
926
- does not update when the framework repository changes. Create a fresh scaffold
927
- when validating unpublished framework changes.
928
-
929
- ### A custom component is not in Elements
930
-
931
- - Confirm the file is `.jsx` or `.tsx` under `sourceDir`.
932
- - Confirm it has a detectable default or named React component export.
933
- - Select the file and use **Register > Component**.
934
- - Check `visualbuild/components.json` for the saved registration.
935
-
936
- ### A custom component's source content is not visible on the canvas
937
-
938
- Keep the returned JSX static and supported. Runtime expressions are not
939
- rendered as visual nodes. An optional `{children}` position is recognized as
940
- the drop location for definition-owned children.
941
-
942
- ### Page source does not update the canvas
943
-
944
- Confirm the file is registered as a page, then check the reverse-sync notice.
945
- Unregistered generic files refresh in the File editor but are not imported
946
- into the page schema.
947
-
948
- ### File edits and canvas edits appear to disagree
949
-
950
- Check which Save action you used:
951
-
952
- - **Save file** writes the File editor buffer.
953
- - Top-bar **Save** writes canvas/schema state and regenerates managed files.
954
-
955
- Use the conflict notice to choose which side should become authoritative.
956
-
957
- ## Development and release verification
958
-
959
- From the framework repository:
960
-
961
- ```powershell
962
- npm.cmd install
963
- npm.cmd test
964
- npm.cmd run lint
965
- npm.cmd run build
966
- npm.cmd run validate:release
967
- npm.cmd pack --dry-run
968
- ```
969
-
970
- The release validator creates an isolated workspace, scaffolds both projects,
971
- installs their dependencies, generates source, lints both projects, builds both
972
- projects, and verifies that builder-only files cannot enter the deployable
973
- output.
974
-
975
- ## Package and support
976
-
977
- - npm: [create-visualbuild-app](https://www.npmjs.com/package/create-visualbuild-app)
978
- - source: [LORD-JINXXX/builder-app](https://github.com/LORD-JINXXX/builder-app)
979
- - issues: [GitHub Issues](https://github.com/LORD-JINXXX/builder-app/issues)
980
- - complete scaffold guide: [docs/user-guide.md](docs/user-guide.md)
981
-
982
- ## License
983
-
984
- UNLICENSED
1
+ # VisualBuild
2
+
3
+ [![npm version](https://img.shields.io/npm/v/create-visualbuild-app.svg)](https://www.npmjs.com/package/create-visualbuild-app)
4
+ [![GitHub source](https://img.shields.io/badge/GitHub-source-181717?logo=github)](https://github.com/LORD-JINXXX/builder-app)
5
+
6
+ VisualBuild is a local visual development framework for building React and
7
+ Tailwind applications with drag and drop while retaining normal, editable
8
+ source code. It combines a component library, recursive canvas, properties
9
+ editor, responsive preview, project explorer, source editor, generator, and
10
+ safe source-to-canvas synchronization in one workflow.
11
+
12
+ VisualBuild is not a runtime that must be shipped with the application. The
13
+ result is an ordinary React/Vite project: developers own its files, can edit
14
+ them in any code editor, commit them to Git, build them without the visual
15
+ editor, and deploy the generated application independently.
16
+
17
+ ## Why VisualBuild was created
18
+
19
+ Visual development tools are fast for composing interfaces, but many make the
20
+ tool's private format or runtime the permanent owner of the application.
21
+ Traditional code-first development gives developers full ownership, but
22
+ repetitive layout construction and styling can slow early product work.
23
+
24
+ VisualBuild was created to bridge those two workflows:
25
+
26
+ - use a visual canvas for the work that is naturally visual;
27
+ - generate readable React source instead of hiding the result;
28
+ - keep the developer-owned application separate from editor tooling;
29
+ - make ownership explicit so the editor never silently replaces arbitrary
30
+ files;
31
+ - support safe two-way synchronization for a documented static JSX/TSX subset;
32
+ - provide direct code-editing escape hatches when visual controls are not
33
+ enough;
34
+ - keep the production application free of a VisualBuild runtime dependency.
35
+
36
+ The central idea is **visual speed without surrendering source ownership**.
37
+ VisualBuild deliberately does not claim that every possible React program can
38
+ be reconstructed visually. Dynamic application logic stays in normal
39
+ developer-owned components, while the visual system manages the static
40
+ structure it can understand safely.
41
+
42
+ ## Architecture
43
+
44
+ VisualBuild is schema-driven, registry-powered, and code-generating. Its
45
+ architecture separates the deployable application from the local editor and
46
+ uses explicit boundaries for state, source ownership, synchronization, and
47
+ deployment.
48
+
49
+ ### Workspace boundary
50
+
51
+ ```text
52
+ workspace/
53
+ my-app/ developer-owned React application
54
+ src/ real application source
55
+ visualbuild/ schema, component registry, ownership metadata
56
+ visualbuild.config.ts typed project configuration
57
+ package.json application dependencies only
58
+
59
+ visual-builder/ optional local development tool
60
+ visual-app-builder/ canvas and editor interface
61
+ scripts/ generator and launch commands
62
+ package.json editor-only dependencies
63
+ ```
64
+
65
+ The application and editor have independent dependency trees. Drag-and-drop,
66
+ editor state, parsing, and generator dependencies belong to
67
+ `visual-builder/`; they do not enter the application's production dependency
68
+ graph.
69
+
70
+ ### Forward visual-to-code flow
71
+
72
+ ```text
73
+ Elements panel + Canvas + Properties
74
+ |
75
+ v
76
+ Recursive VisualNode tree
77
+ |
78
+ v
79
+ visualbuild/pages.json
80
+ |
81
+ Component registries
82
+ |
83
+ v
84
+ Babel AST code generator
85
+ |
86
+ v
87
+ React pages, App, layout, and imports
88
+ |
89
+ v
90
+ Standard Vite application
91
+ ```
92
+
93
+ 1. Built-in elements and presets come from registries that define their label,
94
+ category, editable defaults, canvas rendering contract, and generated
95
+ structure.
96
+ 2. Dragging or editing an element changes a recursive `VisualNode` tree in the
97
+ editor.
98
+ 3. Top-bar **Save** persists that tree to `visualbuild/pages.json`, the
99
+ canonical state for canvas-managed pages.
100
+ 4. The generator combines schema data, registered custom-component metadata,
101
+ and project configuration.
102
+ 5. Babel AST generation writes deterministic React source rather than
103
+ concatenating fragile JSX strings.
104
+ 6. The generated app runs with Vite and does not import a VisualBuild runtime.
105
+
106
+ The canvas and generated source are two views of the same managed structure:
107
+ the canvas is optimized for composition, while the source files remain useful
108
+ to developers and normal tooling.
109
+
110
+ ### Component registry architecture
111
+
112
+ VisualBuild has two related registry paths:
113
+
114
+ - **Built-in registry:** HTML primitives and page-block presets expand into
115
+ editable node trees. A preset is not an opaque screenshot; its nested
116
+ headings, text, links, images, containers, classes, IDs, and attributes can
117
+ be selected and edited.
118
+ - **Custom-component registry:** a local `.jsx` or `.tsx` file is registered
119
+ in `visualbuild/components.json` with its export, source path, editor label,
120
+ and editable props. Generated pages import that local component directly.
121
+
122
+ Registered custom components keep their implementation in the developer's
123
+ application. VisualBuild adds no runtime wrapper. Definition-owned static JSX
124
+ is selectable on the canvas, and elements dropped into the definition are
125
+ written back to the component source. Pages reuse the definition with imports
126
+ and self-closing component instances.
127
+
128
+ ### Safe reverse synchronization
129
+
130
+ ```text
131
+ Supported static JSX/TSX edit
132
+ |
133
+ Watcher
134
+ |
135
+ v
136
+ Babel parser
137
+ |
138
+ Static-contract validation
139
+ |
140
+ Stable node-ID reconciliation
141
+ |
142
+ v
143
+ pages.json and the visual canvas
144
+ ```
145
+
146
+ The file watcher observes managed pages and registered custom components.
147
+ Supported static JSX/TSX can be parsed, validated, reconciled with existing
148
+ node IDs, and reflected back into the canvas. Equivalent formatting changes do
149
+ not rewrite the schema.
150
+
151
+ Hooks, runtime expressions, conditional rendering, mapped collections, spread
152
+ props, and other arbitrary behavior are outside this importer contract. When
153
+ source is unsupported, VisualBuild pauses reverse sync, preserves the source
154
+ file and last valid schema, and reports a diagnostic instead of guessing or
155
+ overwriting code.
156
+
157
+ ### Source ownership
158
+
159
+ VisualBuild treats ownership as a safety rule:
160
+
161
+ | Source | Owner | Visual behavior |
162
+ | --- | --- | --- |
163
+ | Managed page source | Canvas/schema | Top-bar Save regenerates it; supported static edits can reverse-sync |
164
+ | Registered custom component | Component definition | Root, props, and definition children update its local source |
165
+ | Generic project file | Developer | Editable in File mode; never regenerated merely because it exists |
166
+ | App and layout outputs | Configuration-dependent | Generated only when their generation switches are enabled |
167
+ | Schema and registry metadata | VisualBuild | Stores page state, registration, and ownership information |
168
+
169
+ Generated-file metadata lets the generator update or remove only files it
170
+ owns. Unregistered developer files are preserved.
171
+
172
+ ### Editor state and Save semantics
173
+
174
+ The editor keeps immediate canvas state locally so drag, reorder, selection,
175
+ and property changes feel responsive.
176
+
177
+ - Top-bar **Save** commits canvas/schema state and regenerates managed source.
178
+ - **Save file** writes the exact File-editor buffer.
179
+ - External file changes refresh clean buffers.
180
+ - If canvas or File mode contains unsaved work, VisualBuild shows an explicit
181
+ conflict choice instead of selecting a winner silently.
182
+ - Generation and managed move operations use rollback behavior when a write
183
+ fails.
184
+
185
+ ### Preview and code workspace
186
+
187
+ The responsive canvas renders the editable node tree at mobile, tablet, and
188
+ desktop widths. Preview removes editor chrome without changing application
189
+ styles. The Code panel exposes generated Page, App, Layout, and JSON views,
190
+ while File mode and the larger code workspace edit the exact selected source
191
+ file.
192
+
193
+ Editor themes are scoped to the editor interface. They do not recolor the
194
+ canvas content, generated application, or production build.
195
+
196
+ ### Production and deployment boundary
197
+
198
+ VisualBuild's Vercel workflow saves and generates locally, runs the
199
+ developer-owned application's production build, audits the output, and uploads
200
+ only the configured static build directory.
201
+
202
+ It excludes the editor source, `visual-builder/`, `visualbuild/`,
203
+ `node_modules/`, project configuration, and credentials. The Vercel token
204
+ stays in the local builder process and is never written to generated source or
205
+ browser storage.
206
+
207
+ ## Public CLI
208
+
209
+ ### Requirements
210
+
211
+ - Node.js and npm.
212
+ - A terminal. The examples use PowerShell and `npm.cmd` on Windows. On macOS
213
+ or Linux, use `npm` in the same commands.
214
+ - A modern browser.
215
+ - A Vercel account and access token only if you want one-click deployment.
216
+
217
+ The examples use `my-app` as the application folder. Replace it with the name
218
+ you supplied to the create command.
219
+
220
+ ### Create a project
221
+
222
+ Create a named project from the public package:
223
+
224
+ ```powershell
225
+ npm create visualbuild-app@latest my-app
226
+ ```
227
+
228
+ The equivalent `npx` command is:
229
+
230
+ ```powershell
231
+ npx create-visualbuild-app@latest my-app
232
+ ```
233
+
234
+ If you omit the name, VisualBuild creates `my-app`:
235
+
236
+ ```powershell
237
+ npm create visualbuild-app@latest
238
+ ```
239
+
240
+ Maintainers testing an unpublished local checkout can run this from an empty
241
+ folder:
242
+
243
+ ```powershell
244
+ npm.cmd --prefix "D:\path\to\builder-app" run create-visualbuild-app -- my-app
245
+ ```
246
+
247
+ The command creates two sibling projects. It does not install dependencies.
248
+
249
+ ## Scaffold output
250
+
251
+ ```text
252
+ workspace/
253
+ my-app/ deployable React application
254
+ src/ application source
255
+ visualbuild/ schema, registry, and ownership metadata
256
+ pages.json visual page schema
257
+ components.json registered custom components and prop metadata
258
+ generated-files.json files managed by the generator
259
+ visualbuild.config.ts typed project configuration
260
+ package.json application dependencies only
261
+ visual-builder/ optional local editor and generator
262
+ visual-app-builder/ VisualBuild interface and local API
263
+ scripts/ editor and generation commands
264
+ package.json editor-only dependencies
265
+ my-app-README.md workspace-specific quick start
266
+ VISUALBUILD-GUIDE.md a copy of this complete guide
267
+ ```
268
+
269
+ The separation is a production boundary, not only an organizational choice:
270
+
271
+ | Location | Owner and purpose | Deploy it? |
272
+ | --- | --- | --- |
273
+ | `my-app/src` | Real React application source | Yes |
274
+ | `my-app/visualbuild` | VisualBuild schema, registry, and generation metadata | No runtime requirement |
275
+ | `my-app/visualbuild.config.ts` | Local editor/generator configuration | No runtime requirement |
276
+ | `visual-builder` | Visual editor, watcher, generator, and editor-only dependencies | No |
277
+
278
+ The app does not install drag-and-drop, editor state, or generator packages.
279
+ It remains runnable after the sibling `visual-builder` directory is removed.
280
+
281
+ ## Run a generated project
282
+
283
+ Open the first terminal in the workspace root, then install and run the
284
+ application:
285
+
286
+ ```powershell
287
+ cd my-app
288
+ npm.cmd install
289
+ npm.cmd run dev
290
+ ```
291
+
292
+ Open a separate second terminal in the workspace root, then install and run
293
+ the visual editor:
294
+
295
+ ```powershell
296
+ cd visual-builder
297
+ npm.cmd install
298
+ npm.cmd run visual-builder
299
+ ```
300
+
301
+ If the second terminal opens inside `my-app` instead of the workspace root,
302
+ use this path to reach the sibling editor:
303
+
304
+ ```powershell
305
+ cd ..\visual-builder
306
+ ```
307
+
308
+ Do not run both development processes sequentially in one occupied terminal.
309
+ Use two terminals so the app and VisualBuild can remain running together. If
310
+ you stop the app and reuse its terminal, then `cd ..\visual-builder` is the
311
+ correct command because that terminal is still inside `my-app`.
312
+
313
+ The app normally uses Vite's development URL. VisualBuild opens at:
314
+
315
+ ```text
316
+ http://127.0.0.1:7371
317
+ ```
318
+
319
+ Keep the builder terminal open while editing. It runs the file watcher,
320
+ generation API, reverse-sync importer, and optional deployment service.
321
+
322
+ ## Complete user guide
323
+
324
+ The preceding sections explain the product, architecture, installation,
325
+ workspace, and startup flow. The sections below complete the self-contained v1
326
+ guide for using every major VisualBuild workflow.
327
+
328
+ 1. [Understand the interface](#understand-the-interface)
329
+ 2. [Build and edit a page](#build-and-edit-a-page)
330
+ 3. [Create and register pages](#create-and-register-pages)
331
+ 4. [Use built-in elements](#use-built-in-elements)
332
+ 5. [Create and register custom components](#create-and-register-custom-components)
333
+ 6. [Use the code panel and larger editor](#use-the-code-panel-and-larger-editor)
334
+ 7. [Understand source ownership and synchronization](#understand-source-ownership-and-synchronization)
335
+ 8. [Reverse-sync support and limits](#reverse-sync-support-and-limits)
336
+ 9. [Configure VisualBuild](#configure-visualbuild)
337
+ 10. [Use editor themes and responsive previews](#use-editor-themes-and-responsive-previews)
338
+ 11. [Deploy to Vercel](#deploy-to-vercel)
339
+ 12. [Generate and build without the editor](#generate-and-build-without-the-editor)
340
+ 13. [Upcoming versions](#upcoming-versions)
341
+ 14. [Recover from errors and conflicts](#recover-from-errors-and-conflicts)
342
+ 15. [Troubleshooting](#troubleshooting)
343
+
344
+ ## Understand the interface
345
+
346
+ ### Top bar
347
+
348
+ - **Preview** hides editor panels and displays the active page as the user
349
+ will see it.
350
+ - **Code** opens or closes the right Code panel.
351
+ - The palette button changes the editor theme only.
352
+ - **Save** writes the visual schema and regenerates managed source.
353
+ - **Deploy** builds the developer-owned app and publishes its static output to
354
+ Vercel.
355
+
356
+ ### Left panel
357
+
358
+ - **Files** is the project explorer. Create, select, rename, move, and delete
359
+ files or folders here.
360
+ - **Elements** contains global elements, registered custom components,
361
+ reusable page blocks, and HTML primitives grouped by category.
362
+ - Collapse the panel with its arrow when more canvas space is needed.
363
+
364
+ ### Canvas and page bar
365
+
366
+ - Drag elements from the Elements panel onto insertion zones.
367
+ - Click an element to add it to the selected container. If no valid container
368
+ is selected, drag it to the desired insertion zone.
369
+ - Select a canvas node to show its controls and Properties.
370
+ - Drag selected nodes to reorder or nest them in compatible containers.
371
+ - Use **Mobile**, **Tablet**, and **Desktop** above the canvas to test the
372
+ configured responsive widths.
373
+ - Use the page bar along the bottom to switch pages, add a page, or delete a
374
+ page when more than one exists.
375
+
376
+ ### Right panel
377
+
378
+ - **Properties** edits the selected node's text, ID, component fields,
379
+ Tailwind classes, arrays, booleans, select values, and supported additional
380
+ attributes.
381
+ - Selecting the page root exposes **Page root tag**, allowing `div`, `main`,
382
+ `section`, `article`, `header`, `footer`, `nav`, `aside`, or `form`.
383
+ - Registered custom components expose their managed component root tag, ID,
384
+ Tailwind classes, additional attributes, and configured prop fields.
385
+ - **Code** shows generated views and the editable source file associated with
386
+ the current selection.
387
+ - Collapse the panel with its arrow when more canvas space is needed.
388
+
389
+ ## Build and edit a page
390
+
391
+ 1. Open **Elements**.
392
+ 2. Drag a reusable page block, such as Hero, Grid, or Pricing, onto the canvas.
393
+ 3. Select the block or one of its nested elements.
394
+ 4. Open **Properties** and edit its text, values, ID, or Tailwind classes.
395
+ 5. Drag primitives such as `h2`, `p`, `button`, `section`, or `div` into a
396
+ compatible insertion zone.
397
+ 6. Reorder a node with its drag handle or move it upward with the canvas
398
+ control.
399
+ 7. Select the page root to change its semantic root tag and root classes.
400
+ 8. Switch between Mobile, Tablet, and Desktop.
401
+ 9. Click **Preview** to inspect the page without editor chrome.
402
+ 10. Click **Save** to persist the schema and generated React source.
403
+
404
+ Tailwind changes are stored as ordinary `className` strings. The class editor
405
+ offers suggestions as you type; variants such as `sm:`, `hover:`, and `focus:`
406
+ remain part of the generated source. Editor themes never modify these classes.
407
+
408
+ ## Create and register pages
409
+
410
+ VisualBuild supports two page workflows.
411
+
412
+ ### Create a managed page from the page bar
413
+
414
+ 1. Click **+ Add page** at the bottom of the editor.
415
+ 2. Enter a unique page name.
416
+ 3. Enter a unique route such as `/about`.
417
+ 4. Click **Add**.
418
+
419
+ VisualBuild creates a page schema entry and a generated file under the
420
+ configured `pagesDir`, normally `src/pages`. The new page becomes active and
421
+ is managed from the canvas.
422
+
423
+ ### Register an existing React file as a page
424
+
425
+ 1. Create or select a `.jsx` or `.tsx` file inside the configured `sourceDir`.
426
+ 2. Ensure it exports a React component whose returned JSX follows the
427
+ [supported static contract](#reverse-sync-support-and-limits).
428
+ 3. Select the file in **Files**. The Code panel switches to **File**.
429
+ 4. Click **Register**.
430
+ 5. Choose **Page** in **Register as**.
431
+ 6. Enter the page name and route.
432
+ 7. Click **Register page**.
433
+
434
+ VisualBuild parses the returned static JSX into the page registry, adds the
435
+ page to `visualbuild/pages.json`, and treats the source as a managed page from
436
+ that point onward. Duplicate names and routes are rejected.
437
+
438
+ ### Page files in the project explorer
439
+
440
+ - Renaming or moving a managed page file through VisualBuild updates its
441
+ `sourcePath`, imports, schema, and selected File view together.
442
+ - External moves are detected and reconciled when VisualBuild can identify
443
+ the matching file.
444
+ - Deleting a managed page file unregisters that page. VisualBuild restores the
445
+ file if it is the only registered page, because a project must retain at
446
+ least one page.
447
+
448
+ ## Use built-in elements
449
+
450
+ The Elements panel contains three main levels:
451
+
452
+ - **Global**: Navbar and Footer. These belong to the shared app layout and
453
+ appear across pages.
454
+ - **Page Blocks**: Hero, Card, Button, Grid, Testimonials, Pricing, Form,
455
+ Image, Features, Gallery, FAQ, Contact Form, and Login Form.
456
+ - **Primitives**: semantic, layout, text, media, form, table, and interactive
457
+ HTML elements used for detailed composition.
458
+
459
+ Every built-in page block expands to an editable primitive tree. You can
460
+ select nested elements, change their properties, add compatible children,
461
+ reorder them, preview them, and generate normal React source.
462
+
463
+ ## Create and register custom components
464
+
465
+ ### Create the source file
466
+
467
+ Create a `.jsx` or `.tsx` file inside the app's `src` directory. Files created
468
+ from VisualBuild receive filename-derived component boilerplate automatically.
469
+ For example, `src/components/First.tsx` starts as a valid default-exported
470
+ component.
471
+
472
+ A component can contain authored static JSX and an optional `children` slot:
473
+
474
+ ```tsx
475
+ import type { ReactNode } from 'react'
476
+
477
+ export default function First({ children }: { children?: ReactNode }) {
478
+ return (
479
+ <section className="w-full rounded-lg p-6">
480
+ <h2 className="text-2xl font-bold">First component</h2>
481
+ {children}
482
+ </section>
483
+ )
484
+ }
485
+ ```
486
+
487
+ ### Register the component
488
+
489
+ 1. Select the file in **Files**.
490
+ 2. Click **Register** in the Code panel.
491
+ 3. Choose **Component** in **Register as**.
492
+ 4. Confirm the detected export.
493
+ 5. Click **Register component**.
494
+
495
+ VisualBuild records the registration in `visualbuild/components.json`. The
496
+ component appears immediately under **Elements > Custom**. Default and named
497
+ exports are supported when they can be detected from the source.
498
+
499
+ Do not add registrations to `visualbuild.config.ts`. The project registry file
500
+ is the single registration source used by the editor.
501
+
502
+ ### Edit and use the registered component
503
+
504
+ - Drag or click the component from **Elements > Custom** to add it to a page.
505
+ - Select the component to edit its root tag, ID, Tailwind classes, additional
506
+ JSON attributes, and registered prop schema.
507
+ - Static JSX authored in the component file appears on the canvas and is
508
+ selectable.
509
+ - Elements dragged into the custom component become part of the reusable
510
+ component definition and are written into its source on Save.
511
+ - Selecting the component or one of its definition-owned children opens the
512
+ component source in the File tab.
513
+
514
+ VisualBuild treats these canvas edits as definition edits. If the component is
515
+ used on multiple pages, the updated definition applies everywhere. Generated
516
+ pages import the local source directly and render a self-closing reference such
517
+ as `<First />`; they do not copy the component's internal JSX into every page.
518
+
519
+ Registration supplies root tag, ID, Tailwind class, and additional-attribute
520
+ fields. Advanced prop metadata lives in that component's `props` object in
521
+ `visualbuild/components.json`. Supported field types are `string`, `text`,
522
+ `number`, `boolean`, `color`, `select`, `array`, and `attributes`. A custom
523
+ field affects runtime output only when the React component accepts and uses
524
+ the corresponding prop.
525
+
526
+ ## Use the code panel and larger editor
527
+
528
+ The Code panel has several views:
529
+
530
+ | View | Purpose | Editable here? |
531
+ | --- | --- | --- |
532
+ | **Page** | Generated source preview for the active page | No |
533
+ | **App** | Generated application entry/router preview | No |
534
+ | **Layout** | Generated shared Navbar/Footer layout preview | No |
535
+ | **JSON** | Current visual schema preview | No |
536
+ | **File** | Exact selected project file | Yes |
537
+
538
+ Generated views are useful for understanding and copying output. Use **File**
539
+ when you want to change actual source.
540
+
541
+ Selection follows source ownership:
542
+
543
+ - Selecting a normal page node opens the active managed page file.
544
+ - Selecting a registered custom component or its internal node opens that
545
+ custom component file.
546
+ - Selecting a file from **Files** opens that exact file.
547
+
548
+ The File tab shows `*` when it has unsaved text. Use **Save file** or
549
+ `Ctrl+S`. The top-bar **Save** is different: it saves canvas/schema state and
550
+ regenerates managed files.
551
+
552
+ Click **Open editor** for the full-screen code workspace. It contains a larger
553
+ editable File view and a live project explorer, which is more practical for
554
+ long components and page files. Close it with the `x` button to return to the
555
+ canvas without losing unsaved File text.
556
+
557
+ Text files up to 2 MB are editable. Binary files, symbolic links, files outside
558
+ the app root, and oversized files are protected from browser editing.
559
+
560
+ ## Understand source ownership and synchronization
561
+
562
+ VisualBuild is bidirectional only across documented, safe boundaries.
563
+
564
+ | Change | Result |
565
+ | --- | --- |
566
+ | Canvas/Properties change, then top-bar **Save** | Writes `pages.json`, regenerates managed pages/App/layout, and synchronizes definition-owned custom component JSX |
567
+ | Managed page source changes in File, VS Code, or another editor | Static returned JSX is parsed into the schema and canvas |
568
+ | Registered custom component source changes | Its static preview, root defaults, and definition tree refresh on the canvas |
569
+ | Generic project file changes | The project explorer and File view refresh; the file is not converted into canvas nodes |
570
+ | Managed page file is renamed or moved | Schema `sourcePath` and generated imports are updated |
571
+ | Managed page file is deleted | The page is unregistered, except the only remaining page is restored |
572
+
573
+ ### Ownership rules
574
+
575
+ - `visualbuild/pages.json` is the safe visual schema boundary.
576
+ - Files listed in `visualbuild/generated-files.json` are generator-managed.
577
+ - Managed page files can be edited visually or through the supported static
578
+ source importer. A later canvas Save can regenerate them.
579
+ - Registered custom component files remain local React source, but canvas
580
+ edits to their managed root and definition tree intentionally update those
581
+ files.
582
+ - Unregistered components and ordinary project files are developer-owned and
583
+ are never rewritten merely because they exist under `src`.
584
+ - Set `generator.emitApp` or `generator.emitLayout` to `false` when you want to
585
+ retain developer ownership of those outputs.
586
+
587
+ Commit application source, `visualbuild.config.ts`, and the `visualbuild`
588
+ metadata to Git so schema and source changes can be reviewed and recovered.
589
+
590
+ ## Reverse-sync support and limits
591
+
592
+ Reverse sync is intentionally a static JSX importer, not a JavaScript runtime
593
+ or a full React compiler.
594
+
595
+ ### Supported
596
+
597
+ - `.jsx` and `.tsx` managed page files inside the configured source directory.
598
+ - Function and arrow components with a discoverable returned JSX element or
599
+ fragment.
600
+ - Standard supported HTML tags and registered PascalCase custom components.
601
+ - Recursive static element trees and fragments.
602
+ - Static text.
603
+ - Boolean attributes and static string, number, boolean, `null`, negative
604
+ number, and expression-free template literal values.
605
+ - `className`, ID, supported component props, and supported plain attributes.
606
+ - The special `{children}` slot used by registered custom component previews.
607
+
608
+ ### Not supported for source-to-canvas import
609
+
610
+ - Unknown or unregistered custom component tags.
611
+ - Member-expression or namespaced tags such as `<UI.Card>`.
612
+ - Spread attributes such as `<div {...props}>`.
613
+ - Runtime JSX expressions such as `{items.map(...)}`, `{condition && ...}`,
614
+ ternaries, function calls, state-dependent values, or fetched data.
615
+ - Arbitrary hook behavior, event-handler logic, render props, portals, or
616
+ runtime component factories as visual nodes.
617
+ - Dynamically computed attribute values.
618
+
619
+ Unsupported source is not partially imported. VisualBuild displays **Reverse
620
+ sync paused**, keeps the last valid schema, and leaves the edited source file
621
+ untouched. This prevents a best-effort import from silently deleting code.
622
+
623
+ You can still keep complex React in developer-owned files. Register only the
624
+ static components that should participate in the visual canvas, or disable a
625
+ generated output and own it entirely in code.
626
+
627
+ ## Configure VisualBuild
628
+
629
+ Each app contains a typed `visualbuild.config.ts`. Every field is optional.
630
+ Restart the builder after changing paths because its file watchers are created
631
+ at startup.
632
+
633
+ ```ts
634
+ import type { VisualBuildConfig } from './visualbuild/config'
635
+
636
+ export default {
637
+ paths: {
638
+ sourceDir: 'src',
639
+ pagesDir: 'src/pages',
640
+ layoutsDir: 'src/layouts',
641
+ appFile: 'src/App.tsx',
642
+ schemaFile: 'visualbuild/pages.json',
643
+ componentRegistryFile: 'visualbuild/components.json',
644
+ generatedManifestFile: 'visualbuild/generated-files.json',
645
+ },
646
+ editor: {
647
+ theme: 'default',
648
+ defaultViewport: 'desktop',
649
+ responsiveWidths: {
650
+ mobile: 390,
651
+ tablet: 768,
652
+ desktop: 'fluid',
653
+ },
654
+ panels: {
655
+ leftOpen: true,
656
+ leftTab: 'elements',
657
+ rightOpen: true,
658
+ rightTab: 'properties',
659
+ codeView: 'page',
660
+ },
661
+ },
662
+ generator: {
663
+ emitApp: true,
664
+ emitLayout: true,
665
+ cleanStaleFiles: true,
666
+ },
667
+ deployment: {
668
+ provider: 'vercel',
669
+ outputDirectory: 'dist',
670
+ projectName: 'my-app',
671
+ // teamId: 'team_abc123',
672
+ },
673
+ } satisfies VisualBuildConfig
674
+ ```
675
+
676
+ ### Configuration reference
677
+
678
+ - `paths.sourceDir`: application source boundary.
679
+ - `paths.pagesDir`: default generated page directory.
680
+ - `paths.layoutsDir`: generated shared layout directory.
681
+ - `paths.appFile`: generated app/router path.
682
+ - `paths.schemaFile`: page schema path.
683
+ - `paths.componentRegistryFile`: custom component registry path.
684
+ - `paths.generatedManifestFile`: generated-file ownership manifest.
685
+ - `editor.theme`: `default`, `codex-dark`, `vs-light`, `vs-dark`, or `system`.
686
+ - `editor.defaultViewport`: `mobile`, `tablet`, or `desktop`.
687
+ - `editor.responsiveWidths`: widths from 240 through 4096; desktop may be
688
+ `fluid`.
689
+ - `editor.panels`: initial open tabs and initial Code view.
690
+ - `generator.emitApp`: whether VisualBuild owns and emits the App file.
691
+ - `generator.emitLayout`: whether VisualBuild owns and emits the shared layout.
692
+ - `generator.cleanStaleFiles`: whether obsolete managed files are removed.
693
+ - `deployment.outputDirectory`: application build output to upload.
694
+ - `deployment.projectName`: stable lowercase Vercel project name.
695
+ - `deployment.teamId`: optional Vercel team identifier beginning with `team_`.
696
+
697
+ Paths must stay inside the app. Page, layout, and App paths must remain inside
698
+ `sourceDir`. Invalid values stop builder startup with a focused configuration
699
+ error instead of falling back silently.
700
+
701
+ ## Use editor themes and responsive previews
702
+
703
+ The palette menu offers:
704
+
705
+ - VisualBuild Default
706
+ - Codex Dark
707
+ - VS Code Light
708
+ - VS Code Dark
709
+ - System
710
+
711
+ The selected theme is stored per project and restored after refresh. The
712
+ configuration theme is the initial fallback until the user selects one.
713
+ Editor theme variables are scoped to editor chrome; they never recolor the
714
+ canvas, generated source, preview, or deployed application.
715
+
716
+ Mobile, Tablet, and Desktop use `editor.responsiveWidths`. They change the
717
+ canvas viewport, not the application's generated Tailwind classes.
718
+
719
+ ## Deploy to Vercel
720
+
721
+ VisualBuild performs a production deployment of the developer-owned app. It
722
+ saves and generates source, runs `npm run build` locally, creates a digest
723
+ manifest from the configured static output directory, uploads those files,
724
+ creates a production Vercel deployment, and waits until Vercel reports
725
+ `READY`.
726
+
727
+ ### Configure credentials
728
+
729
+ Create a Vercel access token. Set it only in the terminal that starts the
730
+ builder:
731
+
732
+ ```powershell
733
+ cd visual-builder
734
+ $env:VERCEL_TOKEN = 'your-token'
735
+ npm.cmd run visual-builder
736
+ ```
737
+
738
+ For a team-owned project, optionally set:
739
+
740
+ ```powershell
741
+ $env:VERCEL_TEAM_ID = 'team_abc123'
742
+ ```
743
+
744
+ You can also enter the Team ID in the deployment dialog. The access token is
745
+ never accepted in project configuration, browser storage, or the dialog.
746
+
747
+ On macOS or Linux:
748
+
749
+ ```bash
750
+ cd visual-builder
751
+ VERCEL_TOKEN='your-token' npm run visual-builder
752
+ ```
753
+
754
+ ### Deploy
755
+
756
+ 1. Open VisualBuild.
757
+ 2. Click **Deploy**.
758
+ 3. Review the lowercase Vercel project name.
759
+ 4. Leave Team ID blank for a personal account, or provide the owning team ID.
760
+ 5. Click **Deploy production**.
761
+ 6. Wait for `READY` and open the returned production URL.
762
+
763
+ Only the configured static output, normally `dist`, is uploaded. VisualBuild
764
+ rejects builder, metadata, config, dependency, Git, symlink, and other
765
+ builder-only paths at the deployment boundary. A virtual SPA fallback is added
766
+ to the deployment without modifying application source.
767
+
768
+ The following never enter the production upload:
769
+
770
+ - `visual-builder`
771
+ - `visual-app-builder`
772
+ - `visualbuild`
773
+ - `visualbuild.config.*`
774
+ - `node_modules`
775
+ - `.git`
776
+ - `.vercel`
777
+ - the Vercel access token
778
+
779
+ ## Generate and build without the editor
780
+
781
+ Generate managed source from the schema without opening the browser:
782
+
783
+ ```powershell
784
+ cd visual-builder
785
+ npm.cmd run vb:generate
786
+ ```
787
+
788
+ Build the deployable application independently:
789
+
790
+ ```powershell
791
+ cd ..\my-app
792
+ npm.cmd run build
793
+ ```
794
+
795
+ This independence is the quickest way to verify the production boundary: the
796
+ app build must succeed using only the app package and its dependencies.
797
+
798
+ ## Upcoming versions
799
+
800
+ The features in this section are planned roadmap items, not capabilities in
801
+ the current v1 release. Their final scope and release order may change as the
802
+ implementation is validated.
803
+
804
+ ### v1.1: application package installation interface
805
+
806
+ VisualBuild will add an editor interface for finding, installing, updating,
807
+ and removing npm packages used by the developer-owned application. Package
808
+ operations will target the application workspace and its `package.json`; they
809
+ will not add editor-only packages to the production application.
810
+
811
+ This is different from installing the `create-visualbuild-app` CLI itself and
812
+ from publishing VisualBuild to npm. It is package management for the React
813
+ application being built. This interface is a new addition to the current
814
+ roadmap; the locked PRD's original v1.1 item was Vercel deployment, which is
815
+ already available in the current v1 implementation.
816
+
817
+ ### v2: generated-application state management setup
818
+
819
+ VisualBuild will offer setup flows for application state management with
820
+ Zustand and Redux. The generated stores, providers, hooks, and configuration
821
+ will belong to the developer's application and remain usable without a
822
+ VisualBuild runtime.
823
+
824
+ VisualBuild already uses Zustand internally for editor state. That internal
825
+ implementation is separate from the planned v2 feature, which configures
826
+ state management in the generated application. Redux support and this
827
+ generated-application setup flow are additions to the current roadmap rather
828
+ than features specified by the locked PRD.
829
+
830
+ ### v2: AI help
831
+
832
+ VisualBuild will introduce contextual AI help for building and understanding
833
+ the project. The v2 scope is assistance inside the existing visual-and-code
834
+ workflow, such as explaining errors, suggesting edits, and helping configure
835
+ components. AI changes must remain reviewable and must produce ordinary
836
+ developer-owned project files.
837
+
838
+ The PRD also describes a later, broader AI-native phase: natural-language page
839
+ generation, AI-assisted layout generation, and generation through the project
840
+ schema. That full generation workflow remains a later roadmap item rather
841
+ than part of the initial v2 AI-help scope.
842
+
843
+ ### Additional PRD roadmap items
844
+
845
+ The longer-term PRD also identifies these directions:
846
+
847
+ - data and authentication integration, including protected routes;
848
+ - a component marketplace and publishing developer components;
849
+ - team collaboration through shared project state;
850
+ - full natural-language-to-project generation and AI layout suggestions;
851
+ - multi-framework output such as Vue, Svelte, and Solid; and
852
+ - a VisualBuild experience integrated into VS Code.
853
+
854
+ Some PRD milestones have already been delivered earlier than originally
855
+ planned in this repository, including Vercel deployment, local custom component
856
+ registration, drag and drop, editor themes, and limited reverse sync. They are
857
+ documented as current v1 features elsewhere in this guide and are therefore
858
+ not repeated as upcoming work.
859
+
860
+ ## Recover from errors and conflicts
861
+
862
+ ### Reverse sync paused
863
+
864
+ The edited managed source contains unsupported or invalid JSX. The file is not
865
+ overwritten and the last valid schema remains active.
866
+
867
+ 1. Read the notice for the unsupported tag or attribute.
868
+ 2. Fix the file so its returned JSX matches the static contract, or move the
869
+ dynamic behavior to a developer-owned component.
870
+ 3. Save the file again and wait for **Source synced**.
871
+
872
+ ### Source changed while the canvas has unsaved edits
873
+
874
+ VisualBuild does not choose a winner automatically.
875
+
876
+ - Click **Load source changes** to discard unsaved canvas state and import the
877
+ source version.
878
+ - Dismiss the notice to keep working from the canvas state. A later top-bar
879
+ Save regenerates managed source from that canvas/schema state.
880
+
881
+ ### File changed while the File editor has unsaved text
882
+
883
+ VisualBuild preserves the browser text and displays **Reload disk**.
884
+
885
+ - Click **Reload disk** to discard browser edits and load the external file.
886
+ - Keep editing and use **Save file** to make the browser version the file
887
+ version.
888
+
889
+ ### Generation failed during Save
890
+
891
+ Schema writes are transactional. VisualBuild restores the previous
892
+ `pages.json` and regenerates the last valid managed source. Read the diagnostic,
893
+ fix the duplicate route, invalid schema, or reported source issue, and save
894
+ again.
895
+
896
+ ### Rename or move failed
897
+
898
+ Managed file moves update filesystem paths, schema paths, and imports as one
899
+ operation. If persistence or generation fails, VisualBuild rolls the move back.
900
+ Refresh the project tree, resolve the reported conflict, and retry.
901
+
902
+ ### Deployment failed
903
+
904
+ The deployment dialog shows whether failure occurred during local generation,
905
+ the app build, file upload, deployment creation, or Vercel processing. The
906
+ last successful production deployment stays live.
907
+
908
+ Check:
909
+
910
+ 1. The builder was started after `VERCEL_TOKEN` was set.
911
+ 2. App dependencies are installed.
912
+ 3. `npm run build` succeeds in the app directory.
913
+ 4. `deployment.outputDirectory` matches the build output.
914
+ 5. Project name is lowercase and valid.
915
+ 6. Team ID and token belong to the same Vercel scope.
916
+
917
+ ## Troubleshooting
918
+
919
+ ### Deploy is disabled
920
+
921
+ Stop the builder, set `VERCEL_TOKEN` in that same terminal, and restart it.
922
+
923
+ ### A newly created test app does not contain recent local changes
924
+
925
+ Scaffolds copy the current editor into `visual-builder`. An existing scaffold
926
+ does not update when the framework repository changes. Create a fresh scaffold
927
+ when validating unpublished framework changes.
928
+
929
+ ### A custom component is not in Elements
930
+
931
+ - Confirm the file is `.jsx` or `.tsx` under `sourceDir`.
932
+ - Confirm it has a detectable default or named React component export.
933
+ - Select the file and use **Register > Component**.
934
+ - Check `visualbuild/components.json` for the saved registration.
935
+
936
+ ### A custom component's source content is not visible on the canvas
937
+
938
+ Keep the returned JSX static and supported. Runtime expressions are not
939
+ rendered as visual nodes. An optional `{children}` position is recognized as
940
+ the drop location for definition-owned children.
941
+
942
+ ### Page source does not update the canvas
943
+
944
+ Confirm the file is registered as a page, then check the reverse-sync notice.
945
+ Unregistered generic files refresh in the File editor but are not imported
946
+ into the page schema.
947
+
948
+ ### File edits and canvas edits appear to disagree
949
+
950
+ Check which Save action you used:
951
+
952
+ - **Save file** writes the File editor buffer.
953
+ - Top-bar **Save** writes canvas/schema state and regenerates managed files.
954
+
955
+ Use the conflict notice to choose which side should become authoritative.
956
+
957
+ ## Development and release verification
958
+
959
+ From the framework repository:
960
+
961
+ ```powershell
962
+ npm.cmd install
963
+ npm.cmd test
964
+ npm.cmd run lint
965
+ npm.cmd run build
966
+ npm.cmd run validate:release
967
+ npm.cmd pack --dry-run
968
+ ```
969
+
970
+ The release validator creates an isolated workspace, scaffolds both projects,
971
+ installs their dependencies, generates source, lints both projects, builds both
972
+ projects, and verifies that builder-only files cannot enter the deployable
973
+ output.
974
+
975
+ ## Package and support
976
+
977
+ - npm: [create-visualbuild-app](https://www.npmjs.com/package/create-visualbuild-app)
978
+ - source: [LORD-JINXXX/builder-app](https://github.com/LORD-JINXXX/builder-app)
979
+ - issues: [GitHub Issues](https://github.com/LORD-JINXXX/builder-app/issues)
980
+ - complete scaffold guide: [docs/user-guide.md](docs/user-guide.md)
981
+
982
+ ## License
983
+
984
+ VisualBuild is dual-licensed under **MIT OR Apache-2.0**, at your option.
985
+
986
+ - [MIT License](LICENSE-MIT)
987
+ - [Apache License 2.0](LICENSE-APACHE)
988
+
989
+ Copyright 2026 Mustafa Mohammed Sajid. See [LICENSE](LICENSE) for the
990
+ dual-license notice.