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

react-native-observability

v0.1.1

Published

Production-grade observability and debugging toolkit for React Native with structured logging, error boundaries, on-device debug panel, and zero forced dependencies.

Readme

react-native-observability

License: MIT npm types: TypeScript Release CI

A production-grade, provider-agnostic observability and debugging toolkit for React Native. Structured logging, optional remote backends, crash capture, PII redaction, on-device debug panel, and first-party integrations for HTTP clients and navigation — all with zero forced runtime dependencies.

npm install react-native-observability

Why react-native-observability?

Most observability stacks force you to pick a vendor upfront and bundle its SDK into your core. This library inverts that: it ships provider-agnostic primitives that work with any backend (Sentry, Datadog, your own service) or none at all. Wire only the vendors you use—zero bundle cost if you ship nothing.

The library is pure TypeScript with no native module of its own. Native features (persistent storage, shake-to-open) come from optional peers you opt into.

Features

  • Structured logger — composable transports (console, in-memory ring buffer, MMKV), LogLevel enum, hierarchical namespaces, child loggers, and optional session ID tagging
  • Observability adapters — forward errors to any backend via createCustomAdapter (Datadog, Sentry, your service). Adapter fan-out is microtask-deferred and isolated—a broken backend never crashes your app
  • Crash captureinstallGlobalErrorHandler() catches uncaught JS errors and unhandled promise rejections
  • Error boundariesAppErrorBoundary and ScreenErrorBoundary with fine-grained error isolation and custom fallback UI
  • Provider-agnostic HTTP — tag requests with the active screen, apply PII redaction, intercept and mock network traffic. Vendor shims for Axios, fetch, GraphQL, React Navigation, React Query, tRPC, Apollo, urql, and RTK Query
  • Session management — MMKV-backed persistence, per-session byte budgets, crash detection across launches, and optional encryption
  • Deep PII redaction — recursive key-path matching (user.**.email) and value-side regexes for email, JWT, credit cards—applied in the write path before any transport or adapter sees data
  • On-device debug panel — 6+ tabs (Logs, Network, State, Navigation, Performance, Settings), light/dark/system theming, live state inspection, session history, breadcrumb timeline, and crash trail
  • Backpressure & sampling — bounded drop-tail queue, token-bucket rate limiting, and per-level/per-namespace sampling to prevent runaway I/O
  • Self-telemetrygetInternalMetrics(), setKillSwitch(), and panic mode to halt I/O if the library fails

Installation

npm install react-native-observability
# or
pnpm add react-native-observability
# or
yarn add react-native-observability

Optional peers — install only what you use:

| Peer | Unlocks | | -------------------------- | -------------------------------------- | | react-native-mmkv | Persistent storage, session management | | axios | Axios HTTP observer | | (built-in) | Fetch observer | | graphql | GraphQL observer | | @react-navigation/native | React Navigation observer | | @tanstack/react-query | React Query observer | | @trpc/client | tRPC observer | | @apollo/client | Apollo observer | | urql / @urql/core | urql observer | | @reduxjs/toolkit | RTK Query observer |

Quick Start

1. Create a Logger

// src/services/logger.ts
import {
  createLogger,
  ConsoleTransport,
  MemoryTransport,
  LogLevel,
} from 'react-native-observability';

export const memoryTransport = new MemoryTransport({ maxEntries: 500 });

export const logger = createLogger({
  namespace: 'app',
  level: __DEV__ ? LogLevel.DEBUG : LogLevel.WARN,
  transports: [new ConsoleTransport(), memoryTransport],
});

2. Wrap Your App

// App.tsx
import { AppErrorBoundary } from 'react-native-observability';
import { DebugPanelProvider } from 'react-native-observability/panel';
import { logger, memoryTransport } from './services/logger';
import { http } from './services/http';

export default function App() {
  return (
    <AppErrorBoundary logger={logger} FallbackComponent={ErrorFallback}>
      <DebugPanelProvider
        enabled={__DEV__}
        logSource={memoryTransport}
        networkSource={http.store}
        openOn={['multiTap']}
        multiTapCount={5}
      >
        <Root />
      </DebugPanelProvider>
    </AppErrorBoundary>
  );
}

function ErrorFallback({ error, retry }: { error: Error; retry: () => void }) {
  return (
    <View>
      <Text>Error: {error.message}</Text>
      <Button onPress={retry} title="Retry" />
    </View>
  );
}

3. Observe HTTP

// src/services/http.ts
import axios from 'axios';
import { createHttpObserver } from 'react-native-observability';
import { observeAxios } from 'react-native-observability/observers/axios';
import { observeFetch } from 'react-native-observability/observers/fetch';
import { logger } from './logger';

export const http = createHttpObserver({
  logger,
  redact: { headerKeys: ['Authorization'], bodyKeys: ['password', 'token'] },
});

const client = axios.create({ baseURL: 'https://api.example.com' });
observeAxios(client, http);
observeFetch(http);

export { client };

4. Use the Logger

import { logger } from './services/logger';

// Simple entry
logger.info('User logged in', { userId: 'u123' });

// With an error
try {
  await fetchData();
} catch (error) {
  logger.error('Fetch failed', error instanceof Error ? error : new Error(String(error)));
}

// Child loggers for namespace hierarchy
const authLogger = logger.child('auth');
authLogger.debug('Validating token');

5. Open the Panel

The panel opens via gesture (shake or multi-tap):

import { useDebugPanel } from 'react-native-observability/panel';

export function MyScreen() {
  const { openPanel } = useDebugPanel();
  return <Button onPress={() => openPanel('logs')} title="Open Logs" />;
}

Architecture

               ┌───────────────────────────────────┐
               │         Application Code          │
               │    Logging · Navigation · HTTP    │
               └─────────────────┬─────────────────┘
                                 │
                                 ▼ entry
               ┌─────────────────┴─────────────────┐
               │            Logger Core            │
               │            (hot path)             │
               │     filter · redact · sample      │
               └─────────────────┬─────────────────┘
                                 │
           ┌─────────────────────┼─────────────────────┐
        dispatch               queue                  feed
           │                     │                     │
           ▼                     ▼                     ▼
  ┌────────────────┐    ┌────────────────┐    ┌────────────────┐
  │   Transports   │    │    Adapters    │    │  Integrations  │
  │                │    │ async·isolated │    │  event stores  │
  └────────────────┘    └────────────────┘    └────────────────┘
           │                     │                     │
           ▼                     ▼                     ▼
  ┌────────────────┐    ┌────────────────┐    ┌────────────────┐
  │ Console output │    │Remote backends │    │ HTTP · Screen  │
  │ Memory (ring)  │    │ Sentry·Datadog │    │Breadcrumb·Perf │
  │ MMKV (persist) │    │                │    │                │
  └────────────────┘    └────────────────┘    └────────────────┘
           │                                           │
           └─────────────────────┬─────────────────────┘
                         subscribe · query
                                 │
                                 ▼
               ┌─────────────────┴─────────────────┐
               │            Debug Panel            │
               └─────────────────┬─────────────────┘
                                 │
                                 ▼ render
               ┌─────────────────┴─────────────────┐
               │              Live UI              │
               │Logs · Network · State · Nav · Perf│
               └───────────────────────────────────┘

Data flow:

  1. App calls loggerlogger.info(), trackScreen(), HTTP requests
  2. Logger core (hot path) — Filters, redacts, samples, tags with screen/session
  3. Three paths in parallel:
    • Transports — Write independently (Console, Memory, MMKV*)
    • Adapters — Queued async, error-isolated (Sentry, Datadog, custom)
    • Integrations — Feed into stores (HTTP, screens, breadcrumbs, perf)
  4. Panel reads stores — Real-time subscription via useSyncExternalStore
  5. User sees live UI — Logs, network, state, navigation, performance

*Optional peer: react-native-mmkv

Documentation

Start here: Documentation Navigation Guide — Find what you need by goal or problem

Essential guides:

Understanding the system:

Feature guides:

Production & support:

Examples

  • Expo Example — Go-safe subset, no native build required
  • Bare Example — Full native surface with MMKV and shake-to-open

Supported Platforms

  • React Native: ≥0.73.0
  • React: ≥18.0.0
  • Node: ≥18

Bundle Size

Observability ships with aggressive size budgets enforced in CI. Core is ~8 KB (gzipped), adapters are ~4 KB, and the panel is ~30 KB (excluding React/React Native).

Contributing

We welcome contributions. Please read CONTRIBUTING.md for guidelines.

Development

pnpm install
pnpm build       # tsup — CJS + ESM + .d.ts
pnpm typecheck   # tsc --noEmit
pnpm lint        # eslint
pnpm test        # jest
pnpm test:coverage
pnpm size        # size-limit — verify budgets

License

MIT — see LICENSE for details.


Questions? Open an issue on GitHub.