# Install

```bash
npm install @dreamlake/dreamdb
# or pnpm / yarn / bun
pnpm add @dreamlake/dreamdb
```

## Requirements

- **Node 20+** — the SDK uses native `fetch`, `BigInt`, and `Uint32Array`.
- **Modern browsers** — any browser supporting ES2022 modules (Chrome 94+, Firefox 93+, Safari 15.4+).
- **Zero runtime dependencies.**

## Dual entry points

| Import | Use from | What's there |
|---|---|---|
| `@dreamlake/dreamdb` | Node, browser, SSR | Core: `Dataset`, `Schema`, `Space`, `S3Backend`, query primitives, CBOR helpers |
| `@dreamlake/dreamdb/browser` | Browser only | Adds `blobUrlFor()` for `<img>` / `<video>` rendering of blob fields |

Use the core entry from Node code; pull `browser` only where you actually need `URL.createObjectURL`.

## Verify

```bash
node -e 'import("@dreamlake/dreamdb").then(m => console.log(Object.keys(m).sort()))'
```

You should see `Dataset`, `Schema`, `Space`, `S3Backend`, `MemoryBackend`, plus the lower-level query primitives.

## ESM + CJS

The package ships both ESM (`dist/index.js`) and CJS (`dist/index.cjs`) with matching `.d.ts` / `.d.cts` type declarations. `package.json`'s `exports` map routes the right format automatically based on your project's `"type"`.

## Configuring credentials

The SDK never reads files. Credentials flow through the `Backend`:

```ts

const backend = new S3Backend("https://your-bucket.s3.us-east-1.amazonaws.com", {
  region: "us-east-1",
  accessKeyId: process.env.AWS_ACCESS_KEY_ID,
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
});
```

For **public-read** buckets (demo / fixtures), no credentials are needed — anonymous GET works.
