# Self-host routing from one .glx file

> A router needs one .glx file with a routing part and no database. The builder writes that file today. The router is a Rust library with a Cloudflare Worker app around it that reads the file from R2; the source is not public yet and there is nothing to download.

Status: In development, not deployed: there is no routing endpoint to call yet, on geolith.app or api.geolith.app, and no routing plan, price or key.

## The file

The builder writes the routing part from an OpenStreetMap extract.

- One .glx file with a routing part: a routing header, a tile index, a zstd dictionary and the graph tiles.
- A file can hold a search part and a routing part; each reader reads only its own part.
- Add --routing-predicted-speeds <dir> to build historical speeds into the file.

Build command:

```bash
geolith --output-format routing --osm-pbf berlin.osm.pbf --routing-output berlin-routing.glx
```

## Worker or server

Both open the file the same way: read the file header, find the routing part, keep the tile index in memory, and fetch blocks as a request needs them.

- Cloudflare Worker: the router compiled to WebAssembly, the file in R2, range reads per block. A test Worker runs this today; it is not public.
- Server: the same library next to a file on local disk. A packaged server binary is planned.
- Both answer the same Valhalla-compatible endpoints: /route, /sources-to-targets, /isochrone, /trace-route, /trace-attributes.
- No latency or cost figures: none are measured on a deployed server yet.

## Guides

- https://geolith.app/guides/build-a-routing-glx
- https://geolith.app/guides/self-host-geolith-routing

## Sources

1. [Self-hosting routing (planned)](https://docs.geolith.app/routing/self-hosting), geolith docs (read 2026-11-08)
2. [RFC 9110 §14: Range Requests](https://www.rfc-editor.org/rfc/rfc9110#name-range-requests), IETF (read 2026-10-22)

Routing is in development and not deployed; there is no endpoint to call yet, and no routing plan, price or key. Read the routing docs: https://docs.geolith.app/routing
