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

local-village

v0.1.2

Published

Local-first, offline-first React library for building reliable applications with seamless sync

Readme

local-village

A local-first, offline-first React library for building reliable applications with seamless sync.

npm version TypeScript License: MIT

Features

  • Offline-First: All data operations work instantly, even without network connectivity
  • Automatic Sync: Changes sync automatically when online, with conflict resolution
  • Real-time Updates: WebSocket-based real-time collaboration with presence tracking
  • Type-Safe: Full TypeScript support with strict typing
  • React Hooks: Intuitive hooks-based API for React applications
  • IndexedDB Storage: Persistent local storage using IndexedDB
  • Conflict Resolution: Built-in strategies with custom resolution support
  • DevTools: Built-in debugging panel for development

Installation

npm install local-village
# or
yarn add local-village
# or
pnpm add local-village

Requirements

  • React 18+
  • Modern browser with IndexedDB support

Quick Start

1. Wrap Your App

import { LocalVillageProvider } from 'local-village'

function App() {
  return (
    <LocalVillageProvider
      config={{
        database: { name: 'my-app' },
        sync: {
          serverUrl: 'http://localhost:3000',
          autoSync: true,
        },
      }}
    >
      <YourApp />
    </LocalVillageProvider>
  )
}

2. Query Data

import { useLocalQuery } from 'local-village'

function TodoList() {
  const { data: todos, loading, error } = useLocalQuery('todos', {
    where: { completed: false },
    orderBy: { field: 'createdAt', direction: 'desc' },
  })

  if (loading) return <div>Loading...</div>
  if (error) return <div>Error: {error.message}</div>

  return (
    <ul>
      {todos.map((todo) => (
        <li key={todo.id}>{todo.title}</li>
      ))}
    </ul>
  )
}

3. Mutate Data

import { useLocalMutation } from 'local-village'

function AddTodo() {
  const { create } = useLocalMutation('todos')

  const handleAdd = async () => {
    await create({
      title: 'New todo',
      completed: false,
      createdAt: Date.now(),
    })
  }

  return <button onClick={handleAdd}>Add Todo</button>
}

React Hooks

| Hook | Description | |------|-------------| | useLocalQuery | Query data with filtering, sorting, and pagination | | useLocalDocument | Get a single document by ID | | useLocalMutation | Create, update, and delete operations | | useLocalState | Persistent local state (like useState but persisted) | | useSyncStatus | Monitor sync state and pending operations | | useConflicts | Handle and resolve sync conflicts | | useNetworkStatus | Monitor online/offline status | | useRealtime | WebSocket connection and subscriptions | | usePresence | Real-time presence in rooms |

Offline-First Architecture

┌─────────────────────────────────────────────────────────┐
│                        Client                            │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐  │
│  │  React App  │───▶│    Store    │───▶│  IndexedDB  │  │
│  └─────────────┘    └─────────────┘    └─────────────┘  │
│         │                  │                             │
│         │                  ▼                             │
│         │           ┌─────────────┐                      │
│         └──────────▶│ Sync Engine │◀──── WebSocket ────┤
│                     └─────────────┘                      │
└─────────────────────────────────────────────────────────┘

All data is stored locally in IndexedDB first, making reads and writes instant. Changes sync to the server when online.

DevTools

Add the DevTools panel for debugging:

import { DevToolsProvider, DevToolsPanel } from 'local-village'

function App() {
  return (
    <LocalVillageProvider config={...}>
      <DevToolsProvider>
        <YourApp />
        {process.env.NODE_ENV !== 'production' && <DevToolsPanel />}
      </DevToolsProvider>
    </LocalVillageProvider>
  )
}

Server Package

For the server-side sync endpoint, install local-village-server:

npm install local-village-server

Documentation

License

MIT