# TypeScript SDK

`@dreamlake/dreamdb` is the TypeScript-first client for the DreamDB protocol. It runs in Node 20+ **and** the browser, with zero runtime dependencies, and talks directly to any S3-compatible backend — no application server in the middle.

## What's in the package

| Concept | Description |
|---|---|
| **`Schema`** | Declarative builder for dataset fields (image, video, audio, embedding, scalar). |
| **`Dataset`** | Versioned multimodal collection. Create, open, append, query, snapshot, branch, merge, compact, delete. |
| **`Space`** | Read-side view of a Manifest + its Tracks. Designed for browsers, SSR, and CLIs that only consume. |
| **`Backend`** | Pluggable storage. Two built-in: `S3Backend` (any S3-compatible HTTP endpoint) and `MemoryBackend` (tests). |
| Query primitives | `normalizeL2`, `dotL2Normalized`, RaBitQ + PQ decoders, LSH + IMI helpers — for code that drops below the high-level API. |

## Read the docs

- [Install](/typescript-sdk-install.md) — npm install + runtime requirements
- [Quickstart](/typescript-sdk-quickstart.md) — your first dataset in 30 lines
- [API reference](/typescript-sdk-api.md) — every public export with signatures
- [Browser usage](/typescript-sdk-browser.md) — `Space.fromUri`, blob URLs, the read path
- [React example](/typescript-sdk-react.md) — minimal grid of thumbnails
- [Semantic search](/typescript-sdk-semantic-search.md) — CLIP text encoder + `iterVector`

## Architecture

```
┌──────────────────┐    ┌──────────────────────┐    ┌──────────────────┐
│  Your code       │───▶│  @dreamlake/dreamdb  │───▶│  Object store    │
│  (Node/Browser)  │    │  (zero-dep client)   │    │  S3 / MinIO / R2 │
└──────────────────┘    └──────────────────────┘    └──────────────────┘
            HTTP only · content-addressed · spec-driven
```

Compatible with any backend that speaks S3-style HTTP GET/PUT (MinIO, AWS S3, Cloudflare R2, Wasabi, Backblaze B2). AWS SigV4 is auto-detected from the standard `AWS_*` env vars.

## Source

`dreamdb-ts/` in this workspace. The package is also published standalone at [`dreamlake-ai/dreamdb-ts`](https://github.com/dreamlake-ai/dreamdb-ts).
