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

@codecious/dataruni

v0.0.5

Published

Unified Database System for PWA React projects (React + any other database)

Readme

Dataruni

Dataruni is a lightweight, unified database system designed for React applications. It bridges the gap between persistent local storage (IndexedDB) and React state, providing a seamless "sync-to-state" experience for offline-first applications.

Built originally for the Codecious ecosystem, Dataruni abstracts away the complexity of IndexedDB, offering a simple hook-based API that feels just like useState, but with the power of a robust database backing it up.

Features

  • 🚀 React-First API: Use useDataruniValue just like useState.
  • 💾 IndexedDB Powered: Handles large datasets asynchronously without blocking the UI.
  • 🔄 State Synchronization: Automatically loads data on mount and persists updates in the background.
  • 📦 Zero-Config: Works out of the box with sensible defaults, but fully configurable.
  • 🔒 Type-Safe: Built with TypeScript for full type inference.
  • 📱 Offline Ready: Perfect for PWAs and mobile-first web apps.

Installation

npm install @codecious/dataruni
# or
pnpm add @codecious/dataruni
# or
yarn add @codecious/dataruni

Usage

Basic Usage

The core of Dataruni is the useDataruniValue hook. It binds a database key to a React state variable.

import { useDataruniValue } from '@codecious/dataruni';

// Define your configuration once
const dbConfig = {
  dbName: 'MyAppDB',
  dbVersion: 1,
  storeName: 'my-store' // Optional, defaults to 'dataruni-store'
};

function AppSettings() {
  // usage is identical to useState, but with a key and config
  const [theme, setTheme, isLoading] = useDataruniValue<string>(
    'app-theme', // Key in the database
    'light',     // Default value
    dbConfig     // Database configuration
  );

  if (isLoading) {
    return <div>Loading preferences...</div>;
  }

  return (
    <button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
      Current theme: {theme}
    </button>
  );
}

Advanced Configuration

You can manage complex objects and arrays easily. Dataruni handles the serialization and storage for you.

interface UserProfile {
  id: string;
  name: string;
  preferences: {
    notifications: boolean;
  };
}

const [user, setUser] = useDataruniValue<UserProfile | null>(
  'user-profile',
  null,
  dbConfig
);

// Updates are persisted automatically
const updateName = (newName: string) => {
  setUser(prev => prev ? { ...prev, name: newName } : null);
};

API Reference

useDataruniValue<T>(key, defaultValue, config)

The main hook for data persistence.

  • Parameters:

    • key (string): The unique identifier for the data in the store.
    • defaultValue (T): The value to use if no data is found in the DB or while loading.
    • config (DataruniConfig): Configuration object for the database connection.
  • Returns: [value, setValue, isLoading]

    • value (T): The current state.
    • setValue (function): Function to update state and persist to DB. Accepts a value or a callback (prev) => newValue.
    • isLoading (boolean): True while the initial value is being fetched from IndexedDB.

initDB(config)

Initializes the IndexedDB connection. Useful for pre-loading or side-effects outside of React components.

  • Parameters:

    • config (DataruniConfig): { dbName: string, dbVersion?: number, storeName?: string }
  • Returns: Promise<IDBDatabase>

License

MIT © Codecious