Skip to main content
tctx is available on npm and JSR, making it easy to install with any JavaScript package manager.

Package Managers

npm install tctx

JSR (JavaScript Registry)

For Deno or other runtimes that support JSR, you can install tctx from the JavaScript Registry:
deno add @mr/tracecontext
The npm package is published as tctx while the JSR package is published as @mr/tracecontext.

Verify Installation

After installation, verify that tctx is working correctly:
import * as traceparent from 'tctx/traceparent';
import * as tracestate from 'tctx/tracestate';

const parent = traceparent.make();
console.log(String(parent));
// Output: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01

Dependencies

tctx has minimal dependencies:
  • @lukeed/csprng - Cryptographically secure pseudo-random number generation for creating trace IDs
This single dependency ensures secure random ID generation while keeping the package lightweight.

TypeScript Support

tctx includes full TypeScript type definitions out of the box. No additional @types packages are required.
import * as traceparent from 'tctx/traceparent';
import type { Traceparent } from 'tctx/traceparent';

const parent: Traceparent = traceparent.make();

Runtime Compatibility

tctx works seamlessly across all major JavaScript runtimes:
  • Node.js - Version 14 and above
  • Deno - All versions
  • Bun - All versions
  • Browsers - All modern browsers (ES2015+)
  • Edge Functions - Cloudflare Workers, Vercel Edge, Deno Deploy, etc.
tctx is designed to be runtime-agnostic with no Node.js-specific APIs, making it perfect for edge computing environments.

Next Steps

Quickstart Guide

Learn how to use tctx in your application

API Reference

Explore the complete API documentation

Build docs developers (and LLMs) love