registry.json Reference¶
The Hub reads a registry.json file listing the regional PostgREST backends, one entry each. Browsers load it once per page load and then refresh each listed backend's get_meta every HUB_POLL_INTERVAL (default 5 min). After editing the file, restart the hub's app container (docker compose --profile ui restart app): the Content Security Policy's connect-src is generated from it at startup, so a new backend is otherwise missing from it. The Hub fetches get_meta from each backend and, for the current view, the tier RPCs of the backends it overlaps, merges them onto a shared map, and tags every feature with its source backend so deep-links round-trip.
Location¶
- Served from: the nginx container under
/registry.json(path configurable viaREGISTRY_URL). - Source file:
app/public/registry.jsonin the repo. In production, replace or bind-mount with your own registry. - Served as:
application/json. CORS is not needed for the registry file itself — the Hub fetches it from its own origin. The backends the registry points at are typically cross-origin and must enable CORS on/api/(covered in Federation endpoints).
Schema¶
Two top-level shapes are accepted:
Both forms are supported indefinitely. New registries should prefer the object form so future top-level metadata (e.g. a registry version) can be added without a breaking change.
Entry fields¶
| Field | Required | Description |
|---|---|---|
url |
yes | Base URL of the backend's PostgREST /api. Surrounding whitespace and trailing slashes are removed (in the browser and in the hub's health poll alike, #740). The Hub calls the tier RPCs (/rpc/get_playground_clusters, /rpc/get_playgrounds_bbox, …) and /rpc/get_meta under it. |
name |
recommended | Human-readable label. Shown in the instance drawer and — until get_meta returns — used as the backend's displayed region name. Technically falls back to url if omitted, which gives ugly labels — always set it. |
slug |
no | Short stable identifier used in deep-links (#<slug>/W<osm_id>). If present, features from this backend round-trip their slug back into the URL hash on selection. See validation rules below. |
centroid |
no | [lon, lat] in WGS84 (e.g. [9.93, 51.54]). Sets a fallback position for the macro view ring when the backend has no bbox yet (first import not completed, or import failed). Without this field, a backend with no data is invisible on the macro view map. Once the first import completes, the bbox-derived centroid takes over automatically — no manual update needed. Note: When a backend has neither bbox nor centroid, the instance panel auto-opens to alert operators, showing a "No position set" warning with a link to troubleshooting docs. |
country |
no | ISO 3166-1 alpha-2 code (e.g. "SK", case-insensitive). Shows a small country chip next to the name in the instance drawer, with the full country name for screen readers and as a tooltip (#741). Set it only where it tells something — on a mostly German federation, only on the non-German entries; entries without it render as before. An invalid value is ignored with a console warning. |
Common mistakes¶
All three of these happened on one entry, and each one fails without an error in the hub (#740):
| Mistake | What you see | Fix |
|---|---|---|
url without the /api path (https://hojdy.sk) |
Backend stays "unreachable" — the hub asks https://hojdy.sk/rpc/get_meta, which is a 404 |
End the URL with the PostgREST path, usually /api. Not repaired automatically: path-prefix deployments legitimately use other paths. Check with curl <url>/rpc/get_meta |
| Stray whitespace or a trailing slash | — | Harmless since #740: both are stripped |
No url, or the same url twice |
— | Skipped with a console warning naming the entry: an entry without a URL has nothing to ask, and a duplicate would never receive data, since every lookup is by URL |
Upper-case slug ("Kosice") |
Deep links fall back to the bare #W<id> form for that backend |
Use lower case ("kosice"). Not repaired automatically: the slug is part of links people share, so the hub must not serve a different spelling than the registry |
Runtime-populated fields
The Hub does not read version or region from registry.json entries — adding those keys to the file has no effect. Both come at runtime from each backend's /api/rpc/get_meta response: the region name from the OSM relation, version from the release that last applied the backend's api.sql. The region list shows that version as a badge.
Slug validation¶
Slugs must match ^[a-z0-9-]+$ — lowercase ASCII letters, digits, and hyphens only. Invalid slugs are logged as a console warning and treated as absent — the entry still works (playgrounds still load from that backend), but deep-links won't be slug-scoped and selections on features from that backend will fall back to the bare #W<osm_id> form.
Slugs should be stable — they are persisted in URLs shared by users. Rename with care; there's no redirect mechanism.
Derived capabilities¶
Once the registry is loaded, the Hub derives one aggregate from it:
Aggregated bounding box¶
The Hub unions every backend's get_meta().bbox into a single extent and uses it to fit the initial map view. Backends that haven't yet reported (still loading, failed, or running a version older than v0.2.1) are ignored. Until at least one backend reports a bbox, the map stays on its default Germany-wide view.
Deep-link behaviour¶
| URL hash | Hub behaviour |
|---|---|
#<slug>/W<osm_id> |
Resolves slug → backend URL, waits for that backend's features, selects the matching osm_id. Unknown slug: logs once and retries as more backends load. |
#W<osm_id> |
Broadcast search across every loaded backend. First match wins; duplicate osm_id across backends triggers a console warning. |
#<anything>/W<osm_id> |
Standalone mode ignores the slug prefix and selects the osm_id from its sole configured backend. |
When a user selects a playground, the Hub rewrites the hash to its canonical slug-scoped form if the backend has a slug, otherwise to the bare W<osm_id> form.
A standalone pitch uses P instead of W in every form (#<slug>/P<osm_id>, #P<osm_id>). A slug-less pitch link is resolved by asking every backend's get_pitch.
See also¶
- Federation — Hub deployment and the
APP_MODE=hubswitch. - Monitoring —
/federation-status.jsonhealth rollup and/metricsPrometheus exposition.