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

addressfield-ts

v0.1.1

Published

Generated postal address metadata and Effect schemas.

Readme

addressfield-ts

Address form metadata and Effect validation schemas for 252 countries and territories, based on Google libaddressinput data. Use your own UI components and labels.

Try the playground

Install

pnpm add addressfield-ts

For validation, also install [email protected]. Forms do not require Effect.

Build a form

import { getAddressForm } from "addressfield-ts/forms/CA";

const form = getAddressForm({ administrativeArea: "QC" }, { addressLanguage: "fr-CA" });
  • form.fields: field names, label types, required flags, controls (text, lines, select), autocomplete hints, values, region options, and dependencies.
  • form.rows: fields grouped in country-specific display order.

Provide your own field labels and country selector. Store street lines as an addressLines array. Pass updated values to getAddressForm to update dependent region options.

addressLanguage selects region labels and native or Latin field order. It does not translate your UI. Region values stay stable: Quebec uses QC with either the Quebec or Québec label.

To load a country on demand:

import { loadAddressForm } from "addressfield-ts/forms";

const { getAddressForm } = await loadAddressForm("DE");

The same entry exports countryCodes for the supported countries.

Validate an address

import { Schema } from "effect";
import { DEAddressSchema } from "addressfield-ts/schemas/DE";
import { USAddressSchema } from "addressfield-ts/schemas/US";

const AddressSchema = Schema.Union([DEAddressSchema, USAddressSchema]);

const result = Schema.decodeUnknownResult(AddressSchema)({
  countryCode: "DE",
  addressLines: ["Invalidenstraße 116"],
  postalCode: "10115",
  locality: "Berlin",
});

Schemas check country codes, required fields, postal-code formats, known regions, and regional postal-code prefixes. Use loadAddressSchema from addressfield-ts/schemas to load a schema on demand.

For custom error messages, use Effect's SchemaIssue formatters. Address checks provide an addressIssue annotation with InvalidPostalCode, UnknownRegion, or PostalCodeRegionMismatch data.

Validation does not confirm that an address exists or that mail can be delivered. Regional checks depend on the available Google data. Input values are not trimmed, uppercased, or translated.

License

Code: MIT. Google libaddressinput metadata: CC BY 4.0, with attribution included in the package.