Guide

Host bridge

Expose allowlisted host functions to ArrowJS sandboxes via provideArrowHostBridge. Bridge modules never go on the AST — supply them from the app.

Sandboxed widgets sometimes need read-only access to host data — inventory levels, feature flags, or other app APIs. The host bridge exposes allowlisted functions without putting them on the AST.

Provide allowlisted bridge modules

Register bridge modules from your Vue app. Keys use the host-bridge: prefix:

app.vue
import { provideArrowHostBridge } from 'comark-arrow/vue'

provideArrowHostBridge({
  'host-bridge:erp': {
    getStockLevel: (sku) => inventory.read(String(sku)),
  },
})

Never put bridge functions on the AST or in markdown. Supply them only from the host application at render time.

Import inside the sandbox

Sandboxed source imports bridge modules like any other module:

widget.arrow
import { getStockLevel } from 'host-bridge:erp'

export default html`
  <p>Stock: ${() => getStockLevel('SKU-001')}</p>
`

Prefer read-only bridge names

Treat bridge functions as a narrow, reviewed API surface:

  • Prefer read-only names (getStockLevel, listOrders).
  • Mutating functions are an explicit host opt-in — route writes through a confirmation step in the host app.
  • Review bridge exposure the same way you review any server-side endpoint called from user content.
Copyright © 2026