# softfocus-labs/sf-pages architecture

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

- Interactive diagram: https://gitdiagram.com/softfocus-labs/sf-pages
- Repository: https://github.com/softfocus-labs/sf-pages

## Overview

Pages is a browser-only drag-and-drop landing-page builder. Users assemble and style a nested component tree on a live canvas, then inspect generated code, import pasted markup, preview responsive layouts, and export standalone files. Projects and edit history persist in browser localStorage. The graph includes the documented feature branches, while edges are limited to relationships shown in excerpts or stated in the README; some module-to-module wiring is not visible in the sampled source.

Main entry points: [`js/modules/components.js`](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/components.js) (Component tree), [`js/modules/main.js`](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/main.js) (App bootstrap), [`js/modules/canvas.js`](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/canvas.js) (Live canvas), [`js/modules/dragdrop.js`](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/dragdrop.js) (Drag and drop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Visual authoring"]
  node_schema["Component schema<br/>[constants.js]"]
  node_tree["Component tree<br/>[components.js]"]
  node_canvas["Live canvas<br/>[canvas.js]"]
  node_drag["Drag and drop<br/>[dragdrop.js]"]
  node_inspector["Styles inspector<br/>[inspector.js]"]
  node_import["HTML/CSS import<br/>[import.js]"]
  node_utils["Tree and DOM helpers<br/>[utils.js]"]
end

subgraph group_project["Projects and state"]
  node_storage["Project and history<br/>[storage.js]"]
  node_local[("Browser localStorage")]
end

subgraph group_code["Code and export"]
  node_generator["Code generation<br/>[codegen.js]"]
  node_preview["Responsive preview<br/>[codegen.js]"]
  node_export["Standalone export<br/>[codegen.js]"]
  node_clipboard["Clipboard"]
end

subgraph group_interface["Application interface"]
  node_shell["Editor shell<br/>[index.html]"]
  node_bootstrap["App bootstrap<br/>[main.js]"]
  node_ui["UI primitives<br/>[ui.js]"]
  node_dialogs["Dialogs and pickers<br/>[modals.js]"]
end

node_user(("Builder"))

node_user -->|"opens and uses"| node_shell
node_shell -->|"loads application"| node_bootstrap
node_user -->|"drags components"| node_drag
node_drag -->|"drops onto"| node_canvas
node_canvas -->|"selects components"| node_tree
node_tree -->|"renders selection"| node_canvas
node_tree -->|"renders styles"| node_inspector
node_user -->|"edits styles"| node_inspector
node_inspector -->|"deletes component"| node_tree
node_canvas -->|"sets drop zones"| node_drag
node_user -->|"pastes markup"| node_import
node_user -->|"views generated code"| node_generator
node_bootstrap -->|"updates code view"| node_generator
node_generator -->|"provides responsive preview"| node_preview
node_generator -->|"exports page files"| node_export
node_user -->|"exports project"| node_export
node_bootstrap -->|"copies code"| node_clipboard
node_user -->|"manages projects"| node_storage
node_storage -->|"persists project data"| node_local
node_bootstrap -->|"undoes and redoes"| node_storage
node_drag -->|"opens integration dialog"| node_dialogs
node_dialogs -.->|"updates project settings"| node_storage
node_schema -.->|"defines component types"| node_tree
node_utils -.->|"supports tree operations"| node_tree
node_ui -.->|"provides select controls"| node_inspector

click node_shell "https://github.com/softfocus-labs/sf-pages/blob/main/index.html"
click node_bootstrap "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/main.js"
click node_ui "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/ui.js"
click node_dialogs "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/modals.js"
click node_schema "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/constants.js"
click node_tree "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/components.js"
click node_canvas "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/canvas.js"
click node_drag "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/dragdrop.js"
click node_inspector "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/inspector.js"
click node_import "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/import.js"
click node_utils "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/utils.js"
click node_storage "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/storage.js"
click node_generator "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/codegen.js"
click node_preview "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/codegen.js"
click node_export "https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/codegen.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_schema,node_tree,node_canvas,node_drag,node_inspector,node_import,node_utils toneBlue
class node_storage,node_local toneAmber
class node_generator,node_preview,node_export,node_clipboard toneMint
class node_shell,node_bootstrap,node_ui,node_dialogs toneRose
class node_user toneIndigo
```

## Components

### Visual authoring

- [Component schema](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/constants.js): `js/modules/constants.js`
- [Component tree](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/components.js): `js/modules/components.js`
- [Live canvas](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/canvas.js): `js/modules/canvas.js`
- [Drag and drop](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/dragdrop.js): `js/modules/dragdrop.js`
- [Styles inspector](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/inspector.js): `js/modules/inspector.js`
- [HTML/CSS import](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/import.js): `js/modules/import.js`
- [Tree and DOM helpers](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/utils.js): `js/modules/utils.js`

### Projects and state

- [Project and history](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/storage.js): `js/modules/storage.js`
- **Browser localStorage**

### Code and export

- [Code generation](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/codegen.js): `js/modules/codegen.js`
- [Responsive preview](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/codegen.js): `js/modules/codegen.js`
- [Standalone export](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/codegen.js): `js/modules/codegen.js`
- **Clipboard**

### Application interface

- [Editor shell](https://github.com/softfocus-labs/sf-pages/blob/main/index.html): `index.html`
- [App bootstrap](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/main.js): `js/modules/main.js`
- [UI primitives](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/ui.js): `js/modules/ui.js`
- [Dialogs and pickers](https://github.com/softfocus-labs/sf-pages/blob/main/js/modules/modals.js): `js/modules/modals.js`

### Other components

- **Builder**

## Connections

- Builder → Editor shell: opens and uses (evidence: `README.md`)
- Editor shell → App bootstrap: loads application (evidence: `README.md`)
- Builder → Drag and drop: drags components (evidence: `README.md`)
- Drag and drop → Live canvas: drops onto (evidence: `js/modules/canvas.js`)
- Live canvas → Component tree: selects components (evidence: `js/modules/components.js`)
- Component tree → Live canvas: renders selection (evidence: `js/modules/components.js`)
- Component tree → Styles inspector: renders styles (evidence: `js/modules/components.js`)
- Builder → Styles inspector: edits styles (evidence: `README.md`)
- Styles inspector → Component tree: deletes component (evidence: `js/modules/inspector.js`)
- Live canvas → Drag and drop: sets drop zones (evidence: `js/modules/canvas.js`)
- Builder → HTML/CSS import: pastes markup (evidence: `README.md`)
- Builder → Code generation: views generated code (evidence: `README.md`)
- App bootstrap → Code generation: updates code view (evidence: `js/modules/main.js`)
- Code generation → Responsive preview: provides responsive preview (evidence: `README.md`)
- Code generation → Standalone export: exports page files (evidence: `README.md`)
- Builder → Standalone export: exports project (evidence: `README.md`)
- App bootstrap → Clipboard: copies code (evidence: `js/modules/main.js`)
- Builder → Project and history: manages projects (evidence: `README.md`)
- Project and history → Browser localStorage: persists project data (evidence: `README.md`)
- App bootstrap → Project and history: undoes and redoes (evidence: `js/modules/main.js`)
- Drag and drop → Dialogs and pickers: opens integration dialog (evidence: `js/modules/dragdrop.js`)
- Dialogs and pickers → Project and history: updates project settings
- Component schema → Component tree: defines component types
- Tree and DOM helpers → Component tree: supports tree operations
- UI primitives → Styles inspector: provides select controls
