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

@sampathkumara/realtime-sync-server

v1.0.25

Published

Real-time data synchronization server with LokiJS and Socket.IO. Self-hosted, offline-first sync for Node.js applications.

Readme

Sync Server

High-performance, real-time data synchronization server built with LokiJS, Socket.IO, and Express. This server is designed for applications that require instant data updates and efficient client-server communication.

Key Features

  • Real-time Sync: Uses Socket.IO to push changes to clients instantly.
  • RESTful API: Provides a complete REST API for standard HTTP interactions.
  • Efficient In-Memory Database: Powered by LokiJS for extremely fast data access.
  • Delta Synchronization: Only sends changes since the client's last sync time, saving bandwidth.
  • Bulk Operations: Optimized endpoints for high-performance bulk inserts, updates, and deletes.
  • Change Consolidation: In-memory consolidation of changes to reduce database I/O and ensure only the net change is logged.
  • Configurable: Easily configure the server, logging, and database settings using a .env file.
  • Structured Logging: Uses Winston for structured, leveled logging.
  • Compression: Enables per-message deflate compression to reduce bandwidth.

Getting Started

1. Installation

npm install

2. Configuration

Create a .env file in the root of the project. You can copy the .env.example file to get started:

cp .env.example .env

Modify the .env file to customize your settings:

# Server Configuration
PORT=3000
CORS_ORIGIN=*

# Database Configuration
DB_PATH=./data/sync.db
DB_AUTOSAVE=true
DB_AUTOSAVE_INTERVAL=5000

# Logging Configuration
LOG_LEVEL=info
LOG_ENABLED=true
LOG_FILE=./logs/sync-server.log
LOG_ERROR_FILE=./logs/sync-server-error.log

# Bulk Operation Configuration
DEFAULT_BATCH_SIZE=500
BATCH_DELAY_MS=5

# Compression Configuration
COMPRESSION_ENABLED=true

# Socket.IO Transports (comma-separated: websocket,polling)
TRANSPORTS=websocket,polling

3. Running the Server

import { SyncServer } from './src/SyncServer';

// Default server
const server = new SyncServer();
server.start();

// Server with a separate .env file
const server2 = new SyncServer({
  envFilePath: './.env.server2',
});
server2.start();

// Server with custom parameters
const server3 = new SyncServer({
  port: 3003,
  dbPath: './data/server3.db',
  transports: ['polling'], // Force polling for this instance
});
server3.start();

API Documentation

For a detailed API reference, see API_DOCUMENTATION.md.

Development

# Install dependencies
npm install

# Run development server with hot-reloading
npm run dev

# Build for production
npm run build

# Start production server
npm start

License

MIT