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

@geophrase/core

v1.5.1

Published

Drop-in address picker widget for Indian e-commerce checkouts. Captures structured addresses with coordinates to reduce RTO.

Readme

@geophrase/core

The core vanilla JavaScript library for Geophrase Connect. Drop the Geophrase address selector into any web checkout in minutes and capture perfectly structured Indian addresses and coordinates to reduce Return to Origin (RTO) costs.

👉 Full documentation and integration guide

Building a React or Next.js app? Use @geophrase/react instead. It wraps this core library in native hooks.


Install

The fastest path is to include the hosted script directly. No build step, no bundler:

<script src="https://connect.geophrase.com/v1/geophrase.js"></script>

Or install from npm:

npm install @geophrase/core
import Geophrase from '@geophrase/core';

Quick Start

The snippet below uses mode: 'server' so you can paste it into an HTML file and see the widget without creating an API key first.

<button id="geophrase-btn">Select Delivery Address</button>

<script>
    document.addEventListener('DOMContentLoaded', function () {
        const geo = new Geophrase({
            mode: 'server',             // widget returns a token your backend exchanges for the address
            theme: 'system',            // 'light' | 'dark' | 'system'
            orderId: 'ORD-98765',       // your internal reference id
            phone: '9999999999',        // pre-fill the customer phone

            onSuccess: (result) => console.log('Success:', result),
            onError:   (error)  => console.error('Error:', error.message),
            onClose:   ()       => console.log('User dismissed the widget.')
        });

        document.getElementById('geophrase-btn').onclick = () => geo.open();
    });
</script>

Server vs Client Mode

The SDK supports two modes. Pick whichever fits your architecture:

  • server: the widget returns { token }. Your backend exchanges it for the full address using your API key, which never touches the frontend.

  • client: the widget resolves the address in the browser and passes it straight to onSuccess. Requires key in the SDK options.

    Both modes require a Geophrase API key. See creating and securing an API key.

    If your app has a backend, server mode keeps your API key entirely off the frontend, which is the most secure option. If you don't have a backend (or want the fastest possible integration), client mode with a domain-restricted key is fine.

// client mode, no backend integration required
const geo = new Geophrase({
    mode: 'client',
    key: 'YOUR_API_KEY',
    onSuccess: (address) => console.log('Address:', address)
});

Configuration Options

| Parameter | Type | Required | Description | | :---------- | :--------- | :-------------- | :----------------------------------------------------------- | | mode | string | Optional | 'client' (default) or 'server'. Determines the architectural flow of the SDK. | | key | string | Conditional | Your Geophrase API key. Required if mode is 'client'. Omit if using server mode. | | theme | string | Optional | 'light', 'dark', or 'system'. Defaults to 'system'. | | orderId | string | Optional | Your internal reference ID for this checkout session. | | phone | string | Optional | The customer's 10-digit phone number (pre-fills the widget). | | onSuccess | function | Yes | Called upon completion. Returns an Address object (mode: 'client') or a Token object (mode: 'server'). | | onError | function | Optional | Called if the API fails or a network error occurs. Returns an Error object. | | onClose | function | Optional | Called when the user closes the modal without completing the flow. |

API

| Method | Description | | :----------------------- | :----------------------------------------------------------- | | new Geophrase(options) | Create an instance. Pre-computes the widget URL; safe to construct at module scope. | | .open() | Open the modal. Idempotent. | | .close() | Close the modal without firing onSuccess. |

The underlying Geophrase instance is created on mount and destroyed on unmount automatically, so you do not need to call destroy() manually.

TypeScript definitions (GeophraseOptions, GeophraseAddress, GeophraseRequestId, GeophraseError) ship with the package.

See the full docs for the complete configuration reference, security guidance, and response schemas.