This document explains how to publish the app.dropanchor.* lexicons so they
can be discovered by tools like glot and other AT Protocol applications.
The Anchor lexicons are currently local only (not published). They work fine for the app but aren't discoverable by external tools.
~/go/bin/glot status lexicons/ # 🟠 app.dropanchor.checkin (local only) # 🟠 app.dropanchor.comment (local only) # 🟠 app.dropanchor.like (local only)
Publishing lexicons enables:
- Discovery by
glotand other lexicon tools - Interoperability with other apps that want to read/write Anchor data
- Validation of records against the published schema
- Documentation for developers building on Anchor
Create a route to serve /.well-known/did.json:
{ "@context": ["https://www.w3.org/ns/did/v1"], "id": "did:web:dropanchor.app", "service": [ { "id": "#lexicon", "type": "LexiconHost", "serviceEndpoint": "https://dropanchor.app/lexicons" } ] }
This tells resolvers that lexicons for dropanchor.app are hosted at
/lexicons.
Serve the lexicon JSON files at paths matching their NSID structure:
| Lexicon | URL |
|---|---|
app.dropanchor.checkin | https://dropanchor.app/lexicons/app/dropanchor/checkin.json |
app.dropanchor.comment | https://dropanchor.app/lexicons/app/dropanchor/comment.json |
app.dropanchor.like | https://dropanchor.app/lexicons/app/dropanchor/like.json |
You can either:
- Copy the files to a static directory
- Serve them directly from the
lexicons/folder in the repo
Add a TXT record to the dropanchor.app domain:
_lexicon.dropanchor.app. IN TXT "did=did:web:dropanchor.app"
This tells lexicon resolvers how to find the DID document for the
app.dropanchor namespace.
After setup, verify with glot:
# Should resolve and show 🟢 (published, matches local) ~/go/bin/glot status lexicons/ # Should fetch and display the lexicon ~/go/bin/glot show app.dropanchor.checkin
Example route handlers for the backend:
// /.well-known/did.json
app.get("/.well-known/did.json", (c) => {
return c.json({
"@context": ["https://www.w3.org/ns/did/v1"],
"id": "did:web:dropanchor.app",
"service": [
{
"id": "#lexicon",
"type": "LexiconHost",
"serviceEndpoint": "https://dropanchor.app/lexicons",
},
],
});
});
// /lexicons/* - serve lexicon files
app.get("/lexicons/*", async (c) => {
const path = c.req.path.replace("/lexicons/", "");
const filePath = `./lexicons/${path}`;
try {
const content = await Deno.readTextFile(filePath);
return c.json(JSON.parse(content));
} catch {
return c.json({ error: "Lexicon not found" }, 404);
}
});
When a tool resolves app.dropanchor.checkin:
- Reverses domain parts:
app.dropanchor→dropanchor.app - Looks up DNS TXT record:
_lexicon.dropanchor.app - Gets DID:
did:web:dropanchor.app - Fetches DID document:
https://dropanchor.app/.well-known/did.json - Finds lexicon service endpoint:
https://dropanchor.app/lexicons - Fetches lexicon:
https://dropanchor.app/lexicons/app/dropanchor/checkin.json
- Community lexicons (
community.lexicon.*) are shared schemas hosted atlexicon.communityfor interoperability between apps - App lexicons (
app.dropanchor.*) are app-specific schemas hosted on your own domain
Anchor uses community lexicons for location data (address, geo, fsq) embedded in the app-specific checkin record.