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

sf-kpi-dashboard

v1.0.0

Published

Salesforce KPI Dashboard Generator

Readme

🚀 Salesforce KPI Dashboard Generator

A powerful command-line tool that generates a comprehensive, interactive HTML dashboard showcasing key performance indicators (KPIs) and metrics from your Salesforce org.

Dashboard Preview Node.js License

✨ Features

📊 Comprehensive Metrics Collection

  • Data Metrics: Custom objects, Account, Contact, Opportunity, Campaign, Lead, and Case record counts
  • Data Quality Analysis: Field population metrics to identify incomplete records
  • Security & Access: Profile and permission set distribution with user assignments
  • Configuration & Automation: Reports, dashboards, flows, validation rules
  • Code Metrics: Apex classes and triggers inventory

🎨 Interactive Dashboard

  • Modern Dark Theme: Beautiful, eye-friendly interface using Tailwind CSS
  • Real-time Search: Filter profiles and permission sets instantly
  • Sortable Lists: Toggle between ascending/descending order
  • Visual Charts: Interactive charts powered by Chart.js
    • Record distribution bar chart
    • Automation overview doughnut chart
    • Apex code distribution pie chart
  • Responsive Design: Works seamlessly on desktop, tablet, and mobile devices

🔍 Key Sections

  1. Data Metrics - Overview of record counts across standard objects
  2. Data Quality - Identify records with missing key fields
  3. Security & Access - User distribution by profiles and permission sets
  4. Configuration & Automation - Automation and reporting tools usage

demo-1

demo-2

🛠️ Prerequisites

  • Node.js v14 or higher
  • Salesforce CLI (sf) installed and authenticated
  • Access to a Salesforce org

📦 Installation

Option 1: NPM Package (Recommended)

npm install -g sf-kpi-dashboard

🚀 Usage

Basic Command

sf-kpi -o <username-or-alias>

Examples

# Using org username
sf-kpi -o [email protected]

# Using org alias
sf-kpi -o myDevOrg

# Specify custom port (optional)
sf-kpi -o myDevOrg --port 8080

Command Options

| Option | Alias | Description | Required | Default | |--------|-------|-------------|----------|---------| | --org | -o | Salesforce org username or alias | ✅ Yes | - | | --port | -p | Port for local server | ❌ No | 8080 | | --help | -h | Display help information | ❌ No | - | | --version | -V | Show version number | ❌ No | - |

📊 Dashboard Sections Explained

1. Data Metrics

Displays the total count of:

  • Custom objects in your org
  • Records across key standard objects (Account, Contact, Opportunity, Campaign, Lead, Case)
  • Visual bar chart showing record distribution

2. Data Quality

Identifies records with missing critical fields:

  • Accounts: Missing Phone, Industry, or Annual Revenue
  • Contacts: Missing Phone, Email, or Title
  • Opportunities: Missing Amount, Close Date, or Stage Name

3. Security & Access

Users by Profile

  • Searchable and sortable list of all active user profiles
  • Shows user count per profile
  • Real-time filtering

Users by Permission Set

  • Searchable and sortable list of permission sets
  • Displays assignment count for each permission set
  • Excludes profile-owned permission sets

4. Configuration & Automation

Tracks your org's automation and reporting tools:

  • Reports and Dashboards count
  • Active and inactive Flows
  • Active Validation Rules
  • Apex Classes and Triggers
  • Visual charts for automation and code distribution

🎯 Use Cases

For Salesforce Administrators

  • Org Health Check: Quick overview of data distribution and quality
  • Security Audit: Review user access and permission assignments
  • Automation Inventory: Track flows, validation rules, and custom code

For Salesforce Architects

  • Technical Debt Assessment: Identify unused or inactive automation
  • Capacity Planning: Understand data volume and growth patterns
  • Documentation: Generate snapshots for architectural reviews

For Business Analysts

  • Data Completeness: Identify data quality issues
  • Adoption Metrics: Track record creation across objects
  • Reporting Coverage: Assess reports and dashboards inventory

🔧 How It Works

  1. Authentication: Uses Salesforce CLI to retrieve access token
  2. Data Collection: Queries Salesforce REST and Tooling APIs
  3. Processing: Aggregates and organizes metrics
  4. Generation: Creates a standalone HTML file with embedded data
  5. Display: Automatically opens the dashboard in your default browser

📁 Output

The tool generates an HTML file named:

sf-kpi-dashboard-{timestamp}.html

The file is:

  • ✅ Self-contained (no external dependencies except CDN resources)
  • ✅ Shareable (send to stakeholders)
  • ✅ Archivable (track changes over time)
  • ✅ Printable (export to PDF from browser)

🐛 Troubleshooting

Authentication Errors

Error: Failed to get org information

Solution: Ensure you're authenticated to the org:


### API Errors
```bash
Error: Failed to fetch [metric]

Solution: Check your user permissions. You need:

  • View All Data (or View Setup and Configuration)
  • API Enabled

Missing Data

If certain metrics show as "N/A":

  • The object may not exist in your org
  • You may lack permissions to query the object
  • The object may have restricted access

📈 Performance

  • Typical Runtime: 10-30 seconds depending on org size
  • API Calls: ~15-20 API requests
  • Memory Usage: < 100MB
  • Output File Size: ~50-100KB

🔒 Security & Privacy

  • ✅ No data is sent to external servers
  • ✅ Access tokens are retrieved from Salesforce CLI
  • ✅ All processing happens locally
  • ✅ Generated HTML contains only metadata, not sensitive data
  • ⚠️ Note: The generated HTML file contains org information. Handle with appropriate security measures.

Ideas for Contribution

  • Add more KPI metrics
  • Create additional chart types
  • Export data to CSV/JSON
  • Add historical tracking
  • Create scheduling functionality

📝 License

MIT License

🗺️ Roadmap

  • [ ] Export to PDF
  • [ ] CSV data export
  • [ ] Historical comparison
  • [ ] Scheduled execution
  • [ ] Email delivery
  • [ ] Custom object support
  • [ ] Multi-org comparison
  • [ ] Integration with CI/CD pipelines

Made with ❤️ for the Salesforce Community