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

@arindam923/flashdb-client

v0.2.0

Published

Realtime key-value database with WebSocket API

Readme

@arindam923/flashdb-client

Realtime key-value database client for React with WebSocket connectivity.

Features

  • Realtime Subscriptions - Subscribe to key changes with instant updates
  • React Hooks - Simple hooks for fetching and mutating data
  • Optimistic Updates - Instant UI updates with automatic background sync
  • Auto Reconnection - Automatic WebSocket reconnection with exponential backoff
  • TypeScript - Full TypeScript support

Installation

npm install @arindam923/flashdb-client

Quick Start

import { FlashDB, FlashDBProvider, useValue, useMutation } from '@arindam923/flashdb-client';

const db = new FlashDB({
  url: 'ws://localhost:8080/ws',
  token: 'your-jwt-token'
});

function App() {
  return (
    <FlashDBProvider client={db}>
      <Counter />
    </FlashDBProvider>
  );
}

function Counter() {
  const { value: count, version, loading } = useValue('counter');
  const { mutate, loading: mutating } = useMutation('counter');
  
  const handleClick = () => {
    mutate((current) => (current ?? 0) + 1);
  };
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <button onClick={handleClick} disabled={mutating}>
      Count: {count ?? 0}
    </button>
  );
}

API

FlashDB Client

const db = new FlashDB({
  url: 'ws://localhost:8080/ws',  // WebSocket URL
  token: 'jwt-token',              // Optional JWT token
  reconnectDelay: 1000,            // Initial reconnect delay (ms)
  maxReconnectDelay: 30000         // Max reconnect delay (ms)
});

Methods

| Method | Description | |--------|-------------| | get(key) | Get value by key | | set(key, value) | Set value | | cas(key, value, version) | Compare-and-swap | | delete(key) | Delete a key | | subscribe(key, listener) | Subscribe to key changes | | getCached(key) | Get from local cache | | isConnected() | Check connection status | | destroy() | Close connection |

React Hooks

useValue(key)

Subscribe to a key's value with realtime updates.

const { value, version, loading, error } = useValue('my-key');

useMutation(key, options)

Set or delete values with automatic retry logic.

const { mutate, delete: del, loading, error } = useMutation('my-key');

// Simple set
await mutate({ name: 'Alice' });

// Optimistic update with function
await mutate(current => ({ ...current, count: (current?.count ?? 0) + 1 }));

// Delete
await del();

Options:

  • maxRetries - Max CAS retries (default: 10)

useConnection()

Track WebSocket connection state.

const { connected } = useConnection();

useOptimisticValue(key)

Instant local updates with server reconciliation.

const { value, setOptimistic, isOptimistic } = useOptimisticValue('counter');

// Instant update - UI updates immediately
setOptimistic(v => (v ?? 0) + 1);

Server Requirements

This client connects to a FlashDB server. See flashdb for server setup.

License

MIT