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

product-category-viewer

v1.0.1

Published

Visualize Salesforce ProductCategory hierarchies with an interactive tree view

Readme

ProductCategory Viewer 🏷️

A beautiful CLI tool to visualize Salesforce ProductCategory hierarchies in an interactive tree view.

License Node

Features

  • 🌳 Interactive Tree View - Expandable/collapsible hierarchy visualization
  • 🎨 Dark Theme UI - Modern Tailwind CSS dark theme
  • 📊 Statistics Dashboard - Total, root, child counts, and max depth
  • 🔍 Real-time Search - Filter categories by name or code
  • 📋 Detailed View - Side panel with complete category information
  • 🏷️ Visual Badges - Quick identification of navigational categories and product counts
  • Fast Performance - Efficient tree rendering with thousands of categories

Prerequisites

  • Node.js (v14 or higher)
  • Salesforce CLI (sf)
  • Access to a Salesforce org with ProductCategory, ProductCatalog data

Installation

Global Installation (Recommended)

npm install -g product-category-viewer

Usage

Start the Viewer

# Using the full command
product-category-viewer start -u [email protected]

# Using the short alias
pcv start -u myalias

# With custom port
product-category-viewer start -u [email protected] --port 8080

Command Options

Options:
  -u, --username <username>  Salesforce username or alias (required)
  -p, --port <number>       Port to run the server on (default: 3000)
  -h, --help                Display help for command

How It Works

  1. Fetches Data - Queries all ProductCategory records from your Salesforce org
  • Queries all ProductCatalog records from your Salesforce org
  1. Builds Hierarchy - Constructs parent-child relationships using ParentCategoryId
  2. Launches Server - Starts a local web server with the interactive UI
  3. Opens Browser - Navigate to http://localhost:3000 to explore

Features Explained

Tree View

  • Expand/Collapse - Click on any category to show/hide children
  • Expand All / Collapse All - Bulk operations for entire tree
  • Visual Hierarchy - Indentation and lines show relationships

Search

  • Real-time filtering by category name or code
  • Highlights matching categories
  • Maintains tree structure

Details Panel

  • Click "Details" button on any category
  • View all fields including:
    • Name, Code, Description
    • IDs (Category, Parent, Catalog)
    • Product count and sort order
    • Navigational status
    • Timestamps

Statistics

  • Total Categories - All categories in the org
  • Root Categories - Categories without parents
  • Child Categories - Categories with parents
  • Max Depth - Deepest level in the hierarchy

SOQL Query

The tool executes these SOQL queries:

SELECT 
    CatalogId, Code, CreatedById, CreatedDate,
    Description, Id, IsDeleted,
    IsNavigational, LastModifiedById, LastModifiedDate, 
    LastReferencedDate, LastViewedDate, Name, 
    NumberOfProducts, ParentCategoryId, 
    SortOrder, SystemModstamp
FROM ProductCategory

SELECT 
  CatalogType, Code, CreatedById, CreatedDate, 
  Description, EffectiveEndDate, EffectiveStartDate, Id, IsDeleted, LastModifiedById, LastModifiedDate, LastReferencedDate, LastViewedDate, Name, NumberOfCategories, OwnerId, SystemModstamp 
FROM ProductCatalog
 

UI

Main View

  • Dark themed interface
  • Statistics cards at the top
  • Search bar and controls
  • Expandable tree view

Details Panel

  • Slides in from the right
  • Shows all category fields
  • Formatted dates and IDs
  • Visual indicators for boolean fields

Troubleshooting

"Salesforce CLI not found"

Ensure sf CLI is installed and in your PATH:

sf --version

"Query failed"

  • Check that your username/alias is correct
  • Verify you have access to ProductCategory object
  • Ensure you're authenticated: sf org list

Port Already in Use

Use a different port:

product-category-viewer start -u myorg -p 8080

No Categories Found

  • Verify ProductCategory records exist in your org
  • Check object permissions
  • Try running the SOQL query manually: sf data query -q "SELECT Id, Name FROM ProductCategory" -o yourorg

Browser Compatibility

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

Performance

  • Handles thousands of categories efficiently
  • Lazy rendering for large trees
  • Minimal memory footprint
  • Fast search and filtering

Roadmap

  • [ ] Export tree to JSON/CSV
  • [ ] Print/PDF export
  • [ ] Drag-and-drop to reorganize (read-only preview)
  • [ ] Filter by catalog
  • [ ] Show product details inline
  • [ ] Color-code by depth level
  • [ ] Breadcrumb navigation
  • [ ] Keyboard shortcuts

License

MIT (c) Mohan Chinnappan


Note: This tool provides a read-only view of your ProductCategory data. It does not modify any Salesforce records.