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

@atlascrew/synapse-client

v0.1.0

Published

TypeScript client and CLI for Synapse API

Readme

Synapse Client

TypeScript client and CLI for the Synapse (risk-server) API.

Installation

# From the monorepo root
pnpm install
pnpm nx run synapse-client:build

# Run CLI
node apps/synapse-client/dist/cli.js --help

# Or link globally
cd apps/synapse-client && npm link
synapse --help

CLI Usage

# Set server URL via environment variable
export SYNAPSE_URL=http://localhost:3000

# Check health
synapse health

# Get sensor status
synapse status

# List entities
synapse entities

# Release a blocked entity
synapse release 192.168.1.100

# List WAF rules
synapse rules

# Evaluate a request against rules
synapse evaluate GET "/api/users?id=1"

# Get JSON output
synapse --json status

Global Options

| Flag | Env Var | Description | |------|---------|-------------| | -u, --url | SYNAPSE_URL | Synapse server URL (required) | | --json | SYNAPSE_JSON=1 | Output as JSON | | -d, --debug | SYNAPSE_DEBUG=1 | Enable debug logging | | -t, --timeout | SYNAPSE_TIMEOUT | Request timeout in ms (default: 30000) |

Commands

Health & Status:

  • health - Check server health
  • status - Get sensor status and metrics
  • metrics - Get Prometheus-formatted metrics

Entity Management:

  • entities - List all tracked entities
  • blocks - List all block records
  • release <id|ip> - Release a blocked entity
  • release-all - Release all blocked entities

Configuration:

  • config - Get system configuration
  • config-set <key=value>... - Update configuration

WAF Rules:

  • rules - List all WAF rules
  • rule-add <json> [ttl] - Add a runtime rule
  • rule-remove <id> - Remove a runtime rule
  • rules-clear - Clear all runtime rules
  • reload - Reload rules from file
  • evaluate <method> <url> [headers-json] - Evaluate request against rules

Actor Tracking:

  • actors - List all tracked actors
  • actor-stats - Get actor tracking statistics
  • actor-fingerprint <ip> <fp> - Set actor fingerprint

Library Usage

import { SynapseClient } from 'synapse-client';

const client = new SynapseClient({
  baseUrl: 'http://localhost:3000',
  timeout: 30000,
  debug: false,
});

// Check health
const health = await client.health();
console.log(health.status);

// Get sensor status
const status = await client.getStatus();
console.log(`Total requests: ${status.totalRequests}`);
console.log(`Blocked: ${status.blockedRequests}`);

// List entities
const { entities } = await client.listEntities();
for (const entity of entities) {
  console.log(`${entity.ip}: risk=${entity.risk}, blocked=${entity.blocked}`);
}

// Release a blocked entity
await client.releaseEntity('192.168.1.100');

// Add a runtime rule
await client.addRule({
  name: 'Block test path',
  description: 'Block requests to /test',
  risk: 100,
  blocking: true,
  matches: [{ type: 'uri', match: '/test' }],
}, 3600); // TTL: 1 hour

// Evaluate a request (dry run)
const result = await client.evaluate({
  method: 'GET',
  url: '/api/users?id=1',
});
console.log(`Would block: ${result.wouldBlock}`);

API Reference

SynapseClient

Constructor Options

interface SynapseClientOptions {
  baseUrl: string;     // Synapse server URL
  timeout?: number;    // Request timeout in ms (default: 30000)
  debug?: boolean;     // Enable debug logging (default: false)
}

Methods

| Method | Description | |--------|-------------| | health() | Check server health | | getStatus() | Get sensor status and metrics | | getMetrics() | Get Prometheus-formatted metrics | | listEntities() | List all tracked entities | | listBlocks() | List all block records | | releaseEntity(id) | Release a blocked entity by ID or IP | | releaseAll() | Release all blocked entities | | getConfig() | Get system configuration | | updateConfig(updates) | Update WAF configuration | | listRules() | List all WAF rules | | addRule(rule, ttl?) | Add a runtime rule | | removeRule(id) | Remove a runtime rule | | clearRules() | Clear all runtime rules | | reloadRules() | Reload rules from file | | evaluate(request) | Evaluate request against rules | | listActors() | List all tracked actors | | getActorStats() | Get actor tracking statistics | | setActorFingerprint(ip, fp) | Set actor fingerprint |

Development

# Install dependencies
cd apps/synapse-client
npm install

# Build
npm run build

# Run tests
npm test

# Test with coverage
npm run test:coverage

# Watch mode
npm run test:watch

License

Licensed under the GNU Affero General Public License v3.0 only. See LICENSE.