
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
@peekapi/sdk-node
Advanced tools
Zero-dependency Node.js SDK for PeekAPI. Add API analytics to any Node.js framework with one line of middleware.
npm install @peekapi/sdk-node
import express from "express";
import { peekapi } from "@peekapi/sdk-node";
const app = express();
app.use(peekapi({ apiKey: "ak_live_xxx" }));
app.get("/api/users", (req, res) => res.json({ users: [] }));
app.listen(3000);
import Fastify from "fastify";
import { peekapiFastify } from "@peekapi/sdk-node";
const app = Fastify();
app.register(peekapiFastify, { apiKey: "ak_live_xxx" });
app.get("/api/users", async () => ({ users: [] }));
app.listen({ port: 3000 });
import Koa from "koa";
import { peekapiKoa } from "@peekapi/sdk-node";
const app = new Koa();
app.use(peekapiKoa({ apiKey: "ak_live_xxx" }));
app.use((ctx) => { ctx.body = { users: [] }; });
app.listen(3000);
import Hapi from "@hapi/hapi";
import { peekapiHapi } from "@peekapi/sdk-node";
const server = Hapi.server({ port: 3000 });
await server.register({ plugin: peekapiHapi, options: { apiKey: "ak_live_xxx" } });
server.route({ method: "GET", path: "/api/users", handler: () => ({ users: [] }) });
await server.start();
import { Module } from "@nestjs/common";
import { APP_INTERCEPTOR } from "@nestjs/core";
import { PeekApiInterceptor } from "@peekapi/sdk-node";
@Module({
providers: [
{
provide: APP_INTERCEPTOR,
useFactory: () => new PeekApiInterceptor({ apiKey: "ak_live_xxx" }),
},
],
})
export class AppModule {}
import { PeekApiClient } from "@peekapi/sdk-node";
const client = new PeekApiClient({ apiKey: "ak_live_xxx" });
client.track({
method: "GET",
path: "/api/users",
status_code: 200,
response_time_ms: 42,
});
// Graceful shutdown (flushes remaining events)
client.shutdown();
| Option | Default | Description |
|---|---|---|
apiKey | required | Your PeekAPI key |
endpoint | PeekAPI cloud | Ingestion endpoint URL |
flushInterval | 10000 | Milliseconds between automatic flushes |
batchSize | 100 | Events per HTTP POST (triggers flush) |
maxBufferSize | 10000 | Max events held in memory |
maxStorageBytes | 5242880 | Max disk fallback file size (5MB) |
maxEventBytes | 65536 | Per-event size limit (64KB) |
storagePath | auto | Custom path for JSONL persistence file |
debug | false | Enable debug logging |
identifyConsumer | auto | Custom consumer ID extraction function |
tlsOptions | undefined | TLS options for https.Agent |
onError | undefined | Callback for background flush errors |
batchSize is reachedBy default, consumers are identified by:
X-API-Key header — stored as-isAuthorization header — hashed with SHA-256 (stored as hash_<hex>)Override with the identifyConsumer option to use any header or request property:
app.use(peekapi({
apiKey: "ak_live_xxx",
identifyConsumer: (req) => req.headers["x-tenant-id"],
}));
| Field | Description |
|---|---|
method | HTTP method (GET, POST, etc.) |
path | Route path (no query strings) |
status_code | Response status code |
response_time_ms | Time to respond in ms |
request_size | Request body size in bytes |
response_size | Response body size in bytes |
consumer_id | API consumer identifier |
timestamp | ISO 8601 timestamp |
npm installnpm testMIT
FAQs
Node.js SDK for PeekAPI — one-line API analytics
The npm package @peekapi/sdk-node receives a total of 4 weekly downloads. As such, @peekapi/sdk-node popularity was classified as not popular.
We found that @peekapi/sdk-node 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
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.