shrtn-cli
v0.1.0
Published
CLI for shrtn.dev URL shortener - create short links, view analytics, manage URLs
Maintainers
Readme
shrtn-cli
Command-line interface for shrtn.dev URL shortener.
Installation
npm install -g shrtn-cliRequirements
- Node.js 18+
- shrtn.dev account (Standard or Premium plan)
- API key from https://shrtn.dev/dev/keys
Usage
Authentication
# First, create an API key at https://shrtn.dev/dev/keys
# Log in (requires username, password, AND API key)
shrtn login
# Check current user
shrtn whoami
# Log out
shrtn logoutURL Management
# Create a short link
shrtn shorten https://example.com/long-url
# Create with custom code
shrtn shorten https://example.com -c mycode
# List your links
shrtn list
shrtn list --page 2 --limit 20
# View analytics
shrtn analytics mycode
# Delete a link
shrtn delete mycode
shrtn delete mycode --force # Skip confirmationOutput Formats
# Human-readable tables (default)
shrtn list
# JSON output (for scripting)
shrtn list --json
shrtn analytics mycode --jsonCommands
| Command | Alias | Description |
|---------|-------|-------------|
| login | - | Log in and save API key |
| logout | - | Clear local credentials |
| whoami | - | Show current user info |
| shorten <url> | - | Create short link |
| list | ls | List your links |
| analytics <code> | stats | View link analytics |
| delete <code> | rm | Delete a link |
Configuration
Credentials are stored in:
- Windows:
%APPDATA%\shrtn-nodejs\Config\config.json - macOS:
~/Library/Preferences/shrtn-nodejs/config.json - Linux:
~/.config/shrtn-nodejs/config.json
API Key Scopes
When you log in, save an API key with full scope (read + write).
You can create read-only keys at https://shrtn.dev/dev/keys
License
MIT
