---
title: "UniKVS"
description: "Overview and documentation guide for UniKVS, a modular KVS client built with TypeScript."
---

## What is UniKVS [#what-is-unikvs]

UniKVS is a modular and portable KVS client built with TypeScript. It combines Transformers that transparently convert data with Storages that write to multiple backends, using a builder pattern.

Its main features are:

- Transparent encoding and decoding via Transformers.
- Parallel writes to multiple Storages.
- Per-key Value types that control available operations at the type level.
- Runtime validation of input and output values with Valibot schemas.
- Support for both single values and streams.
- Cancellation via `AbortSignal` and passing of runtime variables.
- Storages for both Node.js and browsers.

## Quickstart [#quickstart]

```package-install
npm i unikvs @unikvs/compression @unikvs/fs.node
```

```ts
import { Compression } from "@unikvs/compression";
import { NodeFs } from "@unikvs/fs.node";
import { UniKvs, type Value } from "unikvs";

const kvs = UniKvs.config<{
  foo: Value<Uint8Array<ArrayBuffer>>;
}>()
  .appendTransformer(new Compression("gzip"))
  .appendStorage(new NodeFs(".tmp"))
  .create();

await kvs.open();

await kvs.set("foo", Uint8Array.from([0, 1, 2]));

const bytes = await kvs.get("foo");

await kvs.close();
```

The example above transparently compresses the bytes for key `foo` with gzip and saves them under `.tmp/`.

:::tip
Start with the minimal memory example, then see concepts for how it works.
:::

## How to read the docs [#how-to-read]

**[Getting started](/unikvs/en/getting-started)**

Try the shortest path from installation to basic operations.

**[Concepts](/unikvs/en/concepts)**

Understand pipelines, Value types, and variables.

**[Guides](/unikvs/en/guides)**

See usage patterns for specific goals.

**[Storage comparison](/unikvs/en/reference/comparison)**

Guidance for choosing a storage backend.

## Packages [#packages]

**[UniKVS](/unikvs/en/packages/unikvs)**

The config builder and KVS client itself.

**[@unikvs/core](/unikvs/en/packages/core)**

Shared types and error foundation for all packages.

**[@unikvs/utils](/unikvs/en/packages/utils)**

Shared helpers for plugin authors.

**[@unikvs/compression](/unikvs/en/packages/compression)**

Compresses and decompresses with gzip, deflate, and deflate-raw.

**[@unikvs/checksum](/unikvs/en/packages/checksum)**

Validates MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.

**[@unikvs/json](/unikvs/en/packages/json)**

Serializes values to JSON, or to JSON Lines in streams.

**[@unikvs/superjson](/unikvs/en/packages/superjson)**

Serializes values with SuperJSON, preserving Date, Map, Set, BigInt, and undefined.

**[@unikvs/cbor](/unikvs/en/packages/cbor)**

Serializes values to CBOR, or to a CBOR sequence in streams.

**[@unikvs/memory](/unikvs/en/packages/memory)**

Stores arbitrary data in memory.

**[@unikvs/fs.node](/unikvs/en/packages/fs-node)**

Stores data in the Node.js local filesystem.

**[@unikvs/fs.bun](/unikvs/en/packages/fs-bun)**

Stores data in the Bun local filesystem.

**[@unikvs/redis.bun](/unikvs/en/packages/redis-bun)**

Stores data in Redis with Bun's Redis client.

**[@unikvs/s3.node](/unikvs/en/packages/s3-node)**

Stores data in S3-compatible object storage.

**[@unikvs/s3.bun](/unikvs/en/packages/s3-bun)**

Stores data in S3-compatible object storage from Bun.

**[@unikvs/opfs](/unikvs/en/packages/opfs)**

Stores data in the browser OPFS.

**[@unikvs/indexeddb](/unikvs/en/packages/indexeddb)**

Stores data in the browser IndexedDB.

**[@unikvs/writeonly](/unikvs/en/packages/writeonly)**

Turns an existing storage into write-only storage.

**[@unikvs/debug](/unikvs/en/packages/debug)**

Logs the operations and debug information of data read and written.

**[@unikvs/passthrough](/unikvs/en/packages/passthrough)**

Passes data through without transforming it.

## Environments [#environments]

| Package | Node.js | Bun | Browser |
| --- | --- | --- | --- |
| `unikvs` | Supported. | Supported. | Supported. |
| `@unikvs/core` | Supported. | Supported. | Supported. |
| `@unikvs/utils` | Supported. | Supported. | Supported. |
| `@unikvs/compression` | Supported. | Supported. | Supported. |
| `@unikvs/checksum` | Supported. | Supported. | Supported. |
| `@unikvs/json` | Supported. | Supported. | Supported. |
| `@unikvs/superjson` | Supported. | Supported. | Supported. |
| `@unikvs/cbor` | Supported. | Supported. | Supported. |
| `@unikvs/memory` | Supported. | Supported. | Supported. |
| `@unikvs/fs.node` | Supported. | Not supported. | Not supported. |
| `@unikvs/fs.bun` | Not supported. | Supported. | Not supported. |
| `@unikvs/redis.bun` | Not supported. | Supported. | Not supported. |
| `@unikvs/s3.node` | Supported. | Not supported. | Not supported. |
| `@unikvs/s3.bun` | Not supported. | Supported. | Not supported. |
| `@unikvs/opfs` | Not supported. | Not supported. | Supported. |
| `@unikvs/indexeddb` | Not supported. | Not supported. | Supported. |
| `@unikvs/writeonly` | Supported. | Supported. | Supported. |
| `@unikvs/debug` | Supported. | Supported. | Supported. |
| `@unikvs/passthrough` | Supported. | Supported. | Supported. |
