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

@jhb.software/payload-geocoding-plugin

v0.2.1

Published

Geocoding field plugin for Payload CMS

Downloads

106

Readme

JHB Software - Payload Geocoding Plugin

NPM Version

A geocoding plugin for Payload CMS that simplifies location management in your content. This plugin allows you to easily populate coordinates in a Payload Point Field by entering an address through an autocomplete interface powered by the Google Places API.

Screenshot showing the added autocomplete select field

Setup

Installation

Add the plugin to your payload config with your Google Maps API key:

plugins: [
  payloadGeocodingPlugin({
    googleMapsApiKey: process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY!,
  })
]

Google Maps API Key

To use this plugin, you'll need a Google Maps API key. To get one, follow these steps:

  1. Set up a Google Cloud account and create a project
  2. Enable the Maps JavaScript API in your Google Cloud project
  3. Create an API key with Maps JavaScript API, Places API and Geocoding API access
  4. Pass the API key to the plugin configuration (as shown above).

Note: Since this API key is exposed to the frontend (Payload Admin panel), it is strongly recommended to restrict its usage by setting up domain restrictions and only enabling the Maps JavaScript API, Places API, and Geocoding API in the Google Cloud Console under API Keys & Credentials

Usage

To add geocoding functionality to a point field, you can simply wrap the point field with the geocodingField function:

geocodingField({
  pointField: {
    name: 'location',
    type: 'point',
  },
})

This will add a location_googlePlacesData JSON field to the collection. This field will store the raw geocoding data from the Google Places API.

If needed you can adjust the location_googlePlacesData field name by passing a name property to the geocodingField function.

geocodingField({
  pointField: {
    name: 'location',
    type: 'point',
  },
  geoDataFieldOverride: {
    label: 'JSON Geodata Field',
    access: {
      read: () => true,
      update: () => true,
      create: () => true,
    },
    admin: {
      readOnly: false,
      description: 'This field stores the geocoding data from the Google Places API.',
    },
  },
}),

About this plugin

This plugin uses the react-google-places-autocomplete library to provide a Select/Search input for finding an address. The result of the Google Places API request is stored in a JSON field and the coordinates are stored in a Point Field.

Roadmap

⚠️ Warning: This plugin is actively evolving and may undergo significant changes. While it is functional, please thoroughly test before using in production environments.

  • Use the native Payload SelectField instead of the field provided by react-google-places-autocomplete
  • Extend the field config to accept GooglePlacesAutocomplete options like debounce time, API options, etc.
  • Add support for other geocoding services (Mapbox, HERE, etc.)

Have a suggestion for the plugin? Any feedback is welcome!

Contributing

We welcome contributions! Please open an issue to report bugs or suggest improvements, or submit a pull request with your changes.