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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pinelab/vendure-plugin-address-lookup

v1.2.2

Published

Vendure plugin for searching, validating and autofilling address details in checkouts

Readme

Vendure Address Lookup

Official documentation here

This Vendure plugin allows you to lookup addresses based on postalcode, housenumber and/or streetname.

Getting started

    import { AddressLookupPlugin } from '@pinelab/vendure-plugin-address-lookup';

// In your vendure-config.ts
    plugins: [
      AddressLookupPlugin.init({
        lookupStrategies: [

          // You can register for the Post NL API to do NL and BE lookups
          new PostNLLookupStrategy({
            apiKey: process.env.POSTNL_APIKEY!,
          }),
                new GooglePlacesLookupStrategy({
        supportedCountryCodes: ['DE'], // You can use the Google Places API for any country, but you need to register for an API key at https://developers.google.com/maps/documentation/places/web-service/get-api-key
        apiKey: process.env.GOOGLE_PLACES_APIKEY!,
      })

          // If you want to use the free Postcode.tech, get an API key at https://postcode.tech/ and uncomment the lines below
          // new PostcodeTechStrategy({
          //   apiKey: process.env.POSTCODE_TECH_APIKEY!,
          // }),
        ],
      }),
      DefaultSearchPlugin,
      AdminUiPlugin.init({
        port: 3002,
        route: 'admin',
      }),
    ],

Storefront usage

In your storefront, you can use the lookupAddress mutation to look up an address. You need an active order to be able to access this query!

# NL lookups with postal code and house number will always give 1 result
query {
  lookupAddress(
    input: { countryCode: "NL", postalCode: "8911 DM", houseNumber: "3" }
  ) {
    streetLine1
    streetLine2
    postalCode
    city
    province
    country
    countryCode
  }
}

# BE lookups with only a postal code and a house number will give multiple results
query {
  lookupAddress(
    input: { countryCode: "BE", postalCode: "9052", houseNumber: "110" }
  ) {
    streetLine1
    streetLine2
    postalCode
    city
    country
    countryCode
  }
}

# To get a single result, you need to also pass streetname
query {
  lookupAddress(
    input: {
      countryCode: "BE"
      postalCode: "9052"
      houseNumber: "110"
      streetName: "Rijvisschepark"
    }
  ) {
    streetLine1
    streetLine2
    postalCode
    city
    country
    countryCode
  }
}

Google Places Strategy

If you want to use the Google Places API, you can do so by registering the GooglePlacesLookupStrategy in your config:

import { GooglePlacesLookupStrategy } from '@pinelab/vendure-plugin-address-lookup';

plugins: [
  AddressLookupPlugin.init({
    lookupStrategies: [
      new GooglePlacesLookupStrategy({
        supportedCountryCodes: ['DE'],
        apiKey: process.env.GOOGLE_PLACES_APIKEY!,
      }),
    ],
  }),
],

The Google places API requires you to input the housenumber and streetname. It will mostly give you a single result, even when multiple results can exists. If that happens, you can pass the postalcode to get a specific result.

# This example will give you 1 result: the Parkstraße 4 in Osnabrück
{
  lookupAddress(
    input: { countryCode: "DE", streetName: "Parkstraße", houseNumber: "4" }
  ) {
    streetLine1
    streetLine2
    city
    province
    postalCode
    country
    countryCode
  }
}
# This example will give you another single result: the Parkstraße 4 in Löningen
{
  lookupAddress(
    input: {
      countryCode: "DE"
      streetName: "Parkstraße"
      houseNumber: "4"
      postalCode: "49624"
    }
  ) {
    streetLine1
    streetLine2
    city
    province
    postalCode
    country
    countryCode
  }
}

Custom lookup strategies

If you want to implement your own strategy, for example to support more countries, or use different API's, you can do so by implementing the LookupStrategy interface:

import { AddressLookupStrategy } from '@pinelab/vendure-plugin-address-lookup';

export class GermanPostcodeStrategy implements AddressLookupStrategy {
  readonly supportedCountryCodes = ['DE'];

  constructor(private readonly input: PostcodeTechStrategyInput) {}

  validateInput?(input: AddressLookupInput): true | string {
    // Optionally validate the input given by the client
  }

  async lookup(
    ctx: RequestContext,
    input: AddressLookupInput
  ): Promise<OrderAddress[]> {
    // Fetch the address from your own API, and map the results to OrderAddress
  }
}