← /projects

Sonuslab Storage

File storage service with an npm SDK. Presigned uploads, a Cloudflare CDN, custom domains, and adapters for Vue, Svelte, and React. Used across all my apps.

Stack

  • Turborepo
  • Hono
  • Bun
  • TypeScript
  • Drizzle ORM
  • Postgres
  • Cloudflare R2
  • Cloudflare Workers
  • Nuxt 3
Sonuslab Storage preview

Overview

Sonuslab Storage started as the file layer behind Sonuslab and became a standalone service. It stores files on Cloudflare R2, serves them through a Workers CDN, and ships as the sonuslab-storage npm package. PDFmod, SmartzQuiz, Decibel Demon, and Shipnit all moved onto it.

  • npm SDK with adapters for Vue, Svelte, and React / Next.js
  • Presigned uploads straight from the browser to R2
  • CDN delivery at cdn.sonuslab.dev, or from your own domain
  • Dashboard for projects, keys, files, and webhooks

What it solves

Hosted upload services are convenient until the bill, the vendor lock-in, or the bundle size shows up, and raw S3 clients mean writing presigning, validation, and delivery again in every app. I was doing exactly that across half a dozen projects.

Sonuslab Storage is the one I wrote once. Each app gets a project and an API key, uploads go direct to R2, and files come back through the CDN. A built-in migration tool moved existing files over from UploadThing without touching user-facing URLs.

Highlights

  • Framework adapters for Vue, Svelte, and React / Next.js
  • Custom domains: the dashboard shows the DNS records to add
  • Webhooks and client-side encryption for sensitive files
  • UploadThing migration tool used to move every existing app over