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

bodhi-node-profiler

v1.1.0

Published

A lightweight, zero-configuration performance profiler for Node.js applications with real-time dashboard

Readme

Bodhi Node Profiler

🚀 A lightweight, zero-configuration performance profiler for Node.js applications with real-time dashboard

npm version License: MIT TypeScript PRs Welcome

🎯 Overview

Unlock the full potential of your Node.js applications with Bodhi Node Profiler! Monitor, debug, and optimize your application's performance in real-time with minimal setup. Whether you're debugging in development or monitoring in production, Bodhi Node Profiler provides the insights you need.

⚡️ Why Choose Bodhi Node Profiler?

  • 🚀 One-Line Integration: Start profiling with minimal code changes
  • 📊 Real-Time Dashboard: Beautiful, modern dashboard with live metrics
  • 🔍 Comprehensive Metrics: CPU, Memory, Event Loop, and API performance
  • Production Ready: Low overhead (<50MB memory, <1% CPU)
  • 🛠️ Developer Friendly: TypeScript & JavaScript support, Express.js integration

🆕 New Features!

  • 📈 Enhanced Real-time Charts: Beautiful visualizations using Chart.js
  • 🎯 Accurate CPU Monitoring: Improved CPU usage calculation
  • ⏱️ API Response Time Tracking: Monitor endpoint performance
  • 🔄 Event Loop Monitoring: Track event loop delays
  • 💡 Smart Status Indicators: Visual health status for each metric
  • Uptime Tracking: Monitor your application's uptime
  • 🎨 Modern UI: Clean, responsive dashboard design with Tailwind CSS

Quick Start

1. Install

npm install bodhi-node-profiler

2. Basic Usage

const express = require('express');
const { BodhiProfiler } = require('bodhi-node-profiler');

const app = express();

// Initialize profiler with modern dashboard
const profiler = new BodhiProfiler({
    serviceName: 'my-app',
    port: 45680,  // Dashboard port
    enableWebDashboard: true
});

app.use(profiler.middleware());

app.listen(3000, () => {
    console.log('Server running on port 3000');
    console.log('Profiler dashboard available at http://localhost:45680/profiler');
});

3. Access the Dashboard

Once your application is running, access the beautiful real-time dashboard at:

http://localhost:45680/profiler

Note: The dashboard port (45680) can be configured using the port option in the BodhiProfiler constructor.

Dashboard Features

The new dashboard provides:

  • 📊 Real-time Metrics
    • CPU Usage with status indicators (Good/Warning/High)
    • Memory Usage and allocation tracking
    • Event Loop Delay monitoring
    • API Response Time analysis
  • 📈 Live Charts
    • CPU utilization trends
    • Memory consumption patterns
    • Event loop performance
    • API response times
  • 💻 System Information
    • Total Memory usage
    • Application Uptime
    • Last Updated timestamp
  • 🎨 Modern Design
    • Clean, responsive layout
    • Intuitive metric cards
    • Status indicators
    • Beautiful animations

Features

📊 Real-time Performance Monitoring

  • CPU usage tracking
  • Memory leak detection
  • Event loop delay monitoring
  • API response time analysis
  • Custom metrics support

🔍 Comprehensive API Profiling

  • Automatic endpoint detection
  • Response time tracking
  • Error rate monitoring
  • Request/Response logging
  • Route usage analytics

⚡ Production-Ready

  • Minimal overhead
  • Safe for production use
  • Configurable logging
  • Alert thresholds
  • No external dependencies

🛠️ Developer Experience

  • TypeScript support
  • Express.js integration
  • Beautiful web dashboard
  • Easy configuration
  • Detailed documentation

Usage Examples

1. REST API Server

const express = require('express');
const { BodhiProfiler } = require('bodhi-node-profiler');

const app = express();

// Custom configuration
const profiler = new BodhiProfiler({
    logPath: './logs',
    sampleInterval: 1000,
    enableWebDashboard: true,
    port: 8080
});

app.use(profiler.middleware());

// Your routes will be automatically profiled!
app.get('/api/users', async (req, res) => {
    const users = await db.getUsers();
    res.json(users);
});

2. GraphQL Server

const { ApolloServer } = require('apollo-server');
const { BodhiProfiler } = require('bodhi-node-profiler');

const profiler = new BodhiProfiler();

const server = new ApolloServer({
    typeDefs,
    resolvers,
    plugins: [{
        requestDidStart: () => ({
            willSendResponse: (requestContext) => {
                // Track GraphQL operation performance
                profiler.trackOperation({
                    type: 'GraphQL',
                    name: requestContext.operationName,
                    duration: requestContext.request.duration
                });
            }
        })
    }]
});

3. Microservices Architecture

const express = require('express');
const { BodhiProfiler } = require('bodhi-node-profiler');

// Initialize with service-specific config
const profiler = new BodhiProfiler({
    serviceName: 'auth-service',
    logPath: './logs/auth-service',
    tags: ['microservice', 'auth'],
    alertThresholds: {
        memory: 1024 * 1024 * 1024, // 1GB
        cpu: 80, // 80% CPU usage
        responseTime: 1000 // 1 second
    }
});

// Get real-time metrics
app.get('/health', (req, res) => {
    const metrics = profiler.getMetrics();
    res.json({
        status: 'healthy',
        ...metrics
    });
});

4. Background Jobs

const { BodhiProfiler } = require('bodhi-node-profiler');

const profiler = new BodhiProfiler({
    logPath: './logs/jobs'
});

async function processQueue() {
    const start = Date.now();
    
    try {
        await heavyJob();
        profiler.trackOperation({
            type: 'Job',
            name: 'processQueue',
            duration: Date.now() - start
        });
    } catch (error) {
        profiler.trackError({
            type: 'Job',
            name: 'processQueue',
            error
        });
    }
}

Advanced Features

1. Custom Metrics

// Track custom business metrics
profiler.trackMetric({
    name: 'activeUsers',
    value: getUserCount(),
    tags: ['business', 'users']
});

2. Performance Alerts

const profiler = new BodhiProfiler({
    alerts: {
        onHighMemory: (usage) => notifyDevOps('High memory usage detected', usage),
        onHighCPU: (usage) => scaleService(),
        onSlowEndpoint: (data) => logPerformanceIssue(data)
    }
});

3. Memory Leak Detection

const profiler = new BodhiProfiler({
    memoryLeakDetection: true,
    heapSnapshotInterval: 3600000 // 1 hour
});

Log Management

The profiler now includes smart log management features:

Log Rotation

  • Automatic log rotation based on size or date
  • Compressed archives for space efficiency
  • Configurable retention periods
logging: {
    rotation: {
        maxFiles: '7d',      // Keep 7 days of logs
        maxSize: '5m',       // Rotate at 5MB
        datePattern: 'YYYY-MM-DD',
        compress: true       // Compress old logs
    }
}

Log Cleanup

  • Automatic cleanup of old logs
  • Configurable retention period
  • Separate archive directory
logging: {
    cleanup: {
        enabled: true,
        maxAge: '30d'       // Delete logs older than 30 days
    }
}

Metric Thresholds

Only log metrics when they exceed specified thresholds:

metrics: {
    cpu: {
        threshold: 70       // CPU usage > 70%
    },
    memory: {
        threshold: 80       // Memory usage > 80%
    },
    eventLoop: {
        threshold: 100      // Delay > 100ms
    },
    api: {
        responseTime: {
            threshold: 1000 // Response time > 1s
        }
    }
}

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | logPath | string | './logs' | Directory for performance logs | | port | number | 8080 | Dashboard port | | sampleInterval | number | 1000 | Metrics collection interval (ms) | | enableWebDashboard | boolean | true | Enable/disable web dashboard | | serviceName | string | undefined | Service identifier for distributed systems | | tags | string[] | [] | Tags for metric categorization | | alertThresholds | object | {} | Performance alert thresholds |

Why Bodhi Node Profiler?

  1. Zero Configuration: Works out of the box with smart defaults
  2. Low Overhead: Minimal impact on application performance
  3. Real-time Insights: Instant visibility into performance issues
  4. No External Dependencies: Everything you need is included
  5. TypeScript Support: Full type definitions included

Performance Impact

  • Memory Overhead: < 50MB
  • CPU Overhead: < 1%
  • Response Time Impact: < 0.5ms

Best Practices

  1. Development:

    • Enable all features for maximum insight
    • Use lower sampling intervals for detailed data
  2. Production:

    • Adjust sampling intervals based on traffic
    • Enable alerts for proactive monitoring
    • Use log rotation for long-running services

💭 A Note from the Developer

Hey there! I'm Bodheesh VC, a passionate Node.js developer who believes in making development easier and more efficient for everyone. I created Bodhi Node Profiler because I felt the pain of debugging performance issues in production applications and wanted a simple, lightweight solution that just works.

This project is my contribution to the amazing Node.js community that has given me so much. It's built with love, attention to detail, and a focus on developer experience. Whether you're building a small API or a large microservices architecture, I hope this tool makes your development journey a little bit easier.

I'm actively maintaining this project and would love to hear your feedback! Feel free to reach out on Twitter or LinkedIn if you have questions or just want to chat about Node.js performance optimization.

Let's make the Node.js ecosystem better together! 🚀


Contributing

I believe in the power of community! If you'd like to contribute, here's how you can help:

  • 🐛 Report bugs and issues on our GitHub Issues
  • 💡 Suggest new features
  • 📖 Improve documentation
  • 🔧 Submit pull requests
  • ⭐ Star the project if you find it useful!

Check out our Contributing Guide for more details.

Support

Need help? I'm here for you!

License

MIT © Bodheesh VC