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:8787by default. To expose it, put it behind an HTTPS reverse proxy and drop a.envnext 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.mdbefore 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.
- Repo: https://github.com/daimon3332/address
- Online demo: https://address.333186.xyz
- Docker image:
daimon23/address
Happy to chat in the replies if anyone runs into deployment issues.
做跨境站、独立开发、接支付的朋友大概都踩过同一个坑:测试下单、跑 checkout、验证地址格式,地址从哪来?
随手编个 "123 Main St",校验过不了。随便找个假地址生成器,生成出来一查根本不存在,给客户演示物流时被当场指出「这地址地图上搜不到」。
最近翻到一个挺扎实的开源项目 Address,自托管的真实地址生成器,覆盖 27 个国家和地区,用了一条 compose 就把全套跑起来了,分享一下。
它和常见的地址生成器差在哪
一句话:它返回的是真实存在的地址,不是随机拼出来的字符串。
每条记录都来自官方地址登记册、OpenStreetMap、Overture 或者经过校验的地理编码结果,并且带来源、精度和经纬度。缺的字段就留空,不编。
这点其实挺关键。很多生成器为了让结果「看起来完整」,会给不存在的街道硬塞门牌号和邮编,结果一丢进 Google Maps 就露馅。
几个我比较在意的点
27 个国家地区,按真实行政区划过滤
北美(美/加/墨)、欧洲(英/德/法/意/西/荷/俄)、东亚(中/港/台/日/韩)、东南亚(新/马/泰/菲/越)、南亚(印度)、大洋洲(澳)、中东(土/沙)、南美(巴西)、非洲(尼日利亚/南非)。
筛选是按各国真实的省市区邮编层级走的。有意思的是:某个筛选组合没数据时它直接报错,而不是偷偷给你换成别的地区。这个设计我是认可的。
来源可追溯
中国区细到住宅小区,其他地区到门牌级或街道级,都标了精度和「是否住宅」的证据。用的时候不用猜这个地址靠不靠谱。
十种显示语言
原文、英语、简中、繁中、日、韩、德、法、西、葡。
一键部署
一个 Docker Compose 文件拉起应用、PostgreSQL、数据库迁移和同步服务,内部密钥自动生成并持久化,不用自己手动配一堆东西。
部署过程
要求:Linux(AMD64 或 ARM64)、Docker Engine 24+、4GB 内存(首次导入大国建议 8GB 以上)。
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
首次启动会自动建 data/ 和 runtime/ 目录、生成数据库密码和配置加密密钥、跑迁移,然后拉起 API 和同步服务。
起来之后浏览器开 http://127.0.0.1:8787/admin/,初始密码 admin,登录后按提示改密码,然后去 API Tokens 建个 token。
API 调用
curl -fsS "http://127.0.0.1:8787/api/v1/generate?country=US&city=Seattle" \
-H "Authorization: Bearer YOUR_API_TOKEN"
返回大概长这样:
{
"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 是精度(street / premise / subpremise),propertyType 只有存在独立住宅证据时才是 residential。支持单条生成、批量生成、地点搜索、覆盖率查询和地址翻译,带 OpenAPI 3.1 文档。
需要注意的几个坑
- API 默认只监听
127.0.0.1:8787。要对外就挂 HTTPS 反代,并在 Compose 旁边放一个.env:ALLOWED_ORIGINS/TRUST_PROXY=true/COOKIE_SECURE=true - 不配任何第三方 key 也能跑,走的是免授权的开放数据源。中国地图平台、Google Geocoding、翻译服务只是扩展数据或开启在线翻译,在后台 Map Keys 里加
- 首次导入美、中、印这类大国会比较吃内存,4GB 是下限不是舒适值
- MIT 协议,但上游数据集各有自己的许可和署名要求,商用前建议看一眼
docs/data-sources.md
适合谁
- 跨境 / 独立开发者:测表单、测 checkout、测地址格式校验
- 物流电商演示:要能在地图上点开、看着像真的
- 地址格式研究:批量对比各国地址结构差异
- 隐私敏感:自托管,数据不出自己的机器
最后
这个项目的品味在于克制:宁可字段空着,也不编一个看起来合理的假值。在一个到处都在「补全」的时代,这种老实反而稀缺。
- 项目地址:https://github.com/daimon3332/address
- 在线 Demo:https://address.333186.xyz
- Docker 镜像:
daimon23/address
有部署上的问题欢迎回帖交流。
Translated by AI from 简体中文Original (简体中文)
还在为IP不纯、平台风控、频繁验证而烦恼? 丽萨主机海外原生IP VPS,双ISP住宅IP,覆盖美国、香港、日本、新加坡、台湾、德国、越南、英国等热门地区,适合跨境电商、社媒运营、AI工具、流媒体及海外业务使用。
8 replies
Sort order