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

@colixsystems/link-preview-client

v0.1.0

Published

Scoped client for the AppStudio link-preview API. Used by widgets through the injected WidgetContext.linkPreviews.

Readme

@colixsystems/link-preview-client

Scoped client for the AppStudio link-preview API. It is a sibling of @colixsystems/translation-client, @colixsystems/agents-client and the other domain clients: a standalone fetch-based client you instantiate with createLinkPreviewClient({ baseUrl, getToken, getTenantId }).

Two surfaces, one package. This client serves two callers:

  1. External / server-side integrations instantiate it directly and call get below.
  2. The widget runtime — the Player and the exported Expo app instantiate the same package and inject it into WidgetContext.linkPreviews. Widgets never import this package; they call the SDK hook useLinkPreview(url) from @colixsystems/widget-sdk. Both surfaces speak the identical snake_case REST contract.

What it does

Given an http: or https: URL, the AppStudio backend fetches the page and returns its title, description, site name and preview image. The fetch happens on the server, so the device showing the link never contacts the linked site, and the image is served through a signed AppStudio proxy URL.

A page that cannot be previewed (unreachable, not HTML, too slow, or not allowed) is not an error: the call resolves with every field except url set to null. Render the plain link in that case.

Status

v0.1.0 — pre-publish. Not yet published to npm.

Wire format — snake_case, no transform

The response is returned snake_case verbatim: { url, title, description, site_name, image_url }. The only caller-facing camelCase is the method name (get) and the factory option names.

image_url arrives from the server as a server-relative path. The client prefixes it with the origin of baseUrl, so it loads in a native app, which has no page origin to resolve it against. With a relative baseUrl (a same-origin web app) it stays relative. The URL carries its own signed token, so load it directly in an <Image>; it needs no auth headers.

Public API

import {
  createLinkPreviewClient,
  LinkPreviewError,
} from "@colixsystems/link-preview-client";

const client = createLinkPreviewClient({
  baseUrl: "https://api.appstudio.io/api/v1",
  getToken: () => "Bearer ...",
  getTenantId: () => "tenant_abc",
  // Optional: per-request extra headers. Called with
  // { namespace: "link-previews", operation: "get" } and merged in.
  getRequestHeaders: ({ namespace, operation }) => ({}),
  // fetchImpl defaults to globalThis.fetch; timeoutMs defaults to 15 000.
});

const preview = await client.get("https://example.com/article");
// → { url: "https://example.com/article", title: "…", description: "…",
//     site_name: "Example", image_url: "https://api.appstudio.io/api/v1/link-previews/image?token=…" }

The request is GET {baseUrl}/link-previews?url=<encoded url> with Authorization: Bearer <token> and x-tenant-id. Any signed-in principal may call it; an anonymous caller gets AUTH_REQUIRED.

Errors

Every failure is a LinkPreviewError with a stable code, the HTTP status (0 when there was no response) and the error body as details.

| code | Status | When | | ------ | ------ | ---- | | VALIDATION | 400 | The URL is missing, malformed, not http(s), or too long | | AUTH_REQUIRED | 401 | No signed-in principal | | RATE_LIMITED | 429 | Too many previews requested; retryAfter holds the server's hint in seconds | | NETWORK | 0 | No HTTP answer: offline, DNS failure, or the 15 s timeout | | INTERNAL | other | Anything else, including 5xx |

A NETWORK failure or a 5xx is retried twice (after 250 ms and 750 ms); the request is a GET, so a repeat is harmless. A 4xx or 429 is never retried.

License

MIT