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

@velopeplabs/ship

v0.4.0

Published

Typed TypeScript client for the VeloShip shipping API: FedEx, USPS and UPS rates, labels and tracking, with idempotent purchases, retries and webhook verification.

Readme

@velopeplabs/ship

Typed client for the shipping API. It has no dependencies and runs anywhere fetch does: Node, Bun, Cloudflare Workers, Convex and browsers.

import { VeloShipClient } from "@velopeplabs/ship";

const shipping = new VeloShipClient({
  apiKey: process.env.VELOSHIP_API_KEY!, // sk_test_… in development, sk_live_… in production
});

Common calls

// Prices at checkout. Nothing is stored.
const { rates } = await shipping.rates.quote({
  to_address: { street1: "1 Market St", city: "San Francisco", state: "CA", zip: "94105" },
  parcel: { preset: "small_box", weight: 24 },
  sort: "fastest", // or "cheapest", or "best_value" (the default)
  descriptive: true, // adds a plain-English description of each service
});

// Create and buy in one call. from_address comes from settings.
const shipment = await shipping.shipments.create({
  to_address: { name: "Jane Doe", phone: "4155551234", street1: "1 Market St", city: "San Francisco", state: "CA", zip: "94105" },
  parcel: { preset: "small_box", weight: 24 },
  service: "FEDEX_GROUND",
  reference: order.id,
});

const { contentType, data } = await shipping.shipments.label(shipment.id);
const tracker = await shipping.trackers.retrieve(shipment.tracker_id!);
await shipping.shipments.refund(shipment.id); // void before it ships

for await (const s of shipping.shipments.listAll({ status: "purchased" })) console.log(s.tracking_code);

Test-mode scenarios

With a sk_test_ key, make the mock carriers misbehave to exercise failure handling. Live mode ignores it.

const shipping = new VeloShipClient({ apiKey: "sk_test_…", scenario: "carrier_down" }); // every call
await shipping.shipments.buy(id, { service: "FEDEX_GROUND" }, { scenario: "purchase_timeout" }); // one call

Errors

import { VeloShipError } from "@velopeplabs/ship";

try {
  await shipping.shipments.create({ ...order, service: "FEDEX_2_DAY" });
} catch (err) {
  if (err instanceof VeloShipError) {
    err.status;     // 422
    err.code;       // "CARRIER.ERROR", "SHIPMENT.RATES.EXPIRED", …
    err.details;    // FedEx's error list, validation issues, …
    err.shipmentId; // set when the shipment was created but the purchase failed
    err.requestId;  // quote it when reporting a problem
  }
}

What the client handles for you

  • Idempotency: every POST carries an Idempotency-Key, and the same key is reused on retries. Pass { idempotencyKey } to tie it to your own order ID.
  • Retries: network errors, 429, 502, 503 and 504 are retried twice by default (maxRetries), honoring Retry-After. An unconfirmed purchase (SHIPMENT.PURCHASE_UNKNOWN) is never retried, because reconciliation handles it.
  • Read-your-writes: the client echoes x-d1-bookmark, so a retrieve right after a create sees the new shipment even when served by a database replica.

Webhooks

import { constructWebhookEvent } from "@velopeplabs/ship";

const event = await constructWebhookEvent(process.env.VELOSHIP_WEBHOOK_SECRET!, req.headers.get("x-webhook-signature"), await req.text());
if (event.type === "tracker.updated") event.data.status; // typed as Tracker

Verify against the raw body, before any JSON parsing. Signatures older than 5 minutes are rejected.

Test mode

Use an sk_test_… key, created with POST /v1/api_keys and {"mode":"test"}, for development and CI. Test mode has its own data and never calls FedEx. The root key can opt in with new VeloShipClient({ ..., mode: "test" }).

The full API reference is in docs/api.md.