npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rosedb

v1.0.4

Published

High-performance embedded Key-Value & Document database engine written in Rust with Bun FFI & Node.js bindings (ACID, WAL, B+Tree, MVCC Snapshot Isolation, AES-256-GCM).

Readme

RoséDB

High-performance embedded Key-Value & Document database engine written in Rust with native bindings for Bun, Node.js, Go, and Python.

Fitur Utama

  • Storage Engine (rosedb-storage): Binary page 16 KiB little-endian dengan Slotted Data Pages (page packing), active dirty page buffer, overflow blob chaining, free page allocator, dan atomic manifest.rdb.
  • Write-Ahead Log (rosedb-wal): Append-only WAL (BEGIN, PUT, DELETE, COMMIT, ABORT, CHECKPOINT) dengan checksum CRC32C per record, zero-allocation encoding, pemotongan tail tidak lengkap saat crash, dan deteksi korupsi di tengah log.
  • Dual Index (rosedb-index): In-memory Hash Index untuk lookup O(1) + persistent B+Tree (index.rdb) untuk scan range & prefix query.
  • Sharded LRU Cache (rosedb-cache): 32-shard bounded LRU cache (max_memory, max_entries) untuk skalabilitas multi-reader.
  • MVCC & Snapshot Isolation (rosedb-core): Transaksi ACID, db.snapshot() untuk pembacaan konsisten tanpa memblokir writer, serta automatic garbage collection versi lama saat snapshot ditutup.
  • Keamanan (rosedb-security): Verifikasi integritas CRC32C, enkripsi opsional AES-256-GCM at rest dengan nonce acak per record, key derivation Argon2id, validasi batas key/value, proteksi path traversal, dan file permission ketat (0o700 / 0o600).
  • Multi-Language Bindings:
    • Bun: bun:ffi (bindings/bun/index.ts)
    • Node.js (>= 18): koffi (bindings/bun/node.mjs)
    • Go: cgo (bindings/go)
    • Python (>= 3.9): ctypes zero-dependency (bindings/python)

Instalasi (npm / Bun)

bun add rosedb

atau dengan npm:

npm install rosedb

Contoh Kode Setiap Bahasa

1. Bun / TypeScript

import { Database } from "rosedb";

const db = new Database("./rose-data", {
  sync_on_commit: true,
  encryption_password: "optional-secret-password",
});

db.put("username", "Blckrose");
console.log(db.get("username"));

db.put("session:1", "active", 60_000);

db.batch([
  { op: "put", key: "user:1", value: "Alice" },
  { op: "put", key: "user:2", value: "Bob" },
]);

console.log(db.mget(["user:1", "user:2", "missing"]));
console.log(db.scan("user:1", "user:2"));

const snap = db.snapshot();
db.put("username", "NewName");
console.log("Current:", db.get("username"));
console.log("Snapshot:", snap.get("username"));
snap.close();

db.checkpoint();
db.backup("./rose-backup");
console.log(db.stats());
console.log(db.integrityCheck());

db.close();

2. Node.js (ESM, >= 18.0.0)

import { Database } from "rosedb";

const db = new Database("./rose-data", {
  sync_on_commit: true,
  encryption_password: "optional-secret-password",
});

db.put("username", "Blckrose");
console.log(db.get("username"));

await db.putAsync("role", "developer");
console.log(await db.getAsync("role"));

db.batch([
  { op: "put", key: "item:1", value: "alpha" },
  { op: "put", key: "item:2", value: "beta" },
]);

console.log(db.mget(["item:1", "item:2", "missing"]));
console.log(db.scan("item:1", "item:2"));

const snap = db.snapshot();
db.put("username", "Updated");
console.log("Current:", db.get("username"));
console.log("Snapshot:", snap.get("username"));
snap.close();

db.checkpoint();
db.close();

3. Rust

use rosedb_core::Database;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let db = Database::open("./rose-data")?;
    db.put("username", b"Blckrose")?;

    let snap = db.snapshot()?;
    db.transaction(|tx| {
        tx.put("balance", b"50000")?;
        tx.put("username", b"Updated")?;
        Ok(())
    })?;

    assert_eq!(snap.get("username")?.as_deref(), Some(b"Blckrose".as_slice()));
    assert_eq!(db.get("username")?.as_deref(), Some(b"Updated".as_slice()));
    snap.close();

    db.checkpoint()?;
    db.close()?;
    Ok(())
}

4. Go (cgo)

package main

import (
	"fmt"
	"log"
	"rosedb"
)

func main() {
	pwd := "optional-secret-password"
	db, err := rosedb.Open("./rose-data", &rosedb.Options{
		EncryptionPassword: &pwd,
	})
	if err != nil {
		log.Fatal(err)
	}
	defer db.Close()

	if err := db.PutString("username", "Blckrose"); err != nil {
		log.Fatal(err)
	}
	val, ok, err := db.GetString("username")
	fmt.Println(val, ok, err)

	_ = db.Batch([]rosedb.BatchOp{
		{Op: "put", Key: "user:1", Value: "Alice"},
		{Op: "put", Key: "user:2", Value: "Bob"},
	})
	entries, _ := db.Scan([]byte("user:1"), []byte("user:2"), 0)
	fmt.Println("Scan:", entries)

	snap, _ := db.Snapshot()
	_ = db.PutString("username", "Updated")
	snapVal, _, _ := snap.Get([]byte("username"))
	fmt.Println("Snapshot:", string(snapVal))
	snap.Close()

	_ = db.Checkpoint()
}

5. Python (ctypes, >= 3.9)

from rosedb import Database

with Database("./rose-data", {"encryption_password": "optional-secret-password"}) as db:
    db.put("username", "Blckrose")
    print(db.get("username"))

    db.batch([
        {"op": "put", "key": "item:1", "value": "alpha"},
        {"op": "put", "key": "item:2", "value": "beta"},
    ])
    print(db.mget(["item:1", "item:2", "missing"]))
    print(db.scan("item:1", "item:2"))

    with db.snapshot() as snap:
        db.put("username", "Updated")
        print("Current:", db.get("username"))
        print("Snapshot:", snap.get("username"))

    db.checkpoint()
    print(db.stats())

Benchmark Lintas Bahasa

RoséDB Multi-Language Benchmark

Pengujian dijalankan pada hardware yang sama (Intel Xeon E5-2695 v4, value 128 byte, mode release):

| Operasi | Rust Native | Go (cgo) | Bun (bun:ffi) | Node.js (koffi) | Python (ctypes) | | --- | --- | --- | --- | --- | --- | | Single put (sync=true) | 182.031 ops/s | 172.124 ops/s | 112.179 ops/s | 110.889 ops/s | 99.963 ops/s | | Single put (sync=false) | 438.671 ops/s | 453.520 ops/s | 307.767 ops/s | 275.484 ops/s | 168.173 ops/s | | Batch 1.000 (sync=false) | 510.010 ops/s | 289.120 ops/s | 306.689 ops/s | 377.038 ops/s | 298.616 ops/s | | Random get | 1.527.514 ops/s | 846.064 ops/s | 510.442 ops/s | 596.199 ops/s | 215.777 ops/s | | Range scan (1.000 rows) | 2.070.149 rows/s | 3.740.054 rows/s | 1.377.148 rows/s | 1.201.920 rows/s | 845.147 rows/s |


Build dari Source & Pengujian

git clone https://github.com/Blckrose08/rosedb.git
cd rosedb
cargo build --release
cargo test --workspace
cd bindings/bun && bun test && node --test node.test.mjs
cd ../go && go test -v ./...
cd ../python && python3 -m unittest discover -s tests -v

Dokumentasi Lanjutan