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 🙏

© 2025 – Pkg Stats / Ryan Hefner

genosdb-server

v0.4.0

Published

GenosDB Server: A persistent Node.js peer for the GenosDB distributed graph database. Provides a reliable file-system storage layer, ensuring data durability and network resilience for your real-time, peer-to-peer applications.

Readme

GDB Data Synchronization Server

This repository contains the server-side implementation for a distributed graph database system. It acts as a Persistent P2P Data Synchronization Node/Server, enabling real-time data replication and consistency across a peer-to-peer network, with local file system persistence for data durability.

Core Features

  • Real-time P2P Synchronization: Utilizes WebRTC (via GenosRTC) for direct peer-to-peer communication and graph data synchronization.
  • Local File System Persistence: Graph data and synchronization state (timestamps) are persisted locally using MessagePack for graph serialization and JSON for timestamps, ensuring data is not lost on restart.
  • Automatic Conflict Resolution: Implements a Last-Write-Wins (LWW) strategy for conflict resolution based on Hybrid Logical Clocks (HLCs) to maintain data consistency across distributed nodes.
  • Compressed Data Transfer: Graph data is compressed using Pako (zlib compression) before network transmission or local storage to reduce bandwidth and disk space usage.
  • Built with Node.js & Express: The server is built using Node.js and includes a minimal Express.js server for potential API extensions or status monitoring.
  • SSE for Peer Monitoring: Includes a Server-Sent Events (SSE) endpoint (/events) and a basic HTML page (/) to visualize real-time P2P connections.

Architecture Overview

The server leverages a combination of technologies to achieve its goals:

  • CRDTs (Conflict-free Replicated Data Types) Principles: The LWW approach with HLCs is inspired by CRDT principles to ensure eventual consistency.
  • MessagePack (@msgpack/msgpack): For efficient binary serialization of graph data.
  • Pako: For GZIP compression/decompression of serialized data.
  • GenosRTC: Para la comunicación P2P y sincronización en tiempo real, usando el módulo interno de GenosDB.
  • Node.js File System (fs/promises): For asynchronous local storage operations.
  • WebRTC Polyfill (webrtc-polyfill): To ensure WebRTC compatibility within the Node.js environment.
  • Custom HybridClock: A custom implementation for generating hybrid logical timestamps used in conflict resolution.

Cada instancia del servidor se conecta a una "sala" P2P usando GenosRTC, basada en el nombre de la base de datos configurado. Los cambios se propagan entre los pares conectados y se resuelven usando la estrategia LWW con HLC. El estado del grafo y el timestamp global se guardan periódicamente en disco.

Key Components

  • GDBServer.js: The main file containing the GDBServer class, which orchestrates P2P communication, data persistence, and Express server setup.
  • Graph (class within GDBServer.js): A simple in-memory representation of the graph data structure with methods for node/edge manipulation and serialization.
  • HybridClock.js: Implements the Hybrid Logical Clock for generating timestamps that help order events in a distributed environment.

Getting Started

Prerequisites

  • Node.js (version X.X.X or higher recommended)
  • npm or yarn

Installation

  1. Clone the repository:
    git clone https://github.com/estebanrfp/gdb-server.git
    cd gdb-server
  2. Install dependencies:
    npm install
    # or
    # yarn install

Running the Server

You can run the server using Node.js. You can specify a room name as a command-line argument or via an environment variable.

# Run with the default room name ("default")
node GDBServer.js

# Run with a specific room name
node GDBServer.js my-graph-database

# Or using an environment variable
GDB_ROOM=my-special-room node GDBServer.js

# Console
export GDB_ROOM="todoList"