@atriumjs/express
v0.3.0
Published
Express-compatible middleware for Atrium remote browser sessions (API dials workers)
Maintainers
Readme
@atriumjs/express
Express middleware for Atrium: session HTTP API, viewer WebSocket relay (your API dials the worker), in-memory session records, and replay of recent JSON control messages for reconnects.
Docs hub: docs/README.md · User guide: docs/user-guide.md
Install
npm install express @atriumjs/expressexpress is a peer dependency because Atrium mounts into your existing Express app.
With pnpm: pnpm add express @atriumjs/express.
Full app walkthrough: npm quick start.
API
import { atrium } from "@atriumjs/express";
const { router, handleViewerUpgrade } = atrium({
authorize: async (req) => ({ tenantId: "…", userId: "…" }),
policies: {
sessionTtlMs: 15 * 60_000,
idleTtlMs: 5 * 60_000,
maxConcurrentSessionsPerTenant: 5,
urlAllowlist: ["*"],
defaultViewport: { w: 1280, h: 800 },
},
workerDialBase: process.env.ATRIUM_WORKER_DIAL_BASE!,
workerSharedSecret: process.env.ATRIUM_WORKER_SECRET!,
mountPath: "/atrium", // optional
});- Mount
routeron your app atmountPath. - On
server.on("upgrade", …), callhandleViewerUpgradefor paths under/sessions/*/stream.
Exported helpers: viewerStreamMatch, urlAllowed, workerHttpBaseFromDial, workerInternalFetch, types AtriumConfig, AtriumMount, SessionRecord, etc. See src/index.ts.
HTTP routes
Summarized in User guide — HTTP endpoints.
Example
examples/express-host — minimal host with an authorize stub and worker dial settings.
Build
pnpm --filter @atriumjs/express run buildMIT — see repository LICENSE.
