Object storage
without the baggage. โ
Sobj is a type-safe, simple, and functional object storage client for TypeScript. Use one unified API for any backend.
import { sobj } from "sobj"
// -> @sobj/s3, @sobj/r2, @sobj/b2, @sobj/minio, etc.
import { s3 } from "@sobj/s3"
const storage = sobj(s3({ ... }))
await storage.put("hello.txt", "Hello, world!")
const object = await storage.get("hello.txt")
console.log(object);๐ One API. Any storage. โ
Sobj separates your application logic from the storage engine.
The core library provides a lightweight, functional API, while adapters implement the actual connection to the backend.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your App โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Sobj โ
โ โ
โ put ยท get ยท delete ยท list ยท head โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโ
โ Adapter โ
โโโโโโโฌโโโโโโ
โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โผ โผ โผ
Memory S3 R2 ...
(Local/Test) (AWS) (Cloudflare)With Sobj, your application depends strictly on Sobj's unified interface. You can swap your storage engine from an in-memory database during local testing to S3, R2, B2, or MinIO in production without changing a single line of business code.
โจ Key Features โ
Sobj is built focusing on API design and runtime compatibility.
Composable โ
Adapters implement the storage boundary. The core remains clean and independent from the underlying provider's SDKs.
Type-Safe โ
The API is typed from the ground up, verifying that only operations supported by the configured adapter are exposed at compile-time.
Runtime Agnostic โ
Use Sobj anywhere JavaScript runs: Node.js, Deno, Bun, Cloudflare Workers, or browser environments.
๐ฆ Built for Object Storage โ
Sobj targets the primary operations that modern applications need to build:
await storage.put(key, body)
await storage.get(key)
await storage.head(key)
await storage.delete(key)
await storage.list()Advanced tasks like pre-signed URLs, copy operations, versioning, and multipart uploads are exposed dynamically by adapters that support them.
๐ Supported backends โ
Sobj maintains multiple adapters separated from the core package to keep your build footprint lightweight.
In-Memory Storage
@sobj/memory โ A mock storage adapter that holds files in memory. Ideal for writing quick unit tests or running local sandboxes without live clouds.
Cloudflare R2
@sobj/r2 โ Directly interacts with the Cloudflare R2 bucket S3-compatible endpoints using native fetch APIs and Web Crypto.
Custom Adapter
Build your own adapter to implement local folder storage or support a custom API backend.
๐ Getting Started โ
Choose your adapter and install the packages:
pnpm add sobj @sobj/memoryDefine the client, and you are ready to write and read objects:
import { sobj } from 'sobj'
import { memory } from '@sobj/memory'
const storage = sobj(memory())