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

@oreefy/idb

v1.0.0

Published

A very lightweight, promise-based library for storing data in the browser's native IndexedDB on the client side.

Readme

@oreefy/http

A very lightweight, promise-based library for storing data in the browser’s native IndexedDB on the client side.

@oreefy/idb is a library built for the Oreefy ecosystem. The package is officially developed, maintained, and fully controlled by Oreefy, ensuring long-term stability, consistency, and compatibility across the ecosystem.

Browser only: This package is designed exclusively for frontend/browser environments. It requires the native IndexedDB API and is not intended for Node.js, server-side, or other non-browser environments.

Required Capabilities

  • JavaScript / TypeScript
  • A browser environment with native IndexedDB support
  • Frontend/client-side application

Example

The following example demonstrates a typical client-side usage:

import { idbInstance } from "@oreefy/idb";

async function example() {
  try {
    const idb = idbInstance();

    // Store data
    await idb.set("user", { id: 1234, name: "your_name" });

    // Retrieve data
    const user = await idb.get<{ id: number; name: string }>("user");
    console.log(user);

    // Delete specific data
    await idb.delete("user");

    // Clear all package data
    await idb.clear();
  } catch (err) {
    console.error("IndexedDB operation failed:", err);
  }
}

example(); // call the function

API Reference

Import idbInstance and create an IndexedDB instance:

import { idbInstance } from "@oreefy/idb";

try {
  const idb = idbInstance();

  await idb.get();
  await idb.set();
  await idb.delete();
  await idb.clear();
} catch (err) {
  console.error(err);
}

All operations are asynchronous and return Promises.

idb.get()

Retrieves data stored under a specific key.

import { idbInstance } from "@oreefy/idb";

try {
  const idb = idbInstance();
  await idb.get<T>("name"); // Promise<T | null>

  // Example
  const user = await idb.get<{ name: string; age: number }>("user");
  if (user) {
    console.log(user.name, user.age);
  }
} catch (err) {
  console.error(err);
}

Returns the stored value if the key exists. If no value is found, it returns null.

idb.set()

Stores or updates data using the specified key. If the key already exists, its existing value is replaced.

import { idbInstance } from "@oreefy/idb";

try {
  const idb = idbInstance();
  await idb.set<T>("name"); // Promise<T>

  // Example
  const user = { name: "your_name", isAdmin: true };

  const result = await idb.set<{ name: string; isAdmin: boolean }>(
    "user",
    user,
  );
  console.log(result); // { name: "your_name", isAdmin: true }
} catch (err) {
  console.error(err);
}

Returns the same data that was stored.

idb.delete()

Deletes the data stored under a specific key.

import { idbInstance } from "@oreefy/idb";

try {
  const idb = idbInstance();
  await idb.delete("name"); // Promise<true>

  // Example
  const result = await idb.delete("user");
  console.log(result); // true
} catch (err) {
  console.error(err);
}

If the specified key does not exist, the operation still completes successfully.

idb.clear()

Removes all data stored by @oreefy/idb.

import { idbInstance } from "@oreefy/idb";

try {
  const idb = idbInstance();
  await idb.clear(); // Promise<true>

  // Example
  await idb.clear();
  console.log("All data cleared");
} catch (err) {
  console.error(err);
}

Warning: clear() removes all data stored by this package. Use it carefully.

Storage Details

@oreefy/idb uses the browser's native IndexedDB API internally. The library manages its own IndexedDB database and object store, so you do not need to manually open a database or create an object store.

You only need to work with the simple API:

  • idb.get()
  • idb.set()
  • idb.delete()
  • idb.clear()

The actual storage is persistent browser storage and remains available across page reloads and browser sessions, subject to the browser's storage policies.

Browser Compatibility

This package depends on the native IndexedDB Web API. It is intended for modern browsers that provide IndexedDB support.

It is not designed for:

  • Node.js
  • Server-side applications
  • Backend services
  • Serverless runtime environments
  • Cloudflare Workers
  • Other non-browser JavaScript runtimes

Use this package when the code is running in a browser/client environment.

Error Handling

IndexedDB operations may fail due to browser storage restrictions, quota limitations, unavailable storage, or other browser-level errors.

All API methods return Promises, so errors can be handled with standard try...catch:

import { idbInstance } from "@oreefy/idb";

try {
  const idb = idbInstance();
  await idb.set("key", "value");
} catch (err) {
  console.error("Failed to store data:", err);
}

About Oreefy

Oreefy is an affordable business ecosystem designed for small to enterprise businesses. Oreefy provides essential software you need for your modern business within a single ecosystem. It will save you significant time, effort, and money.

License

MIT © Oreefy