lexdns#
lexdns is a tiny web app that resolves ATProto Lexicon schemas from NSIDs.
Usage#
# For metadata, including the ATURI:
curl https://lex.desertthunder.dev/api/resolve/app.bsky.feed.post
# For just the schema:
curl https://lex.desertthunder.dev/api/resolve/com.atproto.repo.getRecord | jq '.lexicon'
# Resolve an AT URI or HTTPS getRecord URL:
curl "https://lex.desertthunder.dev/api/uri/at%3A%2F%2Fdid%3Aplc%3Axg2vq45muivyy3xwatcehspu%2Fcom.atproto.lexicon.schema%2Forg.stormlightlabs.malfestio.card"
curl "https://lex.desertthunder.dev/api/uri?uri=https%3A%2F%2Fshaggymane.us-west.host.bsky.network%2Fxrpc%2Fcom.atproto.repo.getRecord%3Frepo%3Ddid%253Aplc%253Axg2vq45muivyy3xwatcehspu%26collection%3Dcom.atproto.lexicon.schema%26rkey%3Dorg.stormlightlabs.malfestio.card"
Endpoints#
GET /api/resolve/{nsid} resolves a direct Lexicon NSID.
GET /api/uri/{aturi} resolves an AT URI or HTTPS URL that points at a com.atproto.lexicon.schema record. URL-encode inputs that contain /, ?, or &. The same input can also be passed as GET /api/uri?uri=....
GET /openapi returns the generated OpenAPI document. The spec is generated from the Valibot schemas used to document the API routes.
How it Works#
- Validate the requested NSID.
- Convert its authority to a DNS name and query TXT over DNS over HTTPS.
- Read a
did=...TXT value from_lexicon.<authority-domain>. - Resolve that DID document and find its
#atproto_pdsservice. - Fetch the schema record from the publisher repo:
- collection:
com.atproto.lexicon.schema - record key: the full NSID
- collection:
For example, app.bsky.feed.post resolves through _lexicon.feed.bsky.app, then fetches:
at://did:plc:4v4y5r3lwsbtmsxhile2ljac/com.atproto.lexicon.schema/app.bsky.feed.post
Development#
pnpm install
pnpm dev
By default, the local Worker runs at http://localhost:8787/.
Try a published lexicon:
curl http://127.0.0.1:8787/api/resolve/app.bsky.feed.post
curl http://127.0.0.1:8787/api/resolve/com.atproto.repo.getRecord