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

synqjs

v1.0.14

Published

A lightweight, Redis-backed job queue system for command execution with MongoDB persistence.

Readme

Synq

A lightweight, Redis-backed job queue system for command execution with MongoDB persistence.

Features

  • 🚀 Job Queue System - Submit, track, and execute shell commands asynchronously
  • ⚡ Redis Backend - Fast job queuing and atomic operations via Lua scripts
  • 💾 MongoDB Persistence - Job status and execution history storage
  • 🔄 Worker Processing - Background workers execute queued commands
  • ❌ Job Cancellation - Cancel jobs before or during execution
  • 🔍 Status Tracking - Real-time job status monitoring
  • 🧪 Race Condition Safe - Atomic operations prevent concurrent processing issues

Quick Start

Prerequisites

# Redis and MongoDB running locally or add your production URIs
redis-server
mongodb

Installation

Option 1: Install as npm package

npm install synqjs

Option 2: Local development

git clone <repository-url>
cd synq
npm install

Usage

There are three ways to use the Synq queue system:

Method 1: CLI Interface (Command Line)

The CLI can be used in multiple ways depending on how you install the package:

Global Installation (Recommended)
# Install globally first
npm install -g synqjs

# Then use directly
synq submit "echo Hello World"
synq status job-1234567890
synq cancel job-1234567890
Local Installation with npx
# Install locally
npm install synqjs

# Use with npx (no global install needed)
npx synq submit "echo Hello World"
npx synq status job-1234567890
npx synq cancel job-1234567890
Direct node execution (Development)
node src/cli.js submit "echo Hello World"
node src/cli.js status job-1234567890
node src/cli.js cancel job-1234567890

Method 2: Programmatic Function Calls (JavaScript/Node.js)

You can also use the queue system directly in your JavaScript/Node.js applications by importing the functions:

import { submitJob, getJobStatus, cancelJob } from "./src/queue.js";

// Submit a job programmatically
await submitJob("echo Hello from script");

// Check job status
await getJobStatus("job-1234567890");

// Cancel a job
await cancelJob("job-1234567890");
Example Script
// example-script.js
import { submitJob } from "./src/queue.js";

async function runBatchJobs() {
  // Submit multiple jobs
  await submitJob("echo Processing file 1");
  await submitJob("echo Processing file 2");
  await submitJob("ls -la");
  
  console.log("All jobs submitted!");
}

runBatchJobs().catch(console.error);

Method 3: Dashboard Monitoring

Monitor your jobs in real-time using the interactive dashboard:

# Start the dashboard
synq dashboard
# or for local development
node src/cli.js dashboard

The dashboard provides:

  • 📊 Real-time Statistics - Queue length, job counts by status
  • 🔄 Live Updates - Auto-refreshes every 2 seconds
  • 📋 Job Details - View currently running jobs and queue status
  • 🎯 Visual Interface - Clean, organized display of system state

Method 4: Hybrid Approach (CLI + Programmatic + Dashboard)

You can combine all methods in your workflow:

// batch-processor.js
import { submitJob } from "./src/queue.js";

async function processBatch() {
  const tasks = [
    "python data_processor.py --file=data1.csv",
    "python data_processor.py --file=data2.csv", 
    "python data_processor.py --file=data3.csv"
  ];
  
  // Submit jobs programmatically
  for (const task of tasks) {
    await submitJob(task);
  }
  
  console.log(`✅ Submitted ${tasks.length} batch jobs`);
}

processBatch().catch(console.error);

Then use CLI and dashboard for monitoring:

# Run your batch script
node batch-processor.js

# Monitor jobs via dashboard (recommended)
synq dashboard

# Or check individual job status via CLI
synq status job-1234567890

# Cancel a job if needed
synq cancel job-1234567890

Start Worker (Required for all methods)

node src/worker.js

Architecture

graph TD
    CLI["🖥️ CLI Interface<br/>(cli.js)"] 
    Dashboard["📊 Dashboard<br/>(dashboard.js)"]
    Queue["⚡ Queue System<br/>(queue.js)"]
    Redis[("🔴 Redis<br/>Job Queue")]
    Worker["🔄 Worker<br/>(worker.js)"]
    MongoDB[("🍃 MongoDB<br/>Job Persistence")]
    LuaScripts["📜 Lua Scripts<br/>Atomic Operations"]
    
    CLI -->|submit/status/cancel| Queue
    CLI -->|launch| Dashboard
    Dashboard -->|monitor| Redis
    Dashboard -->|real-time stats| Redis
    Queue -->|enqueue| Redis
    Queue -->|uses| LuaScripts
    LuaScripts -->|atomic ops| Redis
    Worker -->|poll jobs| Redis
    Worker -->|execute command| System["💻 System<br/>Shell Commands"]
    Worker -->|save status| MongoDB
    Queue -->|read status| MongoDB
    
    style CLI fill:#4A90E2,stroke:#333,stroke-width:2px,color:#fff
    style Dashboard fill:#FF6B6B,stroke:#333,stroke-width:2px,color:#fff
    style Queue fill:#7ED321,stroke:#333,stroke-width:2px,color:#fff
    style Redis fill:#F5A623,stroke:#333,stroke-width:2px,color:#fff
    style Worker fill:#BD10E0,stroke:#333,stroke-width:2px,color:#fff
    style MongoDB fill:#50E3C2,stroke:#333,stroke-width:2px,color:#fff
    style LuaScripts fill:#D0021B,stroke:#333,stroke-width:2px,color:#fff
    style System fill:#9013FE,stroke:#333,stroke-width:2px,color:#fff

Components

  • CLI - Command-line interface for job management and dashboard
  • Queue - Redis-based job queuing with atomic Lua scripts
  • Worker - Background job processor with timeout handling
  • Dashboard - Real-time monitoring interface
  • Databases - Redis for queuing, MongoDB for persistence

Testing

npm test              # Race condition and core functionality tests
npm run test:race     # Race condition specific tests  

Configuration

Set environment variables:

  • REDIS_URL - Redis connection (default: redis://localhost:6379)
  • MONGODB_URI - MongoDB connection (default: mongodb://localhost:27017)