Skip to content

About

Address parser template for Node.js and Express: split a US address into street, city, state and ZIP. Deploy to Vercel in one click.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Street Address Parser | APIVerve Template

License: MIT Node.js Express APIVerve | Street Address Parser

Turn a one-line US address into clean fields. Paste an address and get the street number, street name, type, direction, city, state and ZIP, ready for a form or a database.

Deploy with Vercel

Street Address Parser splitting a Washington, DC address into fields


Get your free API key

This template needs an APIVerve API key. Sign up free, no credit card required.


Deploy in one click

Click Deploy with Vercel above. Vercel copies this repo to your GitHub account, asks for your APIVERVE_API_KEY, and gives you a live URL about a minute later.

Run it locally

  1. Clone the repository

    git clone https://github.com/apiverve/address-parser-node-tutorial.git
    cd address-parser-node-tutorial
  2. Install dependencies

    npm install
  3. Add your API key

    cp .env.example .env

    Then open .env and set APIVERVE_API_KEY.

  4. Start the server

    npm run dev
  5. Open http://localhost:3000

How it works

  1. The page in public/index.html calls GET /api/parse?address= on this server.
  2. server.js checks the input, then calls Street Address Parser. Your API key stays on the server and never reaches the browser.
  3. The page shows the result.
├── server.js            # Express: the /api route that calls APIVerve
├── public/index.html    # The page (HTML, CSS and JavaScript)
├── .env.example         # Copy to .env and add your key
└── package.json

The API call

const res = await fetch(
  `https://api.apiverve.com/v1/streetaddressparser?address=${encodeURIComponent(address)}`,
  { headers: { 'x-api-key': process.env.APIVERVE_API_KEY } }
);
const { data } = await res.json();
// data.parsed.streetNumber, streetAddress, streetType, cityName, stateName, zipCode

Before you share your URL

Once deployed, anyone who finds your URL can use it on your API key. Each visitor can make 10 requests a minute, which is fine for a demo. The limit is kept in memory, so it isn't shared between serverless instances. For production:

  • Put the page behind your own sign-in, or
  • Move the limit to a shared store such as Upstash Redis, or
  • Call the route only from your own backend.

Ideas to extend it

  • Let people paste a whole address, then fill in your checkout fields for them
  • Clean up a CSV of addresses before importing it
  • Add ZIP Codes Lookup to check the ZIP matches the city

API reference

Tech stack

  • Node.js 20+ and Express 4
  • Plain HTML, CSS and JavaScript, no build step
  • Deploys to Vercel as-is: server.js becomes one function and public/ is served from the CDN

License

MIT. See LICENSE.

About

Address parser template for Node.js and Express: split a US address into street, city, state and ZIP. Deploy to Vercel in one click.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages