
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A fast, TypeScript-native API benchmarking tool built for real traffic, accurate latency metrics, and CI automation
High-performance, TypeScript-first API benchmarking tool
Installation • Quick Start • Features • CLI Options • API • Output
A fast, zero-config API benchmarking tool built for real traffic simulation, accurate latency metrics, and CI automation. Built with worker threads and undici for maximum performance.
npm install -g swiftbench
# or
npm install swiftbench --save-dev
# Simple benchmark
swiftbench http://localhost:3000
# High-load test
swiftbench http://localhost:3000 -c 200 -d 30
# Rate limited
swiftbench http://localhost:3000 --rate 1000
# POST with JSON
swiftbench http://localhost:3000/api -m POST --json '{"key": "value"}'
# Generate HTML report
swiftbench http://localhost:3000 --output html -o report.html
# Compare multiple frameworks
swiftbench --compare http://localhost:3000 http://localhost:3001 http://localhost:3002 -c 100 -d 10
import { bench, defineConfig } from "swiftbench";
// Simple benchmark
const result = await bench("http://localhost:3000");
console.log(`RPS: ${result.throughput.rps}`);
console.log(`P99: ${result.latency.p99}ms`);
// With options
const result = await bench("http://localhost:3000", {
connections: 200,
duration: 30
});
// Full configuration
const result = await bench({
url: "http://localhost:3000/api",
method: "POST",
headers: { "Authorization": "Bearer token" },
body: JSON.stringify({ key: "value" }),
rate: 500,
duration: 20
});
// Type-safe config helper
const config = defineConfig({
url: "http://localhost:3000",
connections: 100,
duration: 10,
thresholds: {
p99: 100,
errorRate: 0.01
}
});
undici for efficient connection pooling| Flag | Description | Default |
|---|---|---|
-c, --connections <n> | Concurrent connections | 50 |
-d, --duration <n> | Duration in seconds | 10 |
--rate <n> | Requests per second limit | unlimited |
--timeout <n> | Request timeout in ms | 5000 |
-m, --method <method> | HTTP method | GET |
-H, --header <header> | Add header (repeatable) | - |
--body <data> | Request body | - |
--json <data> | JSON body (sets Content-Type) | - |
--http2 | Use HTTP/2 | false |
--output <format> | Format: console, json, html, csv | console |
-o <file> | Output file path | - |
--p99 <ms> | P99 latency threshold (CI) | - |
--error-rate <rate> | Error rate threshold 0-1 (CI) | - |
--compare | Compare multiple URLs | - |
Clean terminal output with styled tables:
┌──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┐
│ Stat │ Min │ p50 │ p90 │ p99 │ Avg │ Stdev │ Max │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ Latency │ 110 µs │ 500 µs │ 1.50 ms │ 3.50 ms │ 1.13 ms │ 1.45 ms │ 83.69 ms │
└──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┘
swiftbench http://localhost:3000 --output json -o result.json
Machine-readable output for CI pipelines and data processing.
swiftbench http://localhost:3000 --output html -o report.html
Modern dark-themed report with:
swiftbench http://localhost:3000 --output csv -o results.csv
Spreadsheet-compatible format for data analysis.
Benchmark multiple URLs to compare framework performance:
swiftbench --compare http://localhost:3000 http://localhost:3001 -c 100 -d 10
Output:
Comparison Results
────────────────────────────────────────────────────────────────────────────────
URL RPS P50 P99 Err%
────────────────────────────────────────────────────────────────────────────────
#1 http://localhost:3000 167,098 0.50ms 2.50ms 0.00%
#2 http://localhost:3001 45,231 2.10ms 8.50ms 0.01%
────────────────────────────────────────────────────────────────────────────────
- name: API Performance Test
run: |
npx swiftbench http://localhost:3000 \
--p99 100 \
--error-rate 0.01 \
--output json -o benchmark.json
- name: Upload Results
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: benchmark.json
| Code | Description |
|---|---|
0 | Success - all thresholds passed |
1 | Threshold exceeded |
2 | Error (unreachable, crash, etc.) |
interface BenchResult {
url: string;
method: string;
duration: number;
connections: number;
rate: number | null;
requests: {
total: number;
successful: number;
failed: number;
};
throughput: {
rps: number;
bytesPerSecond: number;
totalBytes: number;
};
latency: {
min: number;
max: number;
mean: number;
stddev: number;
p50: number;
p75: number;
p90: number;
p95: number;
p99: number;
p999: number;
};
errors: {
timeouts: number;
connectionErrors: number;
byStatusCode: Record<number, number>;
};
timestamp: string;
meta: {
version: string;
nodeVersion: string;
platform: string;
};
}
Contributions are welcome! Please read our contributing guidelines before submitting a PR.
MIT © 2026
FAQs
A fast, TypeScript-native API benchmarking tool built for real traffic, accurate latency metrics, and CI automation
We found that swiftbench demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.