Files

1.9 KiB

Browser-only editor export

Forma can publish its editor with a bundled starting project to any static HTTP host. It uses the same scene editor, inspector, scripts, play runtime, imports and archive exports as the local installation.

Build the engine, then export a JSON or packed .forma project:

npm run build
node --import tsx scripts/export-editor.ts PROJECT.forma OUTPUT_DIRECTORY

Serve OUTPUT_DIRECTORY over HTTP, including from a subdirectory such as /demo/. HTML, player and build-template URLs resolve relative to the publication. The entry point is index.html. It loads project.forma.json and starts Editor with initialProject and browserOnly: true. No local service probe, MCP token, server-side files or local machine access is included.

A valid IndexedDB draft for this publication path and bundled project ID takes priority over its starting project. Different publications do not restore each other's drafts; the local editor retains its separate active draft. Legacy unscoped hosted drafts are not automatically migrated. Each visitor edits their own browser copy. If storage is unavailable or corrupt, startup falls back to the validated bundled project. The project menu exports .forma backups that include the GLB assets and scripts. Imported models are stored as embedded data in the browser draft.

The build panel defaults to web export when disconnected. Native builds can be downloaded as build kits; direct native compilation and the local MCP service still require the local Forma installation. The exporter includes the player and build-kit resources needed for these downloads.

Local startup still prioritizes a connected Forma service and otherwise falls back to the browser draft or an empty project. The startup tests cover these precedence rules, restored user edits, missing storage and isolation from the local service in browser-only mode.