v0.1.0
@sonuslab/storage-client
Typed client SDK for SonusLab Storage — server SDK, browser uploads, Vue composable, and webhook verification, all in one package.
bun add @sonuslab/storage-clientHow it fits together
The browser uploads bytes directly to R2 using a presigned URL minted by your backend. Your backend proxies to storage-api with the API key. The browser never sees the API key.
┌──────────┐ POST presign ┌────────────────┐ presign ┌─────────────┐ PUT ┌─────┐
│ Browser │ ──────────────────► │ Your server │ ────────────► │ storage-api │ ─────────► │ R2 │
│ (client) │ ◄────────────────── │ (server SDK) │ ◄──────────── │ │ │ │
└──────────┘ presign response └────────────────┘ headers └─────────────┘ └─────┘
│ ▲
│ PUT bytes (direct to R2) │
└─────────────────────────────────────┘
│
POST /complete ──────────────────────┘What's in the box
Server SDK
Mint presigned URLs, manage files, abort multiparts. Node, Bun, edge runtimes.
Learn more
Browser direct-to-R2
Upload helper that streams bytes straight to R2 via presigned PUTs.
Learn more
Vue 3 ready
useUpload composable and a headless <StorageUpload> component.
Learn more
What you'll need
- A storage app created in the dashboard — it provisions a real R2 bucket scoped to your account.
- An API key (the
sl_...token) from the app's Keys tab. - Your own backend server — any Node, Bun, or edge runtime. The API key lives there, not in the browser.
API keys are server-only
Never ship the storage-api key to the browser. Always proxy uploads through your own backend so the key stays server-side. The browser helper is designed around this pattern.