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

choppingboard

v1.0.11

Published

Salad monitoring server as an npm module with SQLite backend

Downloads

854

Readme

Chopping Board - Salad Analytics Dashboard

A comprehensive monitoring and analytics platform for tracking Salad chopping earnings, electricity consumption, and machine performance. Built with Node.js, Express, and SQLite.

Overview

Chopping Board provides real-time insights into your Salad chopping operations across multiple machines. Track earnings, monitor power consumption with TPLink smart meters, calculate profitability, and visualize performance trends through an intuitive web dashboard.

Features

Earnings Tracking

  • Multi-Machine Monitoring - Track unlimited machines across your Salad account
  • Real-time Earnings - Hourly and daily earnings with automatic updates every 5 minutes
  • Moving Averages - 7, 14, 30, 50, and 100-day moving averages for trend analysis
  • Earnings Predictions - Estimated daily earnings based on current performance
  • Reward Management - Track and assign Salad rewards to your sub-accounts
  • Export Data - Download earnings data as a CSV

Energy Monitoring

  • TPLink Integration - Monitor electricity consumption via TPLink (KP115) smart meters
  • Cost Analysis - Calculate electricity costs with configurable KWh pricing
  • Profit Tracking - Real-time profit calculations (earnings minus electricity costs)
  • Machine-Level Power - Per-machine power consumption tracking

Data Visualization

  • Interactive Charts - Dynamic charts with Chart.js (line/bar graph toggle)
  • Multiple Views - Daily, hourly, 7-day, 14-day, and 30-day timeframes
  • Customizable Displays - Filter by machine, profile, or view total aggregated data
  • Export Charts - Copy chart images to clipboard with one click

Machine Management

  • Custom Names & Colors - Personalize machine labels and graph colors
  • Account Assignment - Organize machines by owner/sub-account
  • Visibility Toggle - Show/hide machines from charts and tables
  • Lifetime Tracking - Historical balance and creation timestamps

Privacy & Security

  • Data Blurring - Toggle visibility for earnings, balances, IPs, MAC addresses, and dates
  • Session Management - Secure session handling with CSRF protection
  • Local Storage - All data stored locally in SQLite (no external analytics)

Prerequisites

  • Node.js v14 or higher
  • npm (comes with Node.js)
  • Salad Account - You'll configure your auth token after installation via the web dashboard
  • TPLink Smart Meter (optional, for power monitoring)

Installation

1. Install Node.js and npm

If you don't have Node.js installed, download and install it from the official website:

Download Node.js - Choose the LTS (Long Term Support) version

This will install both Node.js and npm. Verify the installation by running in a command terminal:

node --version
npm --version

2. Initialize Your Project

Create a project folder anywhere you like: For example, on Mac, ~/choppingboard Or on Windows, C:\choppingboard

Navigate to your project folder in a terminal and initialize a new Node.js project:

npm init -y

This creates a package.json file in your project folder, which is required for installing packages.

3. Create Your Server File

Create a new file (e.g., app.js) in your project folder:

const { start } = require('choppingboard');
const path = require('path');

const server = start({
  port: 3001,                                           // Server port
  databasePath: path.join(__dirname, 'data', 'salad.db') // Database location
});

4. Install Package

npm install choppingboard

Note that on Apple Silicon Macs you will need XCode and Homebrew to install dependencies to compile canvas.js

5. Start the Server

Run your server file:

node app.js

Or add a start script to your package.json:

{
  "scripts": {
    "start": "node app.js"
  }
}

Then run:

npm start

6. Access Dashboard and Configure Auth Token

Open your browser and navigate to:

http://localhost:3001

On first run, you'll see a warning icon in the navigation bar indicating that you need to configure your Salad auth token.

To add your auth token:

  1. Click on the Settings dropdown in the navigation bar
  2. Select Auth Token (see ⚠️ SECURITY WARNING: ⚠️ below)
  3. To get your token on Chrome:
    • Open browser Developer Tools (F12)
    • Log into your Salad account at https://salad.com/login
    • Go to the Application tab
    • Under Storage, find Cookieshttps://salad.com
    • Copy the value of the auth cookie
  4. Paste the token into the input field and click Save
  5. The warning will disappear once a valid token is configured

⚠️ SECURITY WARNING: ⚠️ Never share your Salad auth token with anyone. This token provides full access to your Salad account, including earnings, personal information, and the ability to redeem rewards. Treat it like a password and keep it private.

The database will automatically initialize on first run (could take up to ten minutes to see data).

7. Create Profile(s) and Assign Machine(s)

Under "Settings", select "Profiles"

Click the blue + icon on the tab and create a profile.

Then back under "Settings", select "Machines"

If your salad earnings data has been initialized, you will see your machines in there. Click the blue buttons on the table rows to assign the machines to whichever profile you want.

Configuration

Application Settings

Configure via your server file:

| Setting | Description | Default | |---------|-------------|---------| | port | Server port number | 3001 | | databasePath | SQLite database file location | ./data/salad.db |

Dashboard Settings (via Web Interface)

Additional settings configurable through the web dashboard:

Auth Token (Settings → Auth Token):

  • Salad Auth Token - Required for API access. Configure this first on initial setup.

App Settings:

| Setting | Description | Default | |---------|-------------|---------| | Dashboard Refresh Interval | How often the dashboard polls the server (minutes) | 2 | | KWh Price | Electricity cost per kilowatt-hour | 0.105 |

Database Location

The SQLite database is stored at the path specified in databasePath. The data/ directory is created automatically if it doesn't exist.

Default: ./data/salad.db

Data Collection vs Dashboard Refresh

Data Collection Interval (Server-side):

  • The server automatically fetches data from Salad's API every 5 minutes (hardcoded)
  • This includes earnings data, machine status, and TPLink meter readings
  • Cannot be changed via dashboard settings

Dashboard Refresh Interval (Client-side):

  • Controls how often your browser refreshes the dashboard data from the server
  • Configurable in "App Settings" (default: 2 minutes)
  • Only affects how often the dashboard updates, not how often data is collected

Usage

Dashboard Overview

The main dashboard displays:

  1. Current Balance - Total Salad balance across all accounts
  2. Today's Earnings - Current day earnings with prediction
  3. Yesterday's Earnings - Previous day totals
  4. 24-Hour Earnings - Rolling 24-hour window
  5. 7/14/30-Day Earnings - Weekly, biweekly, and monthly totals with moving averages

Interactive Charts

  • Chart/Table Toggle - Switch between visual and tabular data
  • Line/Bar Graph - Choose visualization style
  • Zoom Levels - 1x, 1.5x, 2x chart height
  • Machines/Total Toggle - View per-machine or aggregated data
  • Copy Chart - Green button to copy chart as PNG image to clipboard

Managing Profiles

Create multiple accounts to organize machines by owner:

  1. Go to "Profiles" under "Settings"
  2. Click "New Account"
  3. Enter username and profile details
  4. Assign machines to the account

Managing Machines

Assign to Account:

  1. Find machine in machines settings
  2. Select owner from dropdown
  3. Changes save automatically

Rename Machine:

  1. Go to Machines Settings
  2. Click highlighted machine name/id
  3. Enter new name and select color
  4. Click "Save"

Hide/Show Machine:

  1. Toggle visibility checkbox in machine row
  2. Hidden machines excluded from charts but remain in database

Adding Smart Meters

  1. Ensure TPLink device is on the same network
  2. Navigate to "Emeters Table"
  3. Click "Add Emeter"
  4. Enter device IP address
  5. Select meter type (TPLink)
  6. Assign to a machine
  7. Data collection begins automatically

Privacy Settings

Toggle data blurring in the dashboard:

  • Blur Balances - Hide current and lifetime balances
  • Blur Earnings - Hide earnings amounts
  • Blur Costs - Hide electricity cost calculations
  • Blur IP/MAC - Hide smart meter network addresses
  • Blur Machine IDs - Hide Salad machine IDs
  • Blur Dates - Hide timestamps

API Endpoints

Data Retrieval

| Method | Endpoint | Description | |--------|----------|-------------| | GET | / | Main dashboard (daily view) | | GET | /hourly | Hourly earnings view |

Configuration

| Method | Endpoint | Description | |--------|----------|-------------| | POST | /postStartEnd | Update chart date range | | POST | /postAppSettings | Update KWh price and refresh interval | | POST | /postUpdateAuthToken | Update Salad API token | | POST | /postChartSettings | Configure graph type and display mode |

Machine Management

| Method | Endpoint | Description | |--------|----------|-------------| | POST | /postAssign | Assign machine to account | | POST | /postMachineName | Update machine name and color | | POST | /postRemoveMachine | Delete machine from database |

Smart Meters

| Method | Endpoint | Description | |--------|----------|-------------| | POST | /postEmeter | Add or configure smart meter |

Accounts & Rewards

| Method | Endpoint | Description | |--------|----------|-------------| | POST | /postNewAccount | Create new account | | POST | /postAssignReward | Assign reward recipient | | POST | /postIntervalRefresh | Trigger manual data refresh |

Database Schema

The application uses SQLite with the following tables:

Core Tables

  • machine - Machines with lifetime balance and metadata
  • machineOwner - Machine-to-account assignments
  • account - User accounts and profiles
  • auth - Salad API authentication tokens
  • hourlyIncome - Hourly earnings per machine
  • incomeDaily - Daily aggregated earnings with moving averages
  • reward - Salad rewards (pending and redeemed)
  • log - System event logging

Energy Monitoring

  • emeter - Smart meter device information
  • emeterList - Supported meter types (TPLink)
  • emeterDailyEnergyUsage - Daily power consumption per machine

Features

  • Auto-updating timestamps via triggers
  • Indexed columns for performance
  • UPSERT patterns for conflict resolution
  • Foreign key enforcement

Module Structure:

  • app.js - Main server initialization and exports
  • lib/ - Database schema and query functions
  • service/ - Salad API and TPLink integration
  • website/ - Express routes, views, and static assets

Advanced users can explore the module structure in node_modules/choppingboard/ after installation, though the primary interface is the configuration object passed to start().

Troubleshooting

Database Errors

Issue: Database not initialized error

  • Solution: Ensure databasePath is writable and the directory exists

Issue: Database file locked

  • Solution: Close other connections to the SQLite file. Better-sqlite3 uses WAL mode for better concurrency.

Authentication Issues

Issue: 401 Unauthorized from Salad API

  • Solution: Update your Salad auth token via the web dashboard (Settings → Auth Token)

Issue: Token expired

  • Solution: Get a fresh token from https://app.salad.com and update it via the web dashboard (Settings → Auth Token)

Issue: No auth token configured (warning icon in navigation)

  • Solution: Configure your Salad auth token via the web dashboard (Settings → Auth Token) - see Step 5 in Installation section

TPLink Connection Issues

Issue: Smart meter not found

  • Solution: Verify device is on the same network and IP address is correct

Issue: No power data showing

  • Solution: Ensure the emeter is assigned to a machine and wait for the next data collection cycle (5 minutes)

Port Already in Use

Issue: EADDRINUSE: address already in use :::3001

  • Solution: Change the port in your server file or stop the process using port 3001
# Find process using port 3001
lsof -i :3001

# Kill the process (replace PID with actual process ID)
kill -9 PID

Data Privacy

All data is stored locally in your SQLite database. Chopping Board does not send your earnings data, machine information, or any analytics to third-party servers. The only external connections are:

  1. Salad API (app-api.salad.com) - To fetch your earnings data
  2. TPLink Devices - Local network communication only
  3. npmjs.com - Retrieves latest package version number

Contributing

Contributions are welcome! Please feel free to contact us on the Discord linked in the dashboard!

License

This project is open source under the ISC license.

Support

For questions, issues, or feature requests, please open a ticket on the Discord server.


Happy Chopping! 🥗