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

remodb

v1.0.0

Published

A remote database system with automatic sync

Readme

RemoDB

A lightweight, real-time remote database system that syncs data between clients and a server using WebSockets and MessagePack for efficient serialization. Supports nested objects with automatic syncing.

Features

  • Real-time Sync: Changes to the database are automatically synced across connected clients.
  • Nested Objects: Supports setting and getting nested properties like database.user.profile.name.
  • Event-Driven: Server and Client emit events for connection states and errors.
  • Efficient: Uses MessagePack for fast serialization and WebSockets for low-latency communication.
  • Persistent: Data is saved to a file (JSON or compressed RDB format).
  • Authentication: Token-based authentication for secure connections.

Installation

npm install remodb

Quick Start

Server

import { Server } from 'remodb';

const server = new Server('./data.rdb', { port: 8080 });
server.on('start', (event) => {
  console.log(`Server running on port ${event.port} with token: ${event.authToken}`);
});

Client

import { Client } from 'remodb';

const client = new Client('ws://localhost:8080', serverAuthToken);
client.on('connect', () => {
  const db = client.database;
  db.key = 'value';
  console.log(db.key); // 'value'
});

API

Server

Constructor

new Server(filePath, options)
  • filePath: Path to the data file (.json or .rdb for compressed).
  • options: Object with port (default 8080) and authToken (auto-generated if not provided).

Events

  • 'start': Emitted when the server starts. Payload: { port, authToken }
  • Server extends EventEmitter.

Client

Constructor

new Client(host, authToken)
  • host: WebSocket URL (default 'ws://localhost:8080').
  • authToken: Authentication token from the server.

Properties

  • database: Proxy object for database operations. Acts like a regular JavaScript object but syncs changes.

Events

  • 'connect': Emitted when connected to the server.
  • 'disconnect': Emitted when disconnected.
  • 'error': Emitted on connection errors. Payload: error object.
  • Client extends EventEmitter.

Database Operations

The database proxy supports standard object operations:

const db = client.database;

// Set values
db.simple = 'value';
db.nested = { key: 'value' };
db.nested.key = 'updated';

// Get values
console.log(db.simple); // 'value'
console.log(db.nested.key); // 'updated'

// Delete (if implemented)
delete db.key;

Changes are automatically synced to the server and persisted.

Example

See example.js for a complete example of starting a server and client, and performing nested operations.

import { Server, Client } from 'remodb';

const server = new Server('./database.rdb', { port: 8080 });

setTimeout(() => {
  const client = new Client('ws://localhost:8080', server.authToken);

  client.on('connect', () => {
    const db = client.database;
    db.array = {};
    db.array.key = 'nested_value';
    db.key = 'root_value';
  });
}, 100);

Data Persistence

  • Data is saved to the specified file in JSON or compressed MessagePack (.rdb) format.
  • On server start, existing data is loaded.
  • Changes are saved immediately after each write.

Security

  • Use HTTPS/WebSocket Secure (wss://) in production.
  • The auth token should be kept secret; transmit securely.
  • Connections are validated with the token on each message.

Dependencies

  • ws: WebSocket implementation
  • msgpackr: MessagePack serialization

License

MIT