TypeScript SDK
TypeScript SDK
Connect a browser to a deployed uRun app and stream a real-time session
The uRun TypeScript SDK is the browser client for apps deployed from Python. You reference a deployed App, invoke a function by name, and get back a live session — bidirectional media streams plus a synced control doc.
Two packages, released together:
@urun-sh/core— the framework-agnostic client:App,Session,createStore.@urun-sh/react— React bindings:UrunProvider,useApp, auth bridges, and drop-in media components (<Camera>/<Mic>in,<Video>/<Image>/<Audio>out, under a<Session>).
The shape of a client
import { App } from '@urun-sh/core'
const app = App('my-app', { baseUrl: 'https://urun.sh', orgId: 'your-org-id' })
const session = app.generate({ prompt: 'a sunset' }) // returns a Session
const video = session.stream('video') // a named media stream
video.on('track', (track) => {
if (track) videoEl.srcObject = new MediaStream([track])
})
session.doc('control').set({ prompt: { text: 'a forest' } }) // steer it liveThe names mirror the Python backend exactly: app.generate ↔ @app.function def generate, session.stream("video") ↔ ctx.stream("video"), session.doc("control") ↔ ctx.doc("control").
Core building blocks
- Getting started — install, auth, and render your first stream.
- Inputs & outputs — copy-paste recipes: send the camera (front/back) or mic, viewless sending, and render video / audio / images coming back.
- App reference —
App,app.<fn>(), and theSessionhandle. - React providers —
UrunProvider,useApp, and the WorkOS auth bridges. - Session lifecycle — the 9-phase model, scale-to-zero waking, expiry, idle, and recordings.
- Transport — transport negotiation, reconnection, and viewer attach.
- Docs & control — the control doc, the session's state surface.
- Store — advanced global key/value and stream access via
createStore.