Getting Started

5-Minute Quickstart

Get global geocoding running in under 5 minutes — zero API keys, zero credit card, and zero servers required. Pick your stack below.

1. JavaScript / TypeScript (Browser, Workers, Node 18+, Deno, Bun)#

Install the zero-dependency package:

bash
npm install texspace
ts
import { Texspace } from "texspace";

// Connects to the free public planet dataset (or your own S3/R2 bucket)
const geo = await Texspace.open("https://shards.texspace.dev/txg/v2");

// 1. Global search (automatically handles typos like "4865 Mision St")
const search = await geo.search("10 Downing Street, London, SW1A 2AA");
console.log(search.results[0].label, search.results[0].lat, search.results[0].lon);

// 2. Verify deliverability & detect city/ZIP mismatches
const verify = await geo.verify("4865 Mission St Apt 4B 94112 Oakland");
console.log(verify.deliverable, verify.status, verify.formatted_lines, verify.conflicting_tokens);

// 3. Checkout autocomplete with highlight offsets
const ac = await geo.autocomplete("2750 Mid", { focus: [37.4419, -122.1430], limit: 5 });
console.log(ac.results[0].label, ac.results[0].highlights);

// 4. Enrich a coordinate with address, local timezone, state & country in parallel
const enriched = await geo.enrich(37.72047, -122.43765, {
  reverse: true,
  timezone: true,
  layers: ["layers/us_states.txg", "layers/world_countries.txg"],
});
console.log(enriched.timezone?.tzid, enriched.layers?.us_states?.[0]?.id);

// 5. Find nearby transit stations, parks, or your own mounted stores/warehouses
const stations = await geo.nearby("stations within 2km of 10 Downing Street, London", { limit: 5 });
console.log(stations.results.map((r) => `${r.name} (${r.distance_m}m)`));

geo.free();

2. Drop-In Checkout Form (HTML or React)#

html
<script type="module" src="https://cdn.jsdelivr.net/npm/texspace/element.js"></script>

<form>
  <texspace-address-input name="street" verify placeholder="Shipping address..."></texspace-address-input>
  <input name="apt" autocomplete="address-line2" placeholder="Apt / Suite" />
  <input name="city" autocomplete="address-level2" placeholder="City" />
  <input name="state" autocomplete="address-level1" placeholder="State / Region" />
  <input name="zip" autocomplete="postal-code" placeholder="Postal code" />
  <input name="country" autocomplete="country-name" placeholder="Country" />
</form>

3. Command Line (Zero Local Download)#

Install via Cargo (cargo install texspace) or download a pre-built binary from GitHub Releases:

bash
# Search globally with zero local dataset download
texspace txg --txg https://shards.texspace.dev/txg/v2 --mode search "4865 Mision St, San Francisco, CA 94112"

# Enrich a coordinate with reverse address, timezone, state & country
texspace txg --txg https://shards.texspace.dev/txg/v2 --mode enrich \
  --lat 37.72047 --lon -122.43765 --layers layers/us_states.txg,layers/world_countries.txg

# Plain-English nearby search
texspace txg --txg https://shards.texspace.dev/txg/v2 --mode nearby \
  "stations within 2km of 10 Downing Street, London" --limit 5

4. Self-Hosted Sub-2ms Local API Server#

bash
# Pull one region (or `planet --with-all`) and start the REST API
texspace pull us_ca --with-buildings --with-parcels --with-geoip --with-tz --out data/us_ca
texspace serve --db data/us_ca --port 4000

curl "http://127.0.0.1:4000/v1/search?text=2750+Middlefield+Rd,+Palo+Alto&format=compact"

Public Hosted Data & Live Endpoints#

ResourceURL / PathNotes
Global Planet Archive (450M+ rooftops)https://shards.texspace.dev/txg/v2Free public CDN, CORS *, immutable
IANA Timezones (444 zones + DST)tz.txgRelative to base URL
US States + DC + PR Boundary Layerlayers/us_states.txgReady-to-use enrich() / lookupLayer() layer
World Countries Boundary Layerlayers/world_countries.txg172 countries ready for enrich() / lookupLayer()
Hosted REST API & GeoIPhttps://api.texspace.dev/v1/search, /v1/verify, /v1/geoip, /openapi.json, /llms.txt

Next Steps#