Sandstone ships as two bundled ES modules:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ading2210/sandstone/llms.txt
Use this file to discover all available pages before exploring further.
sandstone.mjs for your host page and an internal frame bundle that is embedded automatically. This guide walks you through cloning the repository, building both bundles, and writing the minimal host-side code needed to proxy a URL inside a sandboxed iframe. You will have a working proxy by the end of step 6.
Clone the repository and build
Clone the Sandstone repository, install its dependencies, and produce the production bundles.After the build completes,
dist/sandstone.mjs contains the host bundle and dist/sandstone_frame.js contains the frame bundle. The host bundle inlines the frame bundle automatically, so you only need to import sandstone.mjs in your own code.Import the ES module
Import the host bundle as a namespace so you have access to all public exports.The
sandstone namespace exposes sandstone.controller, sandstone.network, sandstone.libcurl, and sandstone.version.Create a ProxyFrame
Instantiate a Each
ProxyFrame. The constructor creates an <iframe> element with the correct sandbox attributes and registers it internally.ProxyFrame has its own iframe element, its own RPC channel, and its own local storage namespace. You can create multiple frames on the same page.Append the iframe to the DOM
Add the frame’s Style the iframe with CSS as needed. The frame starts with a dark (
<iframe> element to the page so it is visible. You can place it inside any container element.#222222) background while loading.Set the Wisp server
Sandstone uses libcurl.js for network requests, which requires a Wisp WebSocket server. Point it at one before navigating.You can also host your own Wisp server. See the Wisp server guide for details.
Navigate to a URL
Call
navigate_to with any valid http: or https: URL. The method fetches the page through the Wisp connection, rewrites the HTML and JavaScript, and loads it into the sandboxed iframe.navigate_to returns a promise that resolves once the page is loaded and all inline scripts have been evaluated.Complete minimal example
The following self-contained HTML file puts all six steps together. Save it next to thedist/ directory and open it in a browser.
Reacting to navigation events
ProxyFrame exposes three callback properties you can set after construction. The example frontend in example/main.mjs uses all three to keep a URL bar in sync and to fetch the page favicon: