SDK overview
import { Aside } from ‘@astrojs/starlight/components’;
Published artifacts ship with a browser SDK. Drop in one script tag and your page gets storage, file uploads, realtime collaboration, email, Python, and an AI chat agent — no backend to wire up.
Install
Section titled “Install”<script src="https://shareout.site/sdk/shareout.js"></script><script> const sdk = await ShareOut.create();</script>Initialize
Section titled “Initialize”// Preferred for published HTML — waits for the sandbox session tokenconst sdk = await ShareOut.create();
// Sync constructor — fine for local/mock, racey for live data in an iframeconst sdk = new ShareOut();artifactId and baseUrl are auto-detected from the URL. Published artifacts run
in a sandboxed iframe; create() waits for the short-lived token the parent frame
injects.
Local development (mock mode)
Section titled “Local development (mock mode)”On file://, localhost, or 127.0.0.1 the SDK auto-switches to a localStorage
mock — no network, no auth. Force it with new ShareOut({ mock: true }), clear it
with sdk.clearMockData().
The three data tiers
Section titled “The three data tiers”| Tier | API | For |
|---|---|---|
| 1 | sdk.json | Simple state — prefs, flags, cached values |
| 2 | sdk.table(name) | Structured records — tasks, leads, entries |
| 3 | sdk.realtime(id) | Live collaboration — docs, whiteboards |
Everything else
Section titled “Everything else”| API | Does |
|---|---|
sdk.blobs | File storage, served direct from R2 |
sdk.email | Contact-form email to the artifact owner |
sdk.python | Run Python in the browser (Pyodide) |
sdk.agent | AI chat agent powered by Claude |
sdk.comments | Threaded comments |
sdk.sheets / sdk.shopify | Integrations |
Manifest
Section titled “Manifest”Most stores require you to declare their keys/schemas in a manifest block in your
HTML <head>:
<script type="shareout/manifest">{ "version": "2.0", "sources": { "json": { "counter": { "default": 0 } } } }</script>Each store page below shows its manifest shape.
Errors
Section titled “Errors”try { await sdk.json.get('key');} catch (e) { if (e instanceof ShareOutError) console.log(e.code, e.status, e.message);}