Drivers
Choose a storage backend without changing the API used by your application.
A driver connects unstorage to a specific backend. Pass one as the default driver or mount it under a key prefix.
import { createStorage } from "unstorage";
import redisDriver from "unstorage/drivers/redis";
const storage = createStorage({
driver: redisDriver({ base: "my-app" }),
});Without a driver option, createStorage() uses the memory driver.
#Driver catalog
#Local and runtime storage
| Backend | Driver import | Notes |
|---|---|---|
| Memory | unstorage/drivers/memory | Default, process-local storage with TTL support. |
| Filesystem | unstorage/drivers/fs | Node.js filesystem with optional watching. |
| Filesystem Lite | unstorage/drivers/fs-lite | Node.js filesystem without watching dependencies. |
| Browser storage | unstorage/drivers/localstorage | localStorage or a compatible storage object. |
| Session storage | unstorage/drivers/session-storage | Browser sessionStorage. |
| IndexedDB | unstorage/drivers/indexeddb | Browser database through idb-keyval. |
| Capacitor Preferences | unstorage/drivers/capacitor-preferences | Mobile preferences and web fallback. |
| Deno KV | unstorage/drivers/deno-kv | Deno runtime and Deno Deploy. |
| Deno KV for Node.js | unstorage/drivers/deno-kv-node | Remote or local Deno KV through @deno/kv. |
| LRU Cache | unstorage/drivers/lru-cache | Bounded in-process cache. |
| Null | unstorage/drivers/null | Discards writes; useful for disabling storage. |
| Overlay | unstorage/drivers/overlay | Writable top layer over one or more fallback layers. |
#Databases and managed key-value stores
| Backend | Driver import | Notes |
|---|---|---|
| SQL with db0 | unstorage/drivers/db0 | Works with db0 connectors such as SQLite, PostgreSQL, and libSQL. |
| MongoDB | unstorage/drivers/mongodb | MongoDB collection-backed storage. |
| PlanetScale | unstorage/drivers/planetscale | PlanetScale serverless driver. |
| Redis | unstorage/drivers/redis | Redis and Redis Cluster through ioredis. |
| Upstash Redis | unstorage/drivers/upstash | HTTP-based Upstash Redis client. |
#Cloud and object storage
| Backend | Driver imports | Notes |
|---|---|---|
| Azure | unstorage/drivers/azure-app-configuration, unstorage/drivers/azure-cosmos, unstorage/drivers/azure-key-vault, unstorage/drivers/azure-storage-blob, unstorage/drivers/azure-storage-table | App Configuration, Cosmos DB, Key Vault, Blob Storage, and Table Storage. |
| Cloudflare | unstorage/drivers/cloudflare-cache-binding, unstorage/drivers/cloudflare-kv-binding, unstorage/drivers/cloudflare-kv-http, unstorage/drivers/cloudflare-r2-binding | Cache, KV, and R2 bindings, plus KV HTTP access. |
| S3-compatible storage | unstorage/drivers/s3 | Amazon S3, Cloudflare R2, and compatible object stores. |
| Netlify Blobs | unstorage/drivers/netlify-blobs | Netlify deploy and named blob stores. |
| Vercel | unstorage/drivers/vercel-runtime-cache or unstorage/drivers/vercel-blob | Runtime cache or persistent blob storage. |
| UploadThing | unstorage/drivers/uploadthing | UploadThing file storage. |
#Remote and read-only sources
| Backend | Driver import | Notes |
|---|---|---|
| HTTP | unstorage/drivers/http | Any compatible HTTP endpoint, including the unstorage server handler. |
| GitHub | unstorage/drivers/github | Read-only files from a GitHub repository. |
#Driver dependencies
The core package has no runtime dependencies. Drivers that integrate third-party libraries load them lazily on first use, so install only the packages required by your selected drivers. Each driver page includes its install command.
Most drivers that load a third-party library accept a lib option. Without it, the library is imported at runtime using a specifier that bundlers intentionally do not resolve, so it is never bundled and has to be resolvable from node_modules at runtime (first from the current working directory, then from unstorage itself). Use lib to let your bundler include the library (for example, in serverless or edge deployments) or when you prefer an explicit import:
import { createStorage } from "unstorage";
import redisDriver from "unstorage/drivers/redis";
import * as ioredis from "ioredis";
const storage = createStorage({
driver: redisDriver({
lib: ioredis,
// lib: () => import("ioredis"), // sync or async factory also works
}),
});Azure drivers can also accept identityLib for @azure/identity. Whether it is required depends on the selected authentication method. The db0 driver is different: pass an already configured database instance instead of a lib module.
#Introspecting dependencies
Driver modules export DRIVER_DEPENDENCIES. The root package aggregates this information as builtinDriverDependencies, which is useful for frameworks and configuration tooling:
import { builtinDriverDependencies } from "unstorage";
const dependencies = builtinDriverDependencies["redis"];
// { lib: { name: "ioredis", version: "..." } }An entry with optional: true is needed only for certain features or configurations. For example, chokidar is only required by the fs driver's watch() implementation. Drivers with no third-party dependencies are absent from this map.
name is the npm package to install. When the driver imports a subpath of it, the entry also has an import field with the exact specifier to import (for example { name: "uploadthing", import: "uploadthing/server" }); when import is absent, the specifier is name.
builtinDrivers maps every supported driver name to its import specifier:
import { builtinDrivers } from "unstorage";
builtinDrivers["redis"];
// "unstorage/drivers/redis"#Choosing a driver
Before selecting a backend, consider:
- Runtime: some drivers require Node.js, a browser, or a platform binding.
- Persistence: memory and runtime caches are intentionally ephemeral.
- Key listing: some services cannot implement
getKeysefficiently or at all. - TTL and metadata: these are backend-specific capabilities.
- Raw values: binary support and returned types differ by driver.
- Consistency and limits: managed services may impose size, latency, or consistency constraints.
Check the driver's options and limitations before relying on backend-specific behavior. The common storage API remains the same, but unsupported optional operations may use a fallback or return no results.