SonusLab StorageSonusLab Storage
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-client

How 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

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.

Ready to upload?

Five-minute walk through from zero to a finished upload.

Start the quickstart