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

@ipgeotrace/browser

v0.1.0

Published

Browser IPGeoTrace client. Resolve the current visitor's location with a publishable key.

Downloads

184

Readme

@ipgeotrace/browser

The browser IPGeoTrace client. Answers one question — where is the person looking at this page? — via GET /resolve/me, which sees the browser's real connection IP.

Sign up and grab your publishable key at ipgeotrace.com.

Use it to personalize on the client: auto-select the visitor's country, price in their local currency, prefill a phone code, default a timezone or language.

Framework-agnostic: React, Vue, Svelte, and vanilla all use it the same way. The optional reactive wrappers (@ipgeotrace/react, etc.) are thin sugar on top; you don't need them.

Install

npm add @ipgeotrace/browser

Usage

import { createBrowserClient } from '@ipgeotrace/browser';

const client = createBrowserClient({ publishableKey: 'pk_live_...' });

const result = await client.me();
if (result.ok) {
  console.log(result.value.country?.name, result.value.location?.timeZone);
}

That's it — me() calls the API directly from the browser. It's async because it makes a network request; await it and check result.ok.

The key is a publishable key

You put this key in your client-side code on purpose. A publishable key is safe to expose because it is restricted: domain-locked to your site, scoped to resolve / me only (no batch, no account access), and rate-limited. This is the same model as a Google Maps browser key. Never ship your secret server key (@ipgeotrace/client) to the browser — that one can run batch lookups and spend your whole quota.

Publishable keys are a planned API feature (domain allowlist + resolve-only scope). Until they ship, treat this package as targeting that model. See ../../API-CONTRACT.md.

Options

createBrowserClient({
  publishableKey: 'pk_live_...',  // required
  baseUrl: undefined,             // override the API host (staging / self-hosted)
  timeoutMs: 10_000,
  fetch: globalThis.fetch,
});

me() is always a live call — it is never cached. The caller's IP can change at any time (VPN, Wi-Fi ↔ cellular, moving networks) and the browser never knows its own IP, so there is nothing safe to key a cache on. Every me() reflects the visitor's location right now. It returns the same Result<GeoResponse> shape as @ipgeotrace/client.

React, in ~30 lines (no extra package needed)

function useVisitorGeo() {
  const [state, setState] = useState<GeoResponse | null>(null);
  useEffect(() => {
    const client = createBrowserClient({ publishableKey: 'pk_live_...' });
    const controller = new AbortController();
    client.me(controller.signal).then((r) => r.ok && setState(r.value));
    return () => controller.abort();
  }, []);
  return state;
}