MCPcopy Index your code
hub / github.com/ellenhp/airmail

github.com/ellenhp/airmail @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
123 symbols 211 edges 23 files 28 documented · 23%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

📫 Airmail 📫

Airmail is an extremely lightweight geocoder[^1] written in pure Rust. Built on top of tantivy, it offers a low memory footprint and fast performance. Airmail aims to support international queries in several languages, but in practice it's still very early days and there are definitely bugs preventing correct behavior.

[^1]: A geocoder is a search engine for places. When you type in "vegan donut shop" into your maps app of choice, a geocoder is what shows you nearby places that fit your query.

Features

Airmail's killer feature is the ability to query remote indices, e.g. on S3. This lets you keep your index hosting costs fixed while you scale horizontally. The baseline cost of a global Airmail deployment is about $5 per month.

Roadmap

  • [x] Index OpenStreetMap data, from osmx or pbf file.
  • [ ] Index OpenAddresses data (not currently used in demo).
  • [ ] Index WhosOnFirst data.
  • [x] API server.
  • [x] Address queries.
  • [x] Named POI queries.
  • [ ] Administrative area (city, province/state, country etc) queries.
  • [x] Prefix queries.
  • [x] Query remote indices.
  • [x] Support and test planet-scale indices.
  • [x] International address queries.
  • [ ] Categorical search, e.g. "coffee shop seattle".
  • [x] Typo tolerance (limited to >=8 character input tokens)
  • [x] Bounding box restriction.
  • [ ] Focus point queries.
  • [ ] Systematic/automatic quality testing in CI.

Quickstart

This guide will create an index with a chosen geographical region (or the planet!) and run Airmail.

Requirements

  • Rust environment, Docker with Docker Compose, or Podman with Podman Compose.
  • ~16GB memory and 10-100GB of free space.

Clone the Repo

git clone git@github.com:ellenhp/airmail.git

cd airmail

mkdir ./data

Fetch Data

It's a good idea to build a smaller region first, and then planet if you have the need and space. This guide references Australia, but you can use any region.

  1. Download OSM probuf file (.pbf file) for the target region of interest. See: https://download.geofabrik.de or https://download.bbbike.org/osm/planet/ and place into ./data folder.
  2. Download Who's On First (SpatiaLite format). For planet see: https://geocode.earth/data/whosonfirst/combined/ and https://data.geocode.earth/wof/dist/spatial/whosonfirst-data-admin-latest.spatial.db.bz2
  3. Ensure files are present and decompressed in the ./data/ directory.

Option 1 - Docker

# Build the images
docker compose build

# Build the index (from a pbf)
docker compose run indexer \
indexer --wof-db /data/whosonfirst-data-admin-latest.spatial.db \
--index /data/index/ \
load-osm-pbf /data/australia-oceania-latest.osm.pbf

# Launch the service
docker compose up airmail

Option 2 - From Source

# Install deps
apt-get install -y libssl-dev capnproto clang pkg-config libzstd-dev libsqlite3-mod-spatialite

# Run indexer
cargo run --bin indexer -- \
--wof-db /data/whosonfirst-data-admin-latest.spatial.db \
--index /data/index/ \
load-osm-pbf /data/australia-oceania-latest.osm.pbf

# Run service
cargo run --bin airmail_service -- \
--index /data/index/

License

Dual MIT/Apache 2 license, at your option.

Core symbols most depended-on inside this repo

is_empty
called by 12
airmail_indexer/src/pip_tree.rs
schema
called by 7
airmail/src/index.rs
len
called by 6
airmail_indexer/src/pip_tree.rs
point_in_polygon
called by 6
airmail_indexer/src/wof.rs
search
called by 5
airmail/src/index.rs
field_content
called by 4
airmail/src/index.rs
permute_road
called by 3
airmail/src/substitutions.rs
commit
called by 3
airmail/src/index.rs

Shape

Method 71
Class 28
Function 18
Enum 6

Languages

Rust100%

Modules by API surface

airmail/src/index.rs20 symbols
airmail_indexer/src/cache.rs13 symbols
airmail_indexer/src/wof.rs12 symbols
airmail_indexer/src/pip_tree.rs10 symbols
airmail_indexer/src/importer.rs9 symbols
airmail/src/substitutions.rs9 symbols
airmail_indexer/src/osm.rs7 symbols
airmail_indexer/src/query_pip.rs6 symbols
airmail_service/src/api.rs5 symbols
airmail_indexer/src/osm_pbf.rs5 symbols
airmail/src/poi.rs5 symbols
airmail_indexer/src/osm_osmx.rs4 symbols

For agents

$ claude mcp add airmail \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact