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

termtree-logger

v1.0.2

Published

Ultra-fast, zero-dependency console object tree inspector and interactive CLI logger for Node.js and TypeScript. Features stack trace source mapping, clickable file lines, and customizable color schemes.

Readme

🌲 termtree

NPM Version Downloads Build Status License GitHub Stars

Ultra-fast, zero-dependency console object tree inspector and interactive CLI logger for Node.js and TypeScript.

termtree is a modern developer experience (DX) tool that transforms complex, nested JavaScript objects and primitives into highly readable, color-coded trees directly in your terminal. It automatically prints clickable source code links mapping exactly to where the logger was called, letting you cmd+click straight to your files from VS Code, iTerm, or other terminals.

[APP INITIALIZATION] ↳ Call Trace: bootstrap (file:///Users/dev/project/src/index.js:12:3)
{
├── service: "outreach-campaign"
├── status: "active"
└── metrics:
    ├── durationMs: 1420
    ├── successRate: 0.98
    └── activeConnections: 12
}

Key Features

  • ⚡ Zero-Dependency & Fast: Sub-10KB install size. Designed for edge runtimes (Cloudflare Workers, Vercel Edge, Bun) where external dependency size and startup latency are critical.
  • 🔍 Clickable Stack Trace Mapping: Automatically captures the file path, line, and column that invoked the log. Renders a clickable file:// link directly in the terminal console.
  • 🎨 Vibrant Color Schemes: Comes prepackaged with high-contrast, premium color palettes (ocean, forest, candy, sunset).
  • 🛡️ Circular Reference Guard: Safely intercepts self-referencing loops and cyclical structures, preventing stack overflows.
  • 📦 Native TypeScript Support: Prepackaged with type definitions (index.d.ts) for clean autocompletion.
  • ⚙️ Custom Color Themes: Design your own theme configuration keys using plain functions or customized color mappings.

Installation

Install via your preferred package manager:

npm install termtree-logger
# or
yarn add termtree-logger
# or
pnpm add termtree-logger
# or
bun add termtree-logger

Quick Start

1. Simple Shorthand Logging

Use the shorthand functions for instantaneous debugging with predefined styles:

const { termtree } = require('termtree-logger');

// Default Ocean Theme
termtree({ name: 'Ezekiel', active: true }, 'User status');

// Sunset Orange/Red Theme (Perfect for warnings)
termtree.sunset({ error: 'TOKEN_EXPIRED', status: 401 }, 'Auth error');

// Candy Pink/Purple Theme (Great for visual separation)
termtree.candy({ items: [1, 2, 3] }, 'Cart details');

// Forest Green Theme (Perfect for DB sync actions)
termtree.forest(new Set(['sql', 'redis']), 'Data stores');

// Plain Text Theme (Strips color formatting)
termtree.plain({ debug: true }, 'Raw logs');

2. Custom Logger Instance

Create custom instances with strict constraints, custom themes, or toggled trace flags:

const { TermTree } = require('termtree-logger');

const logger = new TermTree({
  theme: 'forest',     // ocean | forest | candy | sunset | plain
  showTrace: true,     // Toggle caller stack trace mapping
  showTypes: true,     // Include Map/Set/Array prefixes
  maxDepth: 3,         // Safeguard nesting depth
});

logger.log({
  config: {
    db: {
      url: 'localhost:5432',
      pool: 10
    }
  }
}, 'Database Initialization');

3. Custom Themes

Build your own customized color palettes mapping key console types:

const logger = new TermTree({
  theme: {
    key: (text) => `\x1b[33m${text}\x1b[0m`,    // Yellow keys
    string: (text) => `\x1b[32m${text}\x1b[0m`, // Green strings
    number: (text) => `\x1b[36m${text}\x1b[0m`, // Cyan numbers
  }
});

Contrast Matrix

| Theme | Key Color | String Color | Number Color | Border | Recommended Use Cases | | :--- | :--- | :--- | :--- | :--- | :--- | | Ocean | Cyan | Green | Yellow | Gray | General logging, app lifecycle states | | Forest | Green | Yellow | Cyan | Gray | Database ops, caching, file sync | | Candy | Magenta | Cyan | Yellow | Gray | User actions, auth events, requests | | Sunset | Red | Yellow | Magenta | Gray | Error stacks, warnings, socket issues | | Plain | Raw | Raw | Raw | Raw | File logs, production pipelines, CI |


Technical Details & Architecture

Clickable Call Traces

termtree inspects the calling frame using V8's native stack traces (Error.prepareStackTrace) when a logging method is triggered. It bypasses internal package calls and node core stack frames to output the precise file, line, and column that invoked the log. The resulting string is rendered using the file:// protocol, which modern terminals like VS Code and iTerm2 parse natively as a clickable hyperlink.

Circular Reference Checking

A dynamic Set monitors active reference depths during recursion. When a child property points to a parent reference already tracked within the set, termtree prints [Circular Reference] instead of triggering an infinite rendering loop.


Contributing

We welcome community contributions! To set up termtree locally:

  1. Clone the repository: git clone https://github.com/Ezeko/termtree.git
  2. Run automated tests: npm test
  3. Test terminal coloring locally: node scratch_run.js

Please read our Contributing Guide to understand linting rules, formatting guidelines, and PR procedures.


License

MIT © Ezekiel Adejobi