Back to Home
qortex-db
Browser Key-Value Database

qortex-db

A Redis-like async key-value database for browsers. Unified API across localStorage, sessionStorage, and IndexedDB.

npm install qortex-db

Quick Start

import { createDB } from 'qortex-db';
// Simple usage (uses localStorage by default)
const db = createDB('myapp');
// Or with options
const db = createDB({ name: 'myapp', driver: 'indexedDB' });
// Store data
await db.set('user:1', { name: 'John', age: 30 });
// Retrieve data
const user = await db.get<User>('user:1');
// Check existence
const exists = await db.has('user:1');
// Delete
await db.del('user:1');
// Find keys by pattern
const userKeys = await db.scan('user:*');
// Clear all data
await db.drop();

Features

Unified API

Same async interface for all storage backends

Multiple Drivers

localStorage, sessionStorage, and IndexedDB

TypeScript First

Full type inference and safety

Key Namespacing

Data isolation between database instances

Pattern Matching

Find keys with wildcard patterns

Tiny Bundle

Under 3KB minified and gzipped

API Reference

MethodDescription
get<T>(key)Retrieve a value by key
set(key, value)Store a value (JSON serialized)
has(key)Check if a key exists
del(key)Delete a key-value pair
scan(pattern)Find keys matching pattern (* wildcard)
drop()Delete all data for this database

Storage Drivers

local

localStorage

Default, most common use case

Persistence: PermanentCapacity: ~5MB
session

sessionStorage

Cleared when tab closes

Persistence: Tab sessionCapacity: ~5MB
indexedDB

IndexedDB

For large datasets

Persistence: PermanentCapacity: Large

Tiny Bundle Size

Lightweight and optimized for performance.

~1.2KBmin + gzip

1.2KB / 10KB Performance Budget

Minified Size2.7KB
Dependencies0
Tree Shaking
Supported

Ready to get started?

npm install qortex-db

Back to Home