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

sagadb

v1.0.0

Published

A high-performance, TypeScript-based JSON database with advanced caching and backup features, optimized for Bun runtime.

Readme

SagaDB 🚀

A high-performance, TypeScript-based JSON database with advanced caching and backup features, optimized for Bun runtime.

Features ✨

  • 🔥 In-memory caching for blazing-fast reads
  • 💾 Automatic local and network backups
  • 🔄 Retry mechanism for network operations
  • 📊 JSON Schema validation support
  • 🎯 Type-safe operations with TypeScript
  • ⚡ Optimized for Bun runtime
  • 🚄 Asynchronous I/O operations

Installation 📦

bun add sagadb

Benchmark 📊:

| Metric | Speed | Time per Operation | Faster than 1 ms? | |------------------|----------------------------|---------------------|--------------------| | Write Speed | 1,671.82 ops/sec | 0.598 ms | Yes | | Read Speed | 292,315.74 ops/sec | 0.00342 ms | Yes |

Benchmark Summary

  • Write Speed: The write operations are completed at a speed of approximately 1,671.82 operations per second, translating to 0.598 ms per operation.
  • Read Speed: The read operations achieve an impressive speed of around 292,315.74 operations per second, or 0.00342 ms per operation.
  • Performance: Both read and write operations are faster than 1 ms, making this JSON database module highly suitable for applications requiring quick data access.

Quick Start 🌟

import { SagaDB } from 'sagadb';
import { useLocalBackup } from 'sagadb/backup';

// Initialize with local backup
const db = new SagaDB({
  dbPath: 'mydb.json',
  backup: useLocalBackup({
    backupPath: './backups',
    maxBackups: 5
  })
});

// Basic operations
await db.set('user:1', { name: 'John', age: 30 });
const user = await db.get('user:1');
await db.delete('user:1');

Backup Strategies 🔒

Local Backup 💻

const db = new SagaDB({
  dbPath: 'mydb.json',
  backup: useLocalBackup({
    backupPath: './backups',
    maxBackups: 5
  })
});

Network Backup ☁️

const db = new SagaDB({
  dbPath: 'mydb.json',
  backup: useNetworkBackup({
    url: 'https://your-backup-server.com/backup',
    retries: 3,
    backupPath: './backups' // Optional local fallback
  })
});

Performance 🏃‍♂️

The database utilizes Node-Cache for in-memory caching, providing:

  • Lightning-fast read operations
  • Efficient write operations with automatic backup
  • Optimized for high-throughput scenarios

Type Safety 🛡️

Built with TypeScript for complete type safety:

interface User {
  name: string;
  age: number;
}

const user = await db.get<User>('user:1');
// user is typed as User | undefined

Development 🛠️

# Install dependencies
bun add

# Build the project
bun run build

# Run tests
bun test

# Start the demo
bun start

License 📄

MIT

Contributing 🤝

Contributions are welcome! Please feel free to submit a Pull Request.