@bradleyhodges/addresskit 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +339 -0
- package/README.md +567 -0
- package/api/swagger-2.yaml +472 -0
- package/api/swagger.yaml +826 -0
- package/dist/api/swagger-2.yaml +472 -0
- package/dist/api/swagger.yaml +826 -0
- package/dist/cli.js +69272 -0
- package/package.json +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
<img src="https://exbluygwdjrpygxgzsdc.supabase.co/storage/v1/object/public/addresskit/AddressKit-Logo.png" height="64" alt="AddressKit" />
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
[](https://github.com/bradleyhodges/addresskit/blob/master/LICENSE) [](https://www.npmjs.com/package/@bradleyhodges/addresskit) [](https://www.npmjs.com/package/@bradleyhodges/addresskit) [](https://hub.docker.com/r/@bradleyhodges/addresskit) [](https://hub.docker.com/r/@bradleyhodges/addresskit)
|
|
6
|
+
|
|
7
|
+
[](https://github.com/bradleyhodges/addresskit/issues) [](https://github.com/bradleyhodges/addresskit/pulls) [](https://libraries.io/npm/@bradleyhodges%2Faddresskit)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# About
|
|
11
|
+
|
|
12
|
+
AddressKit is an open-source, scalable address ingestion, validation, search, and autocomplete engine that handles complex address structures for address validation of Australian addresses against the [Geocoded National Address File](https://data.gov.au/data/dataset/geocoded-national-address-file-g-naf) (referred to as G-NAF) — Australia's authoritative address file.
|
|
13
|
+
|
|
14
|
+
This project is a fork of [Addressr](https://github.com/mountain-pass/addressr), with the objective of improving the quality, performance, and maintainability of the codebase. AddressKit is a rewrite of Addressr in TypeScript with numerous improvements, and is a major improvement over the original project, which is sparsely maintained and contains dangerously outdated dependencies.
|
|
15
|
+
|
|
16
|
+
It is available as a self-hosted solution, or can be accessed for free through the AddressKit REST API.
|
|
17
|
+
|
|
18
|
+
AddressKit is actively maintained and developed by [Bradley Hodges](https://github.com/bradleyhodges) and is not affiliated with Addressr or its author, Mountain Pass.
|
|
19
|
+
|
|
20
|
+
## Licensing
|
|
21
|
+
|
|
22
|
+
*Addressr* (the library which AddressKit was forked from) is licensed under the [Apache 2.0](https://github.com/mountain-pass/addressr/blob/f0eb2faa6098e69e5a912e4b6af70c73e5b380a3/LICENSE.md), which expressly permits commercial use, modification, distribution, and sublicensing. You can read more about Apache 2.0 license terms [here](https://www.tldrlegal.com/license/apache-license-2-0-apache-2-0).
|
|
23
|
+
|
|
24
|
+
**AddressKit is licensed under the [GNU GPLv2](https://github.com/bradleyhodges/addresskit/blob/master/LICENSE)** license. You can read more about the GNU GPLv2 license [here](https://www.tldrlegal.com/license/gnu-general-public-license-v2).
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
AddressKit is a comprehensive solution for managing and validating Australian addresses. Notable features include:
|
|
28
|
+
|
|
29
|
+
- ✅ **Autocomplete:** Blazingly fast search and autocomplete of Australian addresses based on partial input with result paging, sorting, and filtering
|
|
30
|
+
- ✅ **Canonical validation**: Validation is built into AddressKit's core data model since every address is resolved from the [G-NAF](https://data.gov.au/data/dataset/geocoded-national-address-file-g-naf) by default, so "valid" automatically means "authoritatively correct"
|
|
31
|
+
- ✅ **Always up-to-date:** AddressKit automatically refreshes its data from the [G-NAF](https://data.gov.au/data/dataset/geocoded-national-address-file-g-naf) every 3 months
|
|
32
|
+
- ✅ **Real-time address validation:** Address validation and autocomplete for Australian addresses
|
|
33
|
+
- ✅ **JSON:API compliant:** RESTful API conforming to the [JSON:API v1.1 specification](https://jsonapi.org/format/) for standardized, predictable responses
|
|
34
|
+
- ✅ **Easy to use API:** Straightforward REST API and CLI service for building your own address validation and autocomplete solutions
|
|
35
|
+
- ✅ **Beautiful CLI:** Modern command-line interface with colorful output, progress indicators, and intuitive commands
|
|
36
|
+
- ✅ **Run on your own infrastructure or use ours:** Self-host or use our hosted solution
|
|
37
|
+
- ✅ **Completely free and open-source:** Completely free or pay for support
|
|
38
|
+
- ✅ **Geocoding:** Geocoding of addresses to latitude and longitude coordinates
|
|
39
|
+
- ✅ **Cross-platform:** Works on Windows, macOS, and Linux
|
|
40
|
+
|
|
41
|
+
# Table of Contents
|
|
42
|
+
|
|
43
|
+
- [About](#about)
|
|
44
|
+
- [Table of Contents](#table-of-contents)
|
|
45
|
+
- [Installation](#installation)
|
|
46
|
+
- [CLI Reference](#cli-reference)
|
|
47
|
+
- [Commands](#commands)
|
|
48
|
+
- [Load Command](#load-command)
|
|
49
|
+
- [Start Command](#start-command)
|
|
50
|
+
- [Version Command](#version-command)
|
|
51
|
+
- [Quick Start](#quick-start)
|
|
52
|
+
- [Self Hosted](#self-hosted)
|
|
53
|
+
- [API Endpoints](#api-endpoints)
|
|
54
|
+
- [Search / Autocomplete](#search--autocomplete)
|
|
55
|
+
- [Get Address Details](#get-address-details)
|
|
56
|
+
- [Error Responses](#error-responses)
|
|
57
|
+
- [Configuration](#configuration)
|
|
58
|
+
- [System Requirements](#system-requirements)
|
|
59
|
+
|
|
60
|
+
# Installation
|
|
61
|
+
|
|
62
|
+
Install AddressKit globally using npm:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install -g @bradleyhodges/addresskit
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or using yarn:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
yarn global add @bradleyhodges/addresskit
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or using pnpm:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pnpm add -g @bradleyhodges/addresskit
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
After installation, the `addresskit` command will be available globally in your terminal.
|
|
81
|
+
|
|
82
|
+
**Verify Installation:**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
addresskit --version
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
# CLI Reference
|
|
89
|
+
|
|
90
|
+
AddressKit provides a beautiful, intuitive command-line interface for managing your address validation service.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
___ __ __ __ __ _ __
|
|
94
|
+
/ | ____/ /___/ /_______ __________/ //_/(_) /_
|
|
95
|
+
/ /| |/ __ / __ / ___/ _ \/ ___/ ___/ ,< / / __/
|
|
96
|
+
/ ___ / /_/ / /_/ / / / __(__ |__ ) /| |/ / /_
|
|
97
|
+
/_/ |_\__,_/\__,_/_/ \___/____/____/_/ |_/_/\__/
|
|
98
|
+
|
|
99
|
+
─────────────────────────────────────────────────────
|
|
100
|
+
Australian Address Validation & Autocomplete Engine
|
|
101
|
+
─────────────────────────────────────────────────────
|
|
102
|
+
|
|
103
|
+
Usage: addresskit [options] [command]
|
|
104
|
+
|
|
105
|
+
Options:
|
|
106
|
+
-v, --version Display version information
|
|
107
|
+
-h, --help Display help information
|
|
108
|
+
|
|
109
|
+
Commands:
|
|
110
|
+
load [options] Load G-NAF address data into the search index
|
|
111
|
+
start [options] Start the REST API server
|
|
112
|
+
version Display detailed version and environment information
|
|
113
|
+
help [command] Display help for a specific command
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Commands
|
|
117
|
+
|
|
118
|
+
| Command | Description |
|
|
119
|
+
|---------|-------------|
|
|
120
|
+
| `addresskit load` | Download and index G-NAF address data into OpenSearch |
|
|
121
|
+
| `addresskit start` | Start the REST API server |
|
|
122
|
+
| `addresskit version` | Display version and environment information |
|
|
123
|
+
| `addresskit help` | Display help information |
|
|
124
|
+
|
|
125
|
+
## Load Command
|
|
126
|
+
|
|
127
|
+
Downloads the latest G-NAF dataset from data.gov.au, extracts it, and indexes all addresses into your OpenSearch instance.
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
addresskit load [options]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Options:**
|
|
134
|
+
|
|
135
|
+
| Option | Description | Default |
|
|
136
|
+
|--------|-------------|---------|
|
|
137
|
+
| `-d, --daemon` | Run in background mode (suppresses terminal output) | `false` |
|
|
138
|
+
| `-s, --states <states>` | Comma-separated list of states to load (e.g., `NSW,VIC,QLD`) | All states |
|
|
139
|
+
| `--clear` | Clear existing index before loading | `false` |
|
|
140
|
+
| `--geo` | Enable geocoding support | `false` |
|
|
141
|
+
| `-h, --help` | Display help for the load command | |
|
|
142
|
+
|
|
143
|
+
**Examples:**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Load all states
|
|
147
|
+
addresskit load
|
|
148
|
+
|
|
149
|
+
# Load only NSW and VIC
|
|
150
|
+
addresskit load --states NSW,VIC
|
|
151
|
+
|
|
152
|
+
# Load with geocoding enabled
|
|
153
|
+
addresskit load --geo
|
|
154
|
+
|
|
155
|
+
# Clear index and reload specific states with geocoding
|
|
156
|
+
addresskit load --clear --states QLD,SA --geo
|
|
157
|
+
|
|
158
|
+
# Run in daemon mode (background, no output)
|
|
159
|
+
addresskit load -d
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Valid State Codes:**
|
|
163
|
+
|
|
164
|
+
| Code | State |
|
|
165
|
+
|------|-------|
|
|
166
|
+
| `ACT` | Australian Capital Territory |
|
|
167
|
+
| `NSW` | New South Wales |
|
|
168
|
+
| `NT` | Northern Territory |
|
|
169
|
+
| `OT` | Other Territories |
|
|
170
|
+
| `QLD` | Queensland |
|
|
171
|
+
| `SA` | South Australia |
|
|
172
|
+
| `TAS` | Tasmania |
|
|
173
|
+
| `VIC` | Victoria |
|
|
174
|
+
| `WA` | Western Australia |
|
|
175
|
+
|
|
176
|
+
## Start Command
|
|
177
|
+
|
|
178
|
+
Starts the REST API server for address search and validation.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
addresskit start [options]
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Options:**
|
|
185
|
+
|
|
186
|
+
| Option | Description | Default |
|
|
187
|
+
|--------|-------------|---------|
|
|
188
|
+
| `-d, --daemon` | Run in background mode (suppresses terminal output) | `false` |
|
|
189
|
+
| `-p, --port <port>` | Port to listen on | `8080` or `$PORT` |
|
|
190
|
+
| `-h, --help` | Display help for the start command | |
|
|
191
|
+
|
|
192
|
+
**Examples:**
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Start server on default port (8080)
|
|
196
|
+
addresskit start
|
|
197
|
+
|
|
198
|
+
# Start server on custom port
|
|
199
|
+
addresskit start --port 3000
|
|
200
|
+
|
|
201
|
+
# Start in daemon mode
|
|
202
|
+
addresskit start -d
|
|
203
|
+
|
|
204
|
+
# Start on custom port in daemon mode
|
|
205
|
+
addresskit start -d -p 9000
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Version Command
|
|
209
|
+
|
|
210
|
+
Displays detailed version and environment information.
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
addresskit version
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
# Quick Start
|
|
217
|
+
|
|
218
|
+
## Self Hosted
|
|
219
|
+
|
|
220
|
+
### 1. Install AddressKit
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm install -g @bradleyhodges/addresskit
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### 2. Start OpenSearch
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
docker pull opensearchproject/opensearch:1.3.20
|
|
230
|
+
docker run -p 9200:9200 -p 9300:9300 \
|
|
231
|
+
-e "discovery.type=single-node" \
|
|
232
|
+
-e "plugins.security.disabled=true" \
|
|
233
|
+
opensearchproject/opensearch:1.3.20
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 3. Configure Environment Variables
|
|
237
|
+
|
|
238
|
+
**Linux/macOS:**
|
|
239
|
+
```bash
|
|
240
|
+
export ELASTIC_PORT=9200
|
|
241
|
+
export ELASTIC_HOST=localhost
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Windows (PowerShell):**
|
|
245
|
+
```powershell
|
|
246
|
+
$env:ELASTIC_PORT = "9200"
|
|
247
|
+
$env:ELASTIC_HOST = "localhost"
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Windows (Command Prompt):**
|
|
251
|
+
```cmd
|
|
252
|
+
set ELASTIC_PORT=9200
|
|
253
|
+
set ELASTIC_HOST=localhost
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### 4. Load Address Data
|
|
257
|
+
|
|
258
|
+
In a new terminal window:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# Load all states (takes approximately 1 hour for 13+ million addresses)
|
|
262
|
+
addresskit load
|
|
263
|
+
|
|
264
|
+
# Or load specific states for faster initial setup
|
|
265
|
+
addresskit load --states VIC,NSW
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Optional: Enable Geocoding**
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Linux/macOS
|
|
272
|
+
export ADDRESSKIT_ENABLE_GEO=1
|
|
273
|
+
export NODE_OPTIONS=--max_old_space_size=8196
|
|
274
|
+
addresskit load --geo
|
|
275
|
+
|
|
276
|
+
# Windows (PowerShell)
|
|
277
|
+
$env:ADDRESSKIT_ENABLE_GEO = "1"
|
|
278
|
+
$env:NODE_OPTIONS = "--max_old_space_size=8196"
|
|
279
|
+
addresskit load --geo
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
> **Note:** With geocoding enabled, indexing takes longer and requires more memory (8GB recommended).
|
|
283
|
+
|
|
284
|
+
### 5. Start the API Server
|
|
285
|
+
|
|
286
|
+
In another terminal window:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
addresskit start
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Or specify a custom port:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
addresskit start --port 3000
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### 6. Test the API
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# Search for addresses (autocomplete)
|
|
302
|
+
curl -H "Accept: application/vnd.api+json" \
|
|
303
|
+
"http://localhost:8080/addresses?q=LEVEL+25,+TOWER+3"
|
|
304
|
+
|
|
305
|
+
# Get detailed information for a specific address
|
|
306
|
+
curl -H "Accept: application/vnd.api+json" \
|
|
307
|
+
"http://localhost:8080/addresses/GAVIC411711441"
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
The API returns JSON:API compliant responses. See [API Endpoints](#api-endpoints) for detailed examples.
|
|
311
|
+
|
|
312
|
+
### 7. Keep Data Updated
|
|
313
|
+
|
|
314
|
+
An updated G-NAF is released every 3 months. Set up a cron job to keep AddressKit updated:
|
|
315
|
+
|
|
316
|
+
**Linux/macOS (crontab):**
|
|
317
|
+
```bash
|
|
318
|
+
# Run on the 1st of every month at 3am
|
|
319
|
+
0 3 1 * * addresskit load --clear
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Windows (Task Scheduler):**
|
|
323
|
+
Create a scheduled task to run `addresskit load --clear` monthly.
|
|
324
|
+
|
|
325
|
+
# API Endpoints
|
|
326
|
+
|
|
327
|
+
The AddressKit API conforms to the [JSON:API v1.1 specification](https://jsonapi.org/format/). All responses use the `application/vnd.api+json` media type.
|
|
328
|
+
|
|
329
|
+
| Endpoint | Method | Description |
|
|
330
|
+
|----------|--------|-------------|
|
|
331
|
+
| `/addresses?q=<query>` | GET | Search for addresses (autocomplete) |
|
|
332
|
+
| `/addresses?q=<query>&page[number]=<n>` | GET | Search with pagination |
|
|
333
|
+
| `/addresses/:id` | GET | Get detailed information for a specific address |
|
|
334
|
+
| `/docs` | GET | OpenAPI/Swagger documentation |
|
|
335
|
+
|
|
336
|
+
## Search / Autocomplete
|
|
337
|
+
|
|
338
|
+
Search for addresses matching a query string. Returns lightweight autocomplete suggestions optimized for typeahead UX.
|
|
339
|
+
|
|
340
|
+
**Request:**
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
curl -H "Accept: application/vnd.api+json" \
|
|
344
|
+
"http://localhost:8080/addresses?q=300+barangaroo"
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Response:**
|
|
348
|
+
|
|
349
|
+
```json
|
|
350
|
+
{
|
|
351
|
+
"jsonapi": {
|
|
352
|
+
"version": "1.1"
|
|
353
|
+
},
|
|
354
|
+
"data": [
|
|
355
|
+
{
|
|
356
|
+
"type": "address-suggestion",
|
|
357
|
+
"id": "GANSW716635811",
|
|
358
|
+
"attributes": {
|
|
359
|
+
"sla": "LEVEL 25, TOWER 3, 300 BARANGAROO AV, BARANGAROO NSW 2000",
|
|
360
|
+
"rank": 1
|
|
361
|
+
},
|
|
362
|
+
"links": {
|
|
363
|
+
"self": "/addresses/GANSW716635811"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"type": "address-suggestion",
|
|
368
|
+
"id": "GANSW716635812",
|
|
369
|
+
"attributes": {
|
|
370
|
+
"sla": "LEVEL 26, TOWER 3, 300 BARANGAROO AV, BARANGAROO NSW 2000",
|
|
371
|
+
"rank": 0.92
|
|
372
|
+
},
|
|
373
|
+
"links": {
|
|
374
|
+
"self": "/addresses/GANSW716635812"
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
"links": {
|
|
379
|
+
"self": "/addresses?q=300+barangaroo",
|
|
380
|
+
"first": "/addresses?q=300+barangaroo",
|
|
381
|
+
"prev": null,
|
|
382
|
+
"next": "/addresses?q=300+barangaroo&page[number]=2",
|
|
383
|
+
"last": "/addresses?q=300+barangaroo&page[number]=5"
|
|
384
|
+
},
|
|
385
|
+
"meta": {
|
|
386
|
+
"total": 42,
|
|
387
|
+
"page": 1,
|
|
388
|
+
"pageSize": 10,
|
|
389
|
+
"totalPages": 5
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Get Address Details
|
|
395
|
+
|
|
396
|
+
Retrieve comprehensive details for a specific address by its G-NAF Persistent Identifier (PID). Use this endpoint after a user selects an address from the autocomplete results.
|
|
397
|
+
|
|
398
|
+
**Request:**
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
curl -H "Accept: application/vnd.api+json" \
|
|
402
|
+
"http://localhost:8080/addresses/GANSW716635811"
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**Response:**
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"jsonapi": {
|
|
410
|
+
"version": "1.1"
|
|
411
|
+
},
|
|
412
|
+
"data": {
|
|
413
|
+
"type": "address",
|
|
414
|
+
"id": "GANSW716635811",
|
|
415
|
+
"attributes": {
|
|
416
|
+
"pid": "GANSW716635811",
|
|
417
|
+
"sla": "LEVEL 25, TOWER 3, 300 BARANGAROO AV, BARANGAROO NSW 2000",
|
|
418
|
+
"ssla": "25/300 BARANGAROO AV, BARANGAROO NSW 2000",
|
|
419
|
+
"mla": [
|
|
420
|
+
"LEVEL 25",
|
|
421
|
+
"TOWER 3",
|
|
422
|
+
"300 BARANGAROO AV",
|
|
423
|
+
"BARANGAROO NSW 2000"
|
|
424
|
+
],
|
|
425
|
+
"structured": {
|
|
426
|
+
"buildingName": "Tower 3",
|
|
427
|
+
"level": {
|
|
428
|
+
"type": { "name": "Level", "code": "L" },
|
|
429
|
+
"number": 25
|
|
430
|
+
},
|
|
431
|
+
"number": {
|
|
432
|
+
"number": 300
|
|
433
|
+
},
|
|
434
|
+
"street": {
|
|
435
|
+
"name": "Barangaroo",
|
|
436
|
+
"type": { "name": "Avenue", "code": "AV" }
|
|
437
|
+
},
|
|
438
|
+
"locality": {
|
|
439
|
+
"name": "Barangaroo",
|
|
440
|
+
"class": { "code": "G", "name": "GAZETTED LOCALITY" }
|
|
441
|
+
},
|
|
442
|
+
"state": {
|
|
443
|
+
"name": "New South Wales",
|
|
444
|
+
"abbreviation": "NSW"
|
|
445
|
+
},
|
|
446
|
+
"postcode": "2000",
|
|
447
|
+
"confidence": 2
|
|
448
|
+
},
|
|
449
|
+
"geo": {
|
|
450
|
+
"level": {
|
|
451
|
+
"code": 7,
|
|
452
|
+
"name": "LOCALITY, STREET, ADDRESS"
|
|
453
|
+
},
|
|
454
|
+
"geocodes": [
|
|
455
|
+
{
|
|
456
|
+
"latitude": -33.8535,
|
|
457
|
+
"longitude": 151.2012,
|
|
458
|
+
"isDefault": true,
|
|
459
|
+
"reliability": {
|
|
460
|
+
"code": 2,
|
|
461
|
+
"name": "WITHIN ADDRESS SITE BOUNDARY OR ACCESS POINT"
|
|
462
|
+
},
|
|
463
|
+
"type": {
|
|
464
|
+
"code": 2,
|
|
465
|
+
"name": "PROPERTY CENTROID"
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
"links": {
|
|
472
|
+
"self": "/addresses/GANSW716635811"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
"links": {
|
|
476
|
+
"self": "/addresses/GANSW716635811"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
## Error Responses
|
|
482
|
+
|
|
483
|
+
All error responses follow the JSON:API error format:
|
|
484
|
+
|
|
485
|
+
```json
|
|
486
|
+
{
|
|
487
|
+
"jsonapi": {
|
|
488
|
+
"version": "1.1"
|
|
489
|
+
},
|
|
490
|
+
"errors": [
|
|
491
|
+
{
|
|
492
|
+
"status": "404",
|
|
493
|
+
"code": "RESOURCE_NOT_FOUND",
|
|
494
|
+
"title": "Not Found",
|
|
495
|
+
"detail": "The address with ID 'INVALID_123' does not exist."
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
| Status | Description |
|
|
502
|
+
|--------|-------------|
|
|
503
|
+
| `400` | Bad Request - Invalid query parameters |
|
|
504
|
+
| `404` | Not Found - Address ID does not exist |
|
|
505
|
+
| `500` | Internal Server Error - Unexpected error |
|
|
506
|
+
| `503` | Service Unavailable - OpenSearch unavailable |
|
|
507
|
+
| `504` | Gateway Timeout - Query timeout |
|
|
508
|
+
|
|
509
|
+
# Configuration
|
|
510
|
+
|
|
511
|
+
| Environment Variable | Description | Default |
|
|
512
|
+
|---------------------|-------------|---------|
|
|
513
|
+
| `ELASTIC_HOST` | OpenSearch host | `localhost` |
|
|
514
|
+
| `ELASTIC_PORT` | OpenSearch port | `9200` |
|
|
515
|
+
| `ELASTIC_PROTOCOL` | Protocol (`http` or `https`) | `http` |
|
|
516
|
+
| `ELASTIC_USERNAME` | OpenSearch username (optional) | |
|
|
517
|
+
| `ELASTIC_PASSWORD` | OpenSearch password (optional) | |
|
|
518
|
+
| `PORT` | API server port | `8080` |
|
|
519
|
+
| `ES_INDEX_NAME` | OpenSearch index name | `addresskit` |
|
|
520
|
+
| `COVERED_STATES` | Comma-separated list of states to load | All states |
|
|
521
|
+
| `ADDRESSKIT_ENABLE_GEO` | Enable geocoding (`1` to enable) | Disabled |
|
|
522
|
+
| `PAGE_SIZE` | Default results per page | `8` |
|
|
523
|
+
| `ADDRESSKIT_ACCESS_CONTROL_ALLOW_ORIGIN` | CORS allowed origin | |
|
|
524
|
+
| `ADDRESSKIT_ACCESS_CONTROL_EXPOSE_HEADERS` | CORS exposed headers | |
|
|
525
|
+
| `ADDRESSKIT_ACCESS_CONTROL_ALLOW_HEADERS` | CORS allowed headers | |
|
|
526
|
+
| `ADDRESSKIT_INDEX_TIMEOUT` | Index operation timeout | `30s` |
|
|
527
|
+
| `ADDRESSKIT_INDEX_BACKOFF` | Initial backoff delay (ms) | `1000` |
|
|
528
|
+
| `ADDRESSKIT_INDEX_BACKOFF_INCREMENT` | Backoff increment (ms) | `1000` |
|
|
529
|
+
| `ADDRESSKIT_INDEX_BACKOFF_MAX` | Maximum backoff delay (ms) | `10000` |
|
|
530
|
+
|
|
531
|
+
> **Note:** When adjusting `PAGE_SIZE`, consider how quickly you want initial results returned. For most use cases, leave it at 8 and use pagination for additional results. Why 8? [Mechanical Sympathy](https://dzone.com/articles/mechanical-sympathy).
|
|
532
|
+
|
|
533
|
+
# System Requirements
|
|
534
|
+
|
|
535
|
+
## OpenSearch
|
|
536
|
+
|
|
537
|
+
- OpenSearch >= 1.2.4
|
|
538
|
+
- Memory: 1.4 GiB minimum
|
|
539
|
+
- CPU: 1 core
|
|
540
|
+
|
|
541
|
+
## AddressKit Loader
|
|
542
|
+
|
|
543
|
+
### Default (without geocoding)
|
|
544
|
+
- Node.js >= 20.0.0
|
|
545
|
+
- Memory: 1 GiB
|
|
546
|
+
- CPU: 1 core
|
|
547
|
+
|
|
548
|
+
### With Geocoding Enabled
|
|
549
|
+
- Node.js >= 20.0.0
|
|
550
|
+
- Memory: 8 GiB
|
|
551
|
+
- CPU: 4 cores
|
|
552
|
+
|
|
553
|
+
## AddressKit Server
|
|
554
|
+
|
|
555
|
+
- Node.js >= 20.0.0
|
|
556
|
+
- Memory: 64 MiB (128 MiB+ recommended)
|
|
557
|
+
- CPU: 1 core
|
|
558
|
+
|
|
559
|
+
## Supported Platforms
|
|
560
|
+
|
|
561
|
+
- **Windows** 10/11 (x64)
|
|
562
|
+
- **macOS** 12+ (Intel and Apple Silicon)
|
|
563
|
+
- **Linux** (x64, arm64)
|
|
564
|
+
- Ubuntu 20.04+
|
|
565
|
+
- Debian 11+
|
|
566
|
+
- CentOS 8+
|
|
567
|
+
- Amazon Linux 2+
|