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

opencode-dash

v1.0.7

Published

Dashboard for opencode CLI usage analytics

Downloads

491

Readme

opencode-dash

opencode-dash is a self-hosted hosted dashboard that visualizes your opencode CLI usage analytics. It Visualizes sessions, tokens, costs, models, and agents, from your local SQLite database.

License CI npm

Quick Start

npm install
npx opencode-dash

Opens a local dashboard at http://localhost:3000 showing your sessions, tokens, costs, models, and projects. The CLI auto-detects your OS (macOS, Linux, Windows) and finds your opencode database automatically.

Features

| Feature | Description | |---------|-------------| | Session Analytics | Agent type, model, cost, and token usage | | Activity Heatmap | Calendar heatmap of daily session activity | | Model Distribution | Pie/donut chart of model usage across sessions | | Privacy-first | No backend, no account creation needed; everything runs locally |

Example Dashboard:

How It Works

  • Reads opencode's SQLite database (~/.local/share/opencode/opencode.db on all platforms, or $XDG_DATA_HOME/opencode/opencode.db when set)
  • Built on Evidence.dev - lightweight SQL-driven, Svelte-based reporting
  • Static site output: npm run build produces a deployable build/ directory
  • No backend or account creation needed. So the data stays on your device.

Environment Variables

| Variable | Purpose | |----------|---------| | OPENCODE_DB | Absolute path to the database file (bypasses all auto-detection) | | OPENCODE_DATA_DIR | Custom opencode data directory | | XDG_DATA_HOME | Override the XDG data home (default: ~/.local/share) |

Contribution

Project Structure

opencode-telematics/
├── bin/
│   └── cli.js                 # CLI entry point — detects OS, launches dashboard
├── lib/
│   └── db-path.js             # DB path resolution (xdg-basedir, env overrides)
├── app/
│   ├── pages/                 # Dashboard pages (.md)
│   │   ├── index.md           # Overview
│   │   ├── cost.md            # Token economics
│   │   ├── activity.md        # Usage over time
│   │   ├── agents.md          # Agent distribution
│   │   ├── messages.md        # Message/part analysis
│   │   ├── models.md          # Model usage
│   │   ├── projects.md        # Projects list/costing
│   │   ├── events.md          # Event types
│   │   └── quality.md         # Finish reasons, todos
│   ├── components/            # Reusable Svelte components
│   ├── sources/opencode/      # SQL queries (.sql) + connection config
│   ├── build/                 # Static site output (generated)
│   └── evidence.config.yaml
├── test/
│   ├── db-path.test.js        # Unit tests — DB path resolution
│   └── e2e.test.js            # E2E smoke tests
└── package.json               # Root CLI package

Core Tables

These tables are created and populated automatically by opencode after each session. The CLI extracts from them to build the dashboard.

| Table | Key Columns | |-------|-------------| | session | id, project_id, parent_id, agent, model, cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read/write, time_created | | message | id, session_id, data (role, mode, finish reason), time_created | | part | id, message_id, session_id, data (type, text), time_created | | project | id, worktree, vcs, name |

Other tables: todo, event, event_sequence.

Development Setup

git clone https://github.com/MuhammadOmarMuhdhar/opencode-dash.git
cd opencode-dash
npm install

# Prepare source connection, build, and preview
cp app/sources/opencode/connection.template.yaml app/sources/opencode/connection.yaml
ln -sf ~/.local/share/opencode/opencode.db app/sources/opencode/opencode.db
npm run sources
npm run build
npm run preview

# Or just use the CLI (handles all preparation automatically):
node bin/cli.js

Testing

| Command | Scope | |---------|-------| | node --test test/db-path.test.js | Unit tests — validates DB path resolution across all OS/env scenarios | | npm run build | CI — builds static dashboard, catches broken SQL and layout errors | | npm run test:e2e | E2E — full npx simulation (pack → install → build → serve → page fetch) |

CI runs npm run build on every push and PR. Unit tests can be run locally:

node --test test/db-path.test.js

Local tarball test

rm -rf app/.evidence/ app/build/ app/.sources-manifest.json

# Prepare source connection (normally done by bin/cli.js)
cp app/sources/opencode/connection.template.yaml app/sources/opencode/connection.yaml
ln -sf ~/.local/share/opencode/opencode.db app/sources/opencode/opencode.db

npm run sources
npm run build
rm -f app/.gitignore

# Clean up prepared files
rm -f app/sources/opencode/connection.yaml app/sources/opencode/opencode.db

npm pack
npm install -g ./opencode-dash-1.0.4.tgz
opencode-dash

License

ISC - see LICENSE.