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

lsq-mini-cli

v0.1.3

Published

Unofficial minimal Lemon Squeezy CLI for Node.js

Readme

Lemon Squeezy Mini CLI (Unofficial)

Unofficial, community CLI for the Lemon Squeezy API. Runs locally (no browser) and is not affiliated with or endorsed by Lemon Squeezy.

Security: Keep your API key secret. Do not commit ~/.lsq-mini-cli.json or any .env files to source control.

Features

  • Configure once (API key + optional store) and reuse across commands.
  • List and inspect stores, products, variants, prices, orders, customers.
  • Create checkouts, manage discounts, webhooks, subscriptions, license keys, usage records.
  • Works with env vars or a local config file (~/.lsq-mini-cli.json by default).

Requirements

  • Node.js >= 18
  • Lemon Squeezy API key (LEMONSQUEEZY_API_KEY or LEMON_SQUEEZY_API_KEY)

Install

Local (inside repo):

pnpm install   # or npm install

Global (so you can run lsq directly):

npm install -g lsq-mini-cli

Set env vars (optional if you prefer lsq config set):

echo "LEMONSQUEEZY_API_KEY=..." > .env
echo "LEMONSQUEEZY_STORE_ID=..." >> .env   # optional

Config location: ~/.lsq-mini-cli.json (override with LSQ_CONFIG_PATH).

Quick start

If installed globally, use lsq <command>. If calling through npm scripts, use npm run lsq -- <command> (the -- separates npm args).

# Check config (masked)
lsq config get

# Save API key + store to config
lsq config set --api-key sk_test_xxx --store 12345

# List products for the default store
lsq products:list

# Create a checkout (replace IDs/emails)
lsq checkout:create --store 12345 --variant 6789 --email [email protected] --preview

Common commands

  • Config: lsq config set|get|import-env
  • Stores: lsq stores:list
  • Products/variants/prices: lsq products:list, lsq variants:list --product <id>, lsq prices:list --variant <id>
  • Orders: lsq orders:list [--store <id>] [--email <email>]
  • Customers: lsq customers:list [--store <id>] [--email <email>]
  • Checkouts: lsq checkouts:list ..., lsq checkout:create --store <id> --variant <id> [...]
  • Discounts: lsq discounts:list|create|delete|redemptions
  • Webhooks: lsq webhooks:list|create|delete
  • Subscriptions: lsq subscriptions:list|cancel|invoices
  • License keys: lsq license-keys:list|instances|update
  • Usage records: lsq usage:list|create

Example output

$ lsq config get
Config: { apiKey: 'sk_***xxx', storeId: '12345', fromEnv: true }

$ lsq stores:list
┌─────────┬───────┬──────────┬─────────┬──────────────────┬──────────┐
│ (index) │  id   │   name   │  slug   │      domain      │ currency │
├─────────┼───────┼──────────┼─────────┼──────────────────┼──────────┤
│    0    │ '123' │ 'My Dev' │ 'mydev' │ 'mydev.lemonsq…' │  'USD'   │
└─────────┴───────┴──────────┴─────────┴──────────────────┴──────────┘

$ lsq checkout:create --store 123 --variant 456 --email [email protected] --preview
Checkout created: { id: '789', url: 'https://checkout.lemonsqueezy.com/checkout/xyz', preview: true, test_mode: false }

Per-command output examples

# Stores
lsq stores:list
┌─────────┬───────┬──────────┬─────────┬──────────────────┬──────────┐
│ (index) │  id   │   name   │  slug   │      domain      │ currency │
├─────────┼───────┼──────────┼─────────┼──────────────────┼──────────┤
│    0    │ '123' │ 'My Dev' │ 'mydev' │ 'mydev.lemonsq…' │  'USD'   │
└─────────┴───────┴──────────┴─────────┴──────────────────┴──────────┘

# Products
lsq products:list --store 123
┌─────────┬───────┬───────┬────────────────┬─────────┬─────────────┐
│ (index) │  id   │ store │      name      │ status  │    price    │
├─────────┼───────┼───────┼────────────────┼─────────┼─────────────┤
│    0    │ '45'  │  123  │ 'Starter Plan' │ 'draft' │ '$9.00'     │
└─────────┴───────┴───────┴────────────────┴─────────┴─────────────┘

# Variants / Prices
lsq variants:list --product 45
lsq prices:list --variant 67

# Orders
lsq orders:list --store 123 --page 1 --size 5
┌─────────┬─────────┬────────┬────────┬──────────┬─────────────────────┬──────────────────────┐
│ (index) │   id    │ store  │ status │ currency │        total        │        created       │
├─────────┼─────────┼────────┼────────┼──────────┼─────────────────────┼──────────────────────┤
│    0    │ '888'   │  123   │ 'paid' │  'USD'   │ '$19.00'            │ '2024-10-01T12:00Z'  │
└─────────┴─────────┴────────┴────────┴──────────┴─────────────────────┴──────────────────────┘

# Customers
lsq customers:list --store 123
┌─────────┬────────┬──────────────┬──────────────┬─────────────────────┬─────────┐
│ (index) │  id    │     name     │    email     │   total_revenue     │   mrr   │
├─────────┼────────┼──────────────┼──────────────┼─────────────────────┼─────────┤
│    0    │ '321'  │ 'Jane Doe'   │ '[email protected]' │ '$190.00'           │ '$0.00' │
└─────────┴────────┴──────────────┴──────────────┴─────────────────────┴─────────┘

# Order items
lsq order-items:list --order 888
┌─────────┬────────┬────────┬─────────┬───────┬─────┐
│ (index) │   id   │ order  │ product │ price │ qty │
├─────────┼────────┼────────┼─────────┼───────┼─────┤
│    0    │ '9'    │  888   │   45    │ 1900  │  1  │
└─────────┴────────┴────────┴─────────┴───────┴─────┘

# Files / Checkouts
lsq files:list --variant 67
lsq checkouts:list --store 123 --variant 67

# Discounts
lsq discounts:list --store 123
lsq discounts:create --store 123 --name Launch --code LAUNCH10 --amount 10 --type percent
Discount created: { id: '901', code: 'LAUNCH10' }
lsq discounts:redemptions --discount 901

# Webhooks
lsq webhooks:list --store 123
lsq webhooks:create --store 123 --url https://example.com/webhook --events order_created,order_refunded
Webhook created: { id: '777', url: 'https://example.com/webhook' }
lsq webhooks:delete --id 777

# Subscriptions
lsq subscriptions:list --store 123
lsq subscription:cancel --id 555
lsq subscription:invoices --subscription 555

# License keys
lsq license-keys:list --variant 67
lsq license-keys:instances --license 222
lsq license-keys:update --id 222 --status active --activation-limit 5
License key updated: { id: '222', status: 'active', activation_limit: 5 }

# License API
lsq license:activate --key XXXX-YYYY --instance my-device
lsq license:validate --key XXXX-YYYY --instance-id abc
lsq license:deactivate --key XXXX-YYYY --instance-id abc

# Usage records
lsq usage:list --subscription 555
lsq usage:create --subscriptionItem 444 --quantity 10 --event api_calls
Usage recorded: { id: '999', quantity: 10 }

# Get raw resources
lsq get:product --id 45
{
  "data": { "id": "45", "attributes": { "name": "Starter Plan", "...": "..." } }
}
lsq get:order --id 888

# Invoice / refund
lsq order:invoice --id 888
Invoice URL: https://checkout.lemonsqueezy.com/invoice/abc
lsq order:refund --id 888 --amount 500
Refund issued: { id: 'refund_1', status: 'processed' }

Full list and flags: see docs/lsq-mini-cli.md or run lsq --help.

Project structure

scripts/
├── lsq.mjs              # Entry point and command dispatcher
└── lib/
    ├── config.mjs       # Configuration management (load/save, env vars)
    ├── utils.mjs        # Shared utilities (parseArgs, printTable, etc.)
    ├── registry.mjs     # Command registry and help text
    └── handlers/        # Command handlers organized by domain
        ├── config.mjs
        ├── resources.mjs    # stores, products, orders, customers, etc.
        ├── checkout.mjs
        ├── discounts.mjs
        ├── license.mjs      # license + license-keys
        ├── webhooks.mjs
        ├── subscriptions.mjs
        ├── orders.mjs       # invoice, refund
        ├── usage.mjs
        └── get.mjs

Contributing

  1. Fork the repo and create a feature branch.
  2. Add new commands under scripts/lib/handlers/ (one file per domain).
  3. Register them in scripts/lib/registry.mjs so the dispatcher knows about them.
  4. Update docs/lsq-mini-cli.md with any new command/flags.
  5. Test locally: npm run lsq -- <command> (or lsq <command> if installed globally).
  6. Open a PR.

Uninstall / clean-up

npm uninstall -g lsq-mini-cli   # if installed globally
rm ~/.lsq-mini-cli.json         # remove saved config (optional)

License

MIT