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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@snapback/infrastructure

v0.1.2

Published

Production-grade observability toolkit - structured logging, distributed tracing, and performance monitoring for TypeScript applications

Readme

@snapback/infrastructure

npm version npm downloads License

Production-grade observability toolkit for TypeScript applications

Part of SnapBack - structured logging, distributed tracing, and performance monitoring to help you understand what's happening in your code safety systems.


What is SnapBack?

SnapBack is a code safety platform that prevents breaking changes in your codebase through snapshots, file protection, and risk analysis. This infrastructure package provides the observability tools needed to monitor and debug these safety systems in production.

Learn more about SnapBack →


What's This Package?

Production-ready logging and telemetry infrastructure for TypeScript applications. Built for high-performance observability without vendor lock-in.

  • 📊 Structured Logging - JSON-formatted logs with context
  • 🔍 Distributed Tracing - Track operations across services
  • Performance Monitoring - Built-in metrics collection
  • 🔌 Pluggable Backends - Send data anywhere (Datadog, New Relic, etc.)

Use this when:

  • Building production TypeScript services
  • Need structured logging without dependencies
  • Want distributed tracing support
  • Require vendor-agnostic observability

API Reference →


Installation

npm install @snapback/infrastructure

Quick Start

Structured Logging

import { Logger } from '@snapback/infrastructure';

const logger = new Logger({
  service: 'my-app',
  environment: 'production'
});

logger.info('User signed in', {
  userId: '123',
  email: '[email protected]'
});

logger.error('Payment failed', {
  userId: '123',
  amount: 99.99,
  error: err.message
});

Logging guide →


Features

Structured Logging

JSON-formatted logs with automatic context propagation.

import { Logger } from '@snapback/infrastructure';

const logger = new Logger({
  service: 'api',
  version: '1.0.0'
});

// Automatic context
logger.info('API request', {
  method: 'POST',
  path: '/api/users',
  duration: 45
});

// Output:
// {
//   "level": "info",
//   "message": "API request",
//   "service": "api",
//   "version": "1.0.0",
//   "method": "POST",
//   "path": "/api/users",
//   "duration": 45,
//   "timestamp": "2025-01-04T12:00:00.000Z"
// }

Distributed Tracing

Track operations across service boundaries.

import { Tracer } from '@snapback/infrastructure';

const tracer = new Tracer();

// Start a trace
const span = tracer.startSpan('process-payment');
span.setAttribute('amount', 99.99);
span.setAttribute('currency', 'USD');

try {
  await processPayment();
  span.setStatus('success');
} catch (error) {
  span.setStatus('error');
  span.recordException(error);
} finally {
  span.end();
}

Tracing guide →

Performance Monitoring

Built-in metrics for performance tracking.

import { metrics } from '@snapback/infrastructure';

// Record metrics
metrics.increment('api.requests');
metrics.histogram('api.duration', 45);
metrics.gauge('active.connections', 150);

Integration Examples

With Express

import express from 'express';
import { Logger, requestLogger } from '@snapback/infrastructure';

const app = express();
const logger = new Logger({ service: 'api' });

// Add request logging
app.use(requestLogger(logger));

app.get('/users', (req, res) => {
  logger.info('Fetching users', { count: users.length });
  res.json(users);
});

With Datadog

import { Logger } from '@snapback/infrastructure';

const logger = new Logger({
  service: 'api',
  backends: [{
    type: 'datadog',
    apiKey: process.env.DATADOG_API_KEY
  }]
});

Integration guides →


Configuration

import { Logger } from '@snapback/infrastructure';

const logger = new Logger({
  service: 'my-app',
  environment: process.env.NODE_ENV,
  level: 'info',           // Minimum log level
  pretty: false,           // Pretty print (dev only)
  version: '1.0.0',
  backends: [
    { type: 'console' },   // Log to console
    { type: 'file', path: './logs/app.log' }
  ]
});

Configuration reference →


SnapBack Ecosystem

Part of the complete code safety platform:

| Package | Purpose | Documentation | |---------|---------|---------------| | @snapback/contracts | TypeScript types | Docs | | @snapback/sdk | Complete SDK | Docs | | @snapback/infrastructure | Observability (you are here) | Docs | | @snapback/events | Event bus | Docs | | @snapback/config | Configuration | Docs |

Explore the platform →


Resources


Contributing

See our Contributing Guide.


License

Apache-2.0 © SnapBack

Commercial use allowed • See LICENSE


snapback.devDocumentation@snapbackdev

Made with ❤️ for developers who ship with confidence