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

@riavzon/bot-detector-create

v1.0.18

Published

Setup package for @riavzon/bot-detector

Readme

@riavzon/bot-detector-create

Zero-config setup for @riavzon/bot-detector. Run one command and get a fully configured bot detection middleware with all data sources downloaded, compiled, and a SQLite database ready to go.

Usage

Run this in the root of your Express project:

npx @riavzon/bot-detector-create

The command does the following:

  1. Installs @riavzon/bot-detector, express, cookie-parser, and better-sqlite3 into your project.
  2. Triggers the data source installer and downloads and compiles all threat intelligence feeds.
  3. Writes a botDetectorConfig.ts file at your project root with all 17 checkers pre-configured at their default values.
  4. Writes a mainBotDetector.ts file at your project root, a ready-to-run Express entry point that imports the config and mounts the middleware.
  5. Runs load-schema to create the visitors and banned tables in a local bot_detector.sqlite file.

What you get

botDetectorConfig.ts is a fully annotated configuration file. Every option is shown explicitly so you know exactly what's active and what you can tune.

import { defineConfiguration } from '@riavzon/bot-detector';

await defineConfiguration({
    store: {
        main: {
            driver: 'sqlite',
            name: './bot_detector.sqlite',
        },
    },
    // ... all 17 checkers with default penalties
});

The defaults use SQLite and in-process memory cache, When you're ready for production, swap the adapters:

// MySQL
store: { main: { driver: 'mysql-pool', host: '...', user: '...', ... } }

// Redis cache
storage: { driver: 'redis', url: process.env.REDIS_URL }

// Upstash (serverless)
storage: { driver: 'upstash', url: process.env.UPSTASH_URL, token: process.env.UPSTASH_TOKEN }

What you get

mainBotDetector.ts is a ready-to-run Express entry point. It imports the config, mounts the middleware, and starts the server:

import './botDetectorConfig.js';
import express from 'express';
import cookieParser from 'cookie-parser';
import { detectBots } from '@riavzon/bot-detector';

const app = express();
app.use(cookieParser());
app.use(detectBots());

app.get('/', (req, res) => {
    res.json({ banned: req.botDetection?.banned });
});

app.listen(3000);

Mount the middleware

botDetectorConfig.ts must be imported before any routes. If you prefer to wire it into your own entry point instead of using mainBotDetector.ts:

import './botDetectorConfig.js';
import { detectBots } from '@riavzon/bot-detector';
// ... rest of your app

Keep data sources fresh

Threat intelligence feeds update continuously. Run a refresh at least once every 24 hours:

npx @riavzon/bot-detector refresh

Add it to a cron job or a scheduled CI step to keep detection accurate.

Requirements

  • Node.js 18 or later
  • npm

License

Apache-2.0