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

@vanta-dev/node

v0.1.7

Published

Node.js SDK for Vanta event tracking, metrics, and uptime monitoring

Readme

@vanta-dev/node

Node.js SDK for the Vanta event tracking platform. Track events, record metrics, manage uptime monitors, and query analytics from server-side code.

Installation

npm install @vanta-dev/node

Getting started

import { Vanta } from '@vanta-dev/node'

const vanta = new Vanta({
  apiKey: 'vk_your_api_key',
})

await vanta.track({ event: 'purchase', data: { amount: 49.99 } })
await vanta.shutdown()

The SDK works with both ES modules and CommonJS. In a CommonJS project use require:

const { Vanta } = require('@vanta-dev/node')

const vanta = new Vanta({ apiKey: 'vk_your_api_key' })

Configuration

const vanta = new Vanta({
  apiKey: 'vk_...',           // required
  apiUrl: 'https://vantapi.pancake.wtf',  // defaults to http://localhost:3001
  source: 'my-server',        // source identifier for events
  flushInterval: 10000,       // ms between automatic flushes (default: 10000)
  flushSize: 20,              // queue size that triggers an immediate flush (default: 20)
  maxRetries: 3,              // transport retries on failure (default: 3)
  batchSize: 100,             // max events per batch request (default: 100)
})

Tracking events

await vanta.track({
  event: 'signup',
  userId: 'user_123',
  data: { plan: 'pro' },
  tags: { region: 'us-east' },
})

Event names cannot start with $, which is reserved for internal Vanta events.

Identifying users

await vanta.identify({
  userId: 'user_123',
  email: '[email protected]',
  name: 'Jane',
})

Groups

await vanta.group({
  groupId: 'org_456',
  type: 'organization',
  name: 'Acme Corp',
})

Metrics

Measurements record observations; counters accumulate changes:

await vanta.measure({ name: 'response_time', value: 142, unit: 'ms' })

await vanta.increment('page_view')
await vanta.increment('items_processed', 25)
await vanta.decrement('queue_depth', 3)

await vanta.metrics.submit([
  { type: 'measurement', name: 'cpu_usage', value: 67.2, unit: 'percent' },
  { type: 'increment', name: 'page_view' },
])

const result = await vanta.metrics.query({
  name: 'response_time',
  time: { start: '2026-08-14T00:00:00Z', end: '2026-08-21T00:00:00Z' },
  aggregation: 'p95',
})

const series = await vanta.metrics.timeseries({
  name: 'page_view',
  interval: '1d',
})

const current = await vanta.metrics.current({ name: 'queue_depth' })

const names = await vanta.metrics.list()

Counter queries return the net change (sum of increments minus decrements). Omitting time queries all recorded history.

Uptime monitoring

Monitors are created, edited, and deleted from the Vanta dashboard. Use the SDK to send heartbeats, read monitors, and start or stop the local heartbeat loop.

await vanta.uptime.heartbeat('api-health')

const monitors = await vanta.uptime.listMonitors()
const stats = await vanta.uptime.getStats('mon_123', '30d')

const handle = vanta.uptime.start('api-health', { intervalMs: 30000 })
handle.stop()

Querying events and analytics

import { filter, and, timeRange } from '@vanta-dev/node'

const events = await vanta.queryEvents({
  filters: and(
    filter('type', 'equals', 'purchase'),
    filter('data.amount', 'gt', 50),
  ),
  time: timeRange('2025-01-01T00:00:00Z', '2025-02-01T00:00:00Z'),
})

const count = await vanta.count({
  filters: filter('type', 'equals', 'signup'),
  time: timeRange('2025-01-01T00:00:00Z', '2025-02-01T00:00:00Z'),
})

const grouped = await vanta.groupBy({
  groupBy: ['data.plan'],
  time: timeRange('2025-01-01T00:00:00Z', '2025-02-01T00:00:00Z'),
})

const trend = await vanta.timeseries({
  interval: 'day',
  time: timeRange('2025-01-01T00:00:00Z', '2025-02-01T00:00:00Z'),
})

Error handling

The SDK exports several error classes for programmatic handling:

import { VantaError, AuthenticationError, RateLimitError, NetworkError } from '@vanta-dev/node'

try {
  const result = await vanta.metrics.query({ name: 'response_time' })
} catch (err) {
  if (err instanceof AuthenticationError) {
    // invalid API key
  } else if (err instanceof RateLimitError) {
    // retry after err.retryAfter seconds
  } else if (err instanceof NetworkError) {
    // connectivity issue
  }
}

Queued calls such as track(), measure(), and increment() are delivered in the background. Failed batches are re-queued and reported through the onDeliveryError callback instead of throwing.

Graceful shutdown

Call shutdown() before your process exits to flush any queued events:

process.on('SIGTERM', async () => {
  await vanta.shutdown()
  process.exit(0)
})

Documentation

Read the full Node.js SDK documentation at vanta.pancake.wtf.