Sign up Log in
n/open-source · 18d ago · 245 views
u/ASCLLSilver
n/open-sourceu/ASCLL · 18d ago

[Self-hosted] Address: a real address generator for 27 countries and regions, the whole stack up with one compose file

Anyone building cross-border sites, doing indie dev, or integrating payments has probably hit the same wall: you're testing an order, running through checkout, validating address formats — where do the addresses come from?

Throw together a "123 Main St" and validation fails. Grab some random fake address generator, and when you look it up the address doesn't exist — then you're demoing shipping to a client and they point out on the spot that "this address doesn't show up on a map."

Recently I came across a pretty solid open source project, Address — a self-hosted real address generator covering 27 countries and regions. One compose file brings the whole thing up. Sharing it here.

How it differs from the usual address generators

In one sentence: it returns addresses that actually exist, not randomly assembled strings.

Every record comes from official address registries, OpenStreetMap, Overture, or validated geocoding results, and carries source, precision, and lat/long. Missing fields are left empty rather than made up.

That matters more than it sounds. A lot of generators, in order to make results "look complete," cram house numbers and postcodes onto streets that don't exist — then the moment you drop it into Google Maps, it falls apart.

A few things I care about

27 countries and regions, filtered by real administrative divisions

North America (US/CA/MX), Europe (UK/DE/FR/IT/ES/NL/RU), East Asia (CN/HK/TW/JP/KR), Southeast Asia (SG/MY/TH/PH/VN), South Asia (India), Oceania (Australia), Middle East (TR/SA), South America (Brazil), Africa (Nigeria/South Africa).

Filtering follows each country's real province/city/district/postcode hierarchy. What's interesting: when a filter combination has no data, it errors out instead of quietly swapping in some other region. I approve of that design.

Traceable sources

The China dataset goes down to residential complexes; other regions go to house-number or street level, all tagged with precision and evidence of "whether it's residential." You don't have to guess whether an address is trustworthy.

Ten display languages

Original, English, Simplified Chinese, Traditional Chinese, Japanese, Korean, German, French, Spanish, Portuguese.

One-command deploy

A single Docker Compose file brings up the app, PostgreSQL, database migrations, and the sync service. Internal secrets are generated and persisted automatically — no manually configuring a pile of stuff.

Deployment

Requirements: Linux (AMD64 or ARM64), Docker Engine 24+, 4GB RAM (8GB+ recommended for the first import of large countries).

mkdir address && cd address
curl -fsSLo docker-compose.yml https://raw.githubusercontent.com/daimon3332/address/main/docker-compose.yml
docker compose up -d
docker compose ps
curl -fsS http://127.0.0.1:8787/api/v1/ready

On first start it creates the data/ and runtime/ directories, generates the database password and config encryption key, runs migrations, then brings up the API and sync service.

Once it's up, open http://127.0.0.1:8787/admin/ in your browser. The initial password is admin — change it when prompted after logging in, then go to API Tokens and create a token.

API calls

curl -fsS "http://127.0.0.1:8787/api/v1/generate?country=US&city=Seattle" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

The response looks roughly like this:

{
  "data": {
    "country": "US",
    "filters": { "city": "Seattle" },
    "filterMatchLevel": "exact",
    "result": {
      "address": {
        "formattedAddress": "4019 Aikins Avenue Southwest, Seattle, WA, 98116",
        "matchLevel": "premise",
        "propertyType": "residential",
        "coordinates": { "latitude": 47.567944, "longitude": -122.40706 }
      }
    }
  }
}

matchLevel is the precision (street / premise / subpremise), and propertyType is only residential when there's evidence of a standalone residence. It supports single generation, batch generation, place search, coverage queries, and address translation, with OpenAPI 3.1 docs.

A few gotchas to watch out for

  • The API only listens on 127.0.0.1:8787 by default. To expose it, put it behind an HTTPS reverse proxy and drop a .env next to the Compose file: ALLOWED_ORIGINS / TRUST_PROXY=true / COOKIE_SECURE=true
  • It runs without any third-party keys, using keyless open data sources. China map platforms, Google Geocoding, and translation services are only for extending data or enabling online translation — add them under Map Keys in the admin panel
  • The first import of big countries like the US, China, and India is fairly memory-hungry; 4GB is the floor, not a comfortable number
  • MIT licensed, but the upstream datasets each have their own license and attribution requirements — worth a look at docs/data-sources.md before commercial use

Who it's for

  • Cross-border / indie developers: testing forms, testing checkout, testing address format validation
  • Logistics and e-commerce demos: needs to be clickable on a map and look real
  • Address format research: batch-comparing address structure differences across countries
  • Privacy-conscious folks: self-hosted, data never leaves your own machine

Finally

What I like about this project is its restraint: better to leave a field empty than invent a plausible-looking fake value. In an era where everything is constantly "completing" things for you, that kind of honesty is actually rare.

Happy to chat in the replies if anyone runs into deployment issues.

Translated by AI from 简体中文

4
8
Log into join the discussion.
海外原生IP VPS,稳定访问全球网络

还在为IP不纯、平台风控、频繁验证而烦恼? 丽萨主机海外原生IP VPS,双ISP住宅IP,覆盖美国、香港、日本、新加坡、台湾、德国、越南、英国等热门地区,适合跨境电商、社媒运营、AI工具、流媒体及海外业务使用。

lisahost.com Learn more

8 replies

Sort order
  1. keale 🎧 Diamond 3 YEARS 18d ago

    Thanks, bookmarking this for later.

    Translated by AI from 简体中文

    2
  2. leohost 🦁 Silver 18d ago

    Bumping this for the boss

    Translated by AI from 简体中文

    1
  3. ASCLL Silver OP 18d ago

    Thanks boss, I just want to level up.

    Translated by AI from 简体中文

    0
  4. azhaoyihao Glory Post King 18d ago

    Thanks for the recommendation, boss.

    Translated by AI from 简体中文

    1
  5. James 💯 Legend MANAGER 18d ago

    Nice, this is a good one. Saves me the trouble of hunting for it myself.

    Translated by AI from 简体中文

    1
  6. Jhgui Silver 18d ago

    You're a legend, boss.

    Translated by AI from 简体中文

    1
  7. iop Gold 18d ago

    Nice, saving this for later

    Translated by AI from 简体中文

    0
  8. zhanchi Silver 3 YEARS 18d ago

    I'll bookmark the URL first so I have it handy

    Translated by AI from 简体中文

    0