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

@lix-url/sdk

v0.1.1

Published

Official JavaScript SDK for the Lix.li API.

Readme

Lix.li JavaScript SDK

Official JavaScript SDK for the Lix.li URL shortening and link analytics API.

Requirements

  • Node.js 14+

Installation

npm install @lix-url/sdk

Quick Start

const { Client } = require('@lix-url/sdk');

const client = new Client('your_api_key');

const result = await client.links().create('https://example.com');
console.log(result.link.shortUrl); // https://lix.li/xxxxx

Links

Create a short link

const result = await client.links().create('https://example.com');
console.log(result.link.shortUrl);
console.log(result.usage.remaining);

Create a link with a custom alias

const result = await client.links().create(
  'https://example.com',
  'my-link', // alias
);
console.log(result.link.shortUrl); // https://lix.li/my-link

Create a link with all options

const result = await client.links().create(
  'https://example.com',                // url
  'my-alias',                           // alias
  'My Page Title',                      // title
  42,                                   // groupId
  ['sale', 'promo'],                    // tags
  { title: 'Sale!', description: '...' }, // meta
  { utm_source: 'google', utm_medium: 'email', utm_campaign: 'summer' }, // utm
  [1001, 1002],                         // trackingPixelIds
  '2029-12-31T23:59:59+00:00',         // activeBeforeDatetime
  'secret123',                          // password
  true,                                 // isPublic
);

Update a link

const result = await client.links().update(
  79697,              // id
  null,               // url (unchanged)
  'New Title',        // title
);
console.log(result.link.title);

Get a link by ID

const link = await client.links().get(79697);
console.log(link.shortUrl);
console.log(link.url);
console.log(link.group?.name);

List links

const response = await client.links().list();
// With pagination:
const page = await client.links().list(20, 79500); // limit, fromId

for (const link of response.links) {
  console.log(link.shortUrl, link.url);
}
console.log(response.meta.total);
console.log(response.meta.nextUrl);

Delete a link

await client.links().delete(79697);

Groups

Create a group

const group = await client.groups().create('Marketing');
// With options:
const group2 = await client.groups().create(
  'Landing Pages',
  'Rotating landing pages', // description
  true,                     // isRotate
);

Update a group

const group = await client.groups().update(
  10,                      // groupId
  null,                    // name (unchanged)
  'Updated description',   // description
  false,                   // isRotate
);

Get a group by ID

const group = await client.groups().get(10);
console.log(group.name);
console.log(group.alias);
console.log(group.url);

List groups

const response = await client.groups().list();
// With pagination:
const page = await client.groups().list(10, 1000); // limit, fromId

for (const group of response.groups) {
  console.log(group.name);
}
console.log(response.meta.total);

Delete a group

await client.groups().delete(10);

Profile

const profile = await client.profile().me();

console.log(profile.client.name);
console.log(profile.user.email);
console.log(profile.plan.name);
console.log(profile.usages.apiLinks.remaining);
console.log(profile.usages.links.used);
console.log(profile.usages.massLinks.limit);

Error Handling

const {
  ValidationException,
  UnauthorizedException,
  NotFoundException,
  RateLimitException,
  ServerException,
} = require('@lix-url/sdk');

try {
  const result = await client.links().create('https://example.com');
} catch (e) {
  if (e instanceof ValidationException) {
    console.error('Validation errors:', e.data);
  } else if (e instanceof UnauthorizedException) {
    console.error('Invalid API key');
  } else if (e instanceof NotFoundException) {
    console.error('Resource not found');
  } else if (e instanceof RateLimitException) {
    console.error('Rate limit exceeded');
  } else if (e instanceof ServerException) {
    console.error('Server error');
  } else {
    throw e;
  }
}

Meta Fields

Use the MetaEnum constants when building meta objects:

const { MetaEnum } = require('@lix-url/sdk');

const meta = {
  [MetaEnum.META_TITLE]: 'Page Title',
  [MetaEnum.META_OG_TITLE]: 'OG Title',
  [MetaEnum.META_DESCRIPTION]: 'Description',
  [MetaEnum.META_OG_DESCRIPTION]: 'OG Description',
  [MetaEnum.META_OG_IMAGE]: 'https://example.com/image.png',
  [MetaEnum.META_KEYWORDS]: 'sale, promo',
};

Running Tests

npm install
npm test

Project Structure

src/
  Client.js              — main entry point
  http/
    ApiClient.js         — fetch-based HTTP wrapper
  resources/
    Links.js             — links resource
    Groups.js            — groups resource
    Profile.js           — profile resource
  dto/
    index.js             — all Data Transfer Object classes
  exceptions/
    index.js             — typed exception classes
tests/                   — Jest test suite

Documentation

  • API Documentation: https://lix.li/api
  • OpenAPI Specification: https://github.com/lix-url/openapi

Other SDKs

  • PHP SDK: https://github.com/lix-url/php-sdk
  • Go SDK: https://github.com/lix-url/go-sdk
  • Python SDK: https://github.com/lix-url/python-sdk

Support

Need help with the API or SDK?

  • Support Center: https://lix.li/support

License

MIT