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

mere-analytics-cli

v0.1.2

Published

Mere Analytics CLI — query your analytics and read the schema from the terminal

Readme

Mere Analytics CLI

A thin terminal wrapper around the Mere Analytics HTTP API. Authenticate once in your browser, then run SQL and read your schema from the command line.

By default the CLI works with the hosted cloud version at https://app.usemere.com. It also works against any self-hosted instance of the open-source server — jjdinho/mere-analytics — via --api-url (see Self-hosting).

mere auth login          # browser OAuth, pick a project
mere schema              # list queryable tables and columns
mere query "SELECT event, count() AS n FROM events GROUP BY event ORDER BY n DESC LIMIT 10"

Install

npm install -g mere-analytics-cli

Or run it from source:

npm install
npm run build
node dist/index.js --help

Requires Node.js 18+.

Authentication

mere auth login

This runs the OAuth 2.1 authorization-code + PKCE flow: it opens your browser, you sign in and choose which project to grant, and the CLI stores the resulting access token in ~/.mere/config.json (mode 0600).

Access tokens last one hour. When yours expires, just run mere auth login again.

mere auth status         # show the active instance, project, and expiry
mere whoami              # confirm the identity/project your token is bound to
mere auth logout         # delete stored credentials

Self-hosting

By default the CLI talks to the hosted cloud instance at https://app.usemere.com. Mere Analytics is also fully open source and self-hostable — jjdinho/mere-analytics. To point the CLI at your own instance, pass --api-url at login:

mere auth login --api-url https://analytics.example.com

The URL is saved alongside your token, so every later query, schema, and whoami automatically targets that instance. Switch back to the cloud (or another instance) by logging in again with a different --api-url.

Commands

| Command | Description | |---|---| | mere auth login [--api-url <url>] | Authenticate via the browser. --api-url selects a self-hosted instance. | | mere auth logout | Clear stored credentials. | | mere auth status | Show the active instance, project, and token expiry. | | mere query [sql] | Run read-only ClickHouse SQL. Reads from stdin if no argument is given. | | mere schema | Show the queryable tables and columns for your project. | | mere whoami | Show the identity and project your token is bound to. |

Querying

Pass SQL as an argument or pipe it via stdin:

mere query "SELECT count() FROM events"
cat report.sql | mere query

Queries run against three tables — events, persons, and sessions — scoped automatically to your project (you never add a project_id filter). Results are capped server-side, so always include a LIMIT. Run mere schema to see every column, type, and description.

JSON output

Add --json to any command for machine-readable output instead of a table — useful for scripting and piping into jq:

mere query "SELECT event, count() AS n FROM events GROUP BY event" --json | jq '.rows'
mere schema --json

Errors are reported on stderr (or as {"ok": false, "error": ...} with --json) and the process exits non-zero:

| Code | Meaning | |---|---| | 0 | OK | | 1 | Usage error (bad arguments, bad SQL) | | 2 | Not found | | 3 | Auth error (not logged in / expired token) | | 4 | Forbidden | | 5 | Rate limited | | 6 | Network error | | 7 | API error (5xx) |

Development

npm install
npm test          # run the vitest suite
npm run typecheck # type-check with tsc
npm run build     # bundle to dist/ with tsup