sobj

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.

ts
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.

text
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              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:

ts
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.

๐Ÿš€ Getting Started โ€‹

Choose your adapter and install the packages:

bash
pnpm add sobj @sobj/memory

Define the client, and you are ready to write and read objects:

ts
import { sobj } from 'sobj'
import { memory } from '@sobj/memory'

const storage = sobj(memory())