Documentation

Qortex DB

Browser Key-Value Database

A browser-only, Redis-like key-value database with localStorage, sessionStorage, and IndexedDB support.

Browser Only

This package is designed for browser environments only. All storage backends (localStorage, sessionStorage, IndexedDB) are browser APIs.

qortex-db provides a unified async API across browser storage backends. It's simple, fast, and consistent!

Installation

Install qortex-db using your preferred package manager:

Installation

# npm
npm install qortex-db
# yarn
yarn add qortex-db
# pnpm
pnpm add qortex-db

Quick Start

Create a database and start storing data:

Quick Start

import { createDB } from 'qortex-db';
// Simple usage (uses localStorage)
const db = createDB('myapp');
// With options
const db = createDB({ name: 'myapp', driver: 'indexedDB' });
// Basic operations
await db.set('user:1', { name: 'John', age: 30 });
const user = await db.get<User>('user:1');
const exists = await db.has('user:1');
await db.del('user:1');
// Find keys by pattern
const userKeys = await db.scan('user:*');
// Clear all data for this database
await db.drop();

Available Drivers

Choose the right storage driver for your use case: | Driver | Persistence | Capacity | Use Case | |--------|-------------|----------|----------| | `local` | Permanent | ~5MB | Default, most common | | `session` | Tab session | ~5MB | Temporary data | | `indexedDB` | Permanent | Large | Large datasets |

Key Features

- 🚀 **Unified API** - Same async interface for all storage backends - 🔒 **Key Namespacing** - Data isolation between database instances - 🔍 **Pattern Matching** - Find keys with wildcard patterns - 📦 **TypeScript** - Full type inference support - ⚡ **Tiny** - Under 3KB minified