@aymenkits/location-addresses
v1.0.0
Published
Generic user address book — CRUD with default-flipping, coordinate validation, an app-extension payload (H3 cells, placeId, …) and a Geocoder seam with a Mapbox adapter (autocomplete + reverse).
Downloads
169
Maintainers
Readme
@aymenkits/location-addresses
Address book (CRUD + single-default flip logic) generic over your extra columns, plus a Geocoder seam with a ready Mapbox forward-geocoding adapter.
Install
npm install @aymenkits/location-addressesInstalls with it: nothing else — zero dependencies.
You provide
AddressStore— your table (lean, or enriched with e.g. precomputed H3 columns)- For geocoding: your Mapbox token (server-side)
- Optional
onWritehook (e.g. compute H3 cells via @aymenkits/clustermap-core)
The package never owns tables, never imports an ORM, HTTP framework, or provider SDK it can take as a parameter — storage and delivery are seams your app implements on its own stack.
Quick example
import { createAddressService, mapboxGeocoder } from '@aymenkits/location-addresses'
const addresses = createAddressService({ store, onWrite })
const geocoder = mapboxGeocoder({ token: process.env.MAPBOX_TOKEN })Pairs with
@aymenkits/clustermap-corecomputeCells in the onWrite hook@aymenkits/auth-expressguards the routes
Kits pair by shape, never by import — pass the sibling kit, your own service, or a stub in tests.
Docs
Full contracts and integration guides live in the repo:
https://github.com/aymenmokhtarikouki/location-kit (contracts/, docs/).
License
MIT
