Pinakes is the Pubky index of external resources: the web pages, places, events, feeds, media and records that people reference on Pubky. It reads each referenced link into a small typed card, joins the same thing across services, and serves one search over all of them: text, type, map area, time, tags, identifiers and reach. Open catalogues (Wikidata, MusicBrainz, OpenStreetMap and others, read from their dumps) add the cards of things nobody referenced yet; each has an off switch.
- Client authors building on Pubky: read How Pinakes works, then the API reference.
- Operators running an instance: start with Run locally, then deployment, operations and API keys.
- Developers working on Pinakes: read How it works, the source pages and AGENTS.md.
Pubky Nexus indexes the social graph: who tagged, replied to, embedded or collected which link. It records references to links and never fetches them. Pinakes reads the links.
Clients combine the two by URI: Pinakes ranks, Nexus hydrates. A client asks Pinakes for cards
and sends the cards' URIs (uri, its refs, the aliases a full read lists, and for a calendar
date occurrence.feed_uri) to Nexus POST /v1/stream/resources/by_ids as uris, in batches of
100, for counts and tags. Pinakes IDs are its own and never match Nexus IDs.
Pinakes needs these Nexus /v1 routes:
| Nexus route | Used for |
|---|---|
GET /v1/resources/changes |
The reference feed: every tag, reply, embed and collection item on a link |
POST /v1/stream/resources/by_ids |
Social data for the social tool that agents use |
GET /v1/user/{id}/following, …/friends |
reach and boost in search |
GET /v1/user/{id}/reach-set |
wot_2 in search, when nexus_reach_set is on (off by default) |
Nexus GET /v1/resources/changes reference feed: tag, reply, embed, collection, post
│
▼
ingest one resource per link, one row per reference ingest.rs, identity.rs
│
▼
queue one job per resource: route, lease, backoff, refresh queue.rs, scheduler.rs
│
▼
resolvers web, pubky, geo, osm, event, event_platform, cards resolver/, event/
│ official APIs, one module per service sources/
▼
card typed document and its change journal store.rs, changes.rs
│
├── aliases one object under several URIs alias.rs
├── groups one thing under several URIs, from exact keys groups.rs, group_keys.rs
├── also on keys, facts and links from hubs and services also_on.rs, also_on/, lookups/
└── same event events that are possibly the same one same_event.rs
▼
text index words, tags, labels, type, place per unit and card search_index.rs
▼
/v1 API search, cards, lookup, resolve, occurrences, changes api.rs, change_api.rs
Paths are under crates/pinakes-core/src/. crates/pinakesd is the daemon: it parses the command
line, creates the schema, and starts the listeners and the background tasks.
- Ingest.
pinakesdpolls the Nexus reference feed. Pinakes normalizes each link, hashes it into its own resource ID, stores one row per reference, and queues a link it has not seen. - Resolve. Each link goes to one route, chosen from the link alone. The web route reads
JSON-LD, microformats, OpenGraph, oEmbed and the title. Other routes read OpenStreetMap objects,
geo:points and map links, event pages and calendars, other Pubky apps' objects, ISBN, DOI, Nostr and ActivityPub links, and the links of services whose own API Pinakes reads instead of their pages. The result is one card: a schema.org type, name, description, image, site, place, times and facts. - Join. Hubs (MusicBrainz, Wikidata) and services are asked about each card's object, by exact
identifiers only. Their answers give keys (
isrc:…,mb:recording:…,wikidata:Q…,doi:…), facts and derived links. Resources that share a key form a group. A group is a hint on each card, never a merge. - Serve. A search with text reads its candidates from an embedded Tantivy index of every
searchable unit and every catalogue card, which triggers keep current; Postgres checks each
candidate and builds the page (text index). The public
listener (port 8090 by default) serves
/v1. The admin listener (port 9090) serves/metrics, operator info, stored documents and group curation.
Pinakes stores its data in PostgreSQL with PostGIS and pg_trgm. The index is derived data that a
replay of the Nexus feed rebuilds; operator group curation and the change journal are not, and need
a backup. How Pinakes works explains every step and its rules.
You need:
- Rust 1.98.1 (
rust-toolchain.tomlselects it); - PostgreSQL 16 to 18 with PostGIS 3.4 or newer and
pg_trgm. On Ubuntu, installpostgresql-16 postgresql-16-postgis-3 postgresql-contrib-16, from the PGDG repository if your distribution lacks version 16; - a Nexus that serves the
/v1resource changes feed.
Docker is not required.
-
Create the database and a configuration file:
sudo pg_ctlcluster 16 main start sudo -u postgres createuser --superuser "$USER" createdb pinakes cp pinakes.example.toml pinakes-dev.toml -
In
pinakes-dev.toml, setnexus_urlto your Nexus, and[http] contactto an address the services Pinakes reads can reach you at. The contact goes into the User-Agent,pinakes/<version> (+https://pubky.app; <contact>); some services (SEC EDGAR) refuse requests without one. -
Start the daemon:
scripts/dev
scripts/devbuildspinakesd, creates the schema, starts the daemon on port 8090 (admin on 9090) and tails.runtime/pinakesd.log. -
Send a first query:
curl http://127.0.0.1:8090/v1/info curl 'http://127.0.0.1:8090/v1/search?tags=rust&facet=tags&limit=10' curl -H 'Content-Type: application/json' -d '{"uri":"https://example.org/"}' \ http://127.0.0.1:8090/v1/resolve
Swagger UI is at
http://127.0.0.1:8090/swagger-ui, with an example for every kind of card and source.
The local superuser is for development only. In a deployment, a superuser creates the database and its extensions, and the daemon connects as the database's owner (operations).
| Command | What it does |
|---|---|
pinakesd --config <path> |
Runs the daemon, and creates the schema on an empty database |
pinakesd --config <path> --migrate |
Creates the schema on an empty database and exits |
pinakesd --config <path> reextract <route…|all|also-on> |
Reads stored links again after a parser or routing change; run it with the daemon stopped (operations) |
pinakesd --config <path> catalogue status|drop <name>|import <name> |
Shows each catalogue's state, deletes a catalogue that is off, or runs one import (or update) now (operations) |
pinakesd healthcheck |
Asks the admin listener's GET /healthz; exits non-zero unless it answers 200 |
pinakesd --openapi |
Prints the OpenAPI document |
Settings live in one TOML file; pinakes.example.toml lists them with
comments. It holds the listen addresses, one enabled switch per resolver, source and feature,
event platforms, egress allow and deny lists, and the public API's budget and CORS. Every cap,
timeout and refresh interval has a default and can be set in an optional [limits] section
(operations).
Any key can also be set in the environment as PINAKES__SECTION__KEY, for example
PINAKES__WEB__ENABLED=false or PINAKES__LIMITS__POLL_SECS=10. Strings are literal; numbers,
booleans and arrays are JSON. The environment wins over the file. Unknown keys and invalid values
stop startup, except retired keys, which are ignored with a warning.
Secrets come from the environment. .env.example lists them with placeholder
values: the database URL, the admin token, the Nexus authorization, a keyed Nominatim URL and the
optional provider credentials (Spotify, TIDAL, Discogs, GitHub, CourtListener, Podcast Index, TMDB,
Ticketmaster). Copy it to .env, fill in what
you use, and load it (set -a; . ./.env; set +a, systemd EnvironmentFile=, or
docker run --env-file). Keep .env out of version control and readable by the service user only.
A source's token or app-key variable (PINAKES_GITHUB_TOKEN, PINAKES_COURTLISTENER_TOKEN, the
Discogs consumer pair) fills its value only when the file and the PINAKES__… form leave it unset;
the credentials of a section of its own (PINAKES_SPOTIFY_*, PINAKES_TIDAL_*, TMDB_API_KEY)
replace the file's value. The API-key guide explains each credential and what works without it.
# The role needs CREATEDB and permission to create the PostGIS extension.
export DATABASE_URL='postgresql:///postgres?host=/var/run/postgresql'
scripts/testscripts/test runs cargo fmt --check, clippy with warnings denied, every workspace test, the e2e
driver's Node tests (npm test --prefix e2e, Node 20 or newer) and scripts/check-ops. Integration
tests create their own disposable databases and never touch the development database. HTTP tests use
local servers, injected transports and recorded fixtures. The tests that run
scripts/verify-osm-boundary also need psql, pg_dump, rg and python3.
End-to-end checks (e2e/README.md) also need Node 20 or newer:
scripts/e2e --mockruns the whole flow (schema, ingest, queue, resolvers, groups, API) against fixtures, offline.scripts/e2e --isolated-livewrites real tags through the Pubky SDK, checks them through a real Nexus and public services, and deletes them after.scripts/demo-lookup [--base URL]resolves a list of public links against a running daemon and fails when one misses its expected type, status or derived links. It writes nothing to Pubky or Nexus, butPOST /v1/resolvecreates and queues each link in that Pinakes.
| Document | Contents |
|---|---|
| How Pinakes works | References, routes, identity, refresh, keys and groups, maybe-same, social content, events, places, what is never indexed |
| Product decisions | Each product rule with its reason |
| API reference | The /v1 API: cards, search, lookups, groups, also-on links, agents and the admin listener |
| Sources | One page per source: links, requests, credentials, cards, keys, credit and switch |
| Operations | Configuration and limits, database, egress, ingestion, refresh, walls, events, monitoring |
| Deployment | Container, CI, what to host, storage, network and an upgrade checklist |
| API keys | Every optional credential, where to get it and what works without it |
| Pubky apps | Cards for other Pubky apps' objects, and how to add an app |
| ops/README.md | Metrics, alerts and the Grafana dashboard |
| data/README.md | Pinned data sets and their licences |
| e2e/README.md | The end-to-end harness |
| AGENTS.md | How to work on the code |
| Path | Purpose |
|---|---|
crates/pinakes-core |
The library: ingest, queue, resolvers, sources, joins and the API |
crates/pinakesd |
The daemon binary |
migrations |
The database schema, 0001_schema.sql |
data |
Pinned data sets: oEmbed providers, event platforms, time zones, wall markers |
docs |
Documentation |
e2e |
The end-to-end harness |
ops |
Alert rules and the Grafana dashboard |
scripts |
Development, test and maintenance scripts |
MIT. See LICENSE.