agorix
AirdropMarketsCollectionsLeaderboardActivity
Agorix · Decentralized Marketplace
Independent · Resilient · Community-Run

A cross-chain marketplace, run by the community.

Discover, list, and trade across Bitcoin, Ethereum, and Solana on an open, community-run network.

Marketplace
CollectionsMarketsLeaderboardActivity
Network
GovernanceExplorerAirdropDocs
Account
ProfileSettings
Legal
Terms of ServicePrivacy PolicyYour Privacy Choices
agorix.io — Lasting Access
CID: 0xA60R1X · v0.1
AirdropMarketsCollections
D
Protocol Docs
Node ArchitectureGateway Front DoorProtocol ExplorerMesh NetworkingHeartbeat SystemData ShardingSSR & ShortlinksLocal Node Telemetry Rollups
Docs/Network/SSR & Shortlinks
Network

SSR & Shortlinks

Per-URL OG metadata replicated as protocol events, deterministic shortcodes, gateway-side meta injection for crawlers, and three-event lifecycle (UPSERT / EXTEND / TEARDOWN).

#SSR & Shortlinks

Crawlers and chat unfurlers do not run JavaScript. The marketplace is a Next.js single-page application where listings, collections, and profiles are rendered client-side from API responses — which means a vanilla request to /listings/<id> returns the same skeleton HTML regardless of the asset. Without a server-side metadata layer, every shared link would unfurl into the same generic title and image.

The SSR system fixes this by emitting per-URL metadata as signed protocol events, replicating that metadata to every node, and injecting it into the skeleton HTML at the gateway edge for crawler requests.

#The ssrPaths Table

Each entry in ssrPaths represents one renderable URL plus the metadata that should appear when a crawler hits it:

ColumnPurpose
pathThe canonical URL path (primary key)
shortcodeDeterministic shortcode for /s/<code> redirects
ssrTypeDomain tag (LISTING, COLLECTION, PROFILE, etc.) for routing render templates
metaJSONB blob containing title, description, OG image, structured data
stateACTIVE / GONE / EXPIRED
teardownReason / goneUntilSoft-delete state with optional revival timer
expiresAtWhen the path naturally expires (listing TTL, etc.)
versionMonotonic counter so out-of-order events are resolved deterministically
lastEventHashHash of the protocol event that produced the current row

The path itself is the primary key — there is exactly one row per URL.

#Three Protocol Events

SSR state propagates via three Ed25519-signed protocol events, gossiped network-wide like any other event:

EventWhen It FiresEffect
SSR_PATH_UPSERTNew URL becomes renderable, or its metadata changesInserts/updates the ssrPaths row and assigns/keeps the shortcode
SSR_PATH_EXTENDAn existing path's lifetime needs extension (e.g. listing renewed)Pushes expiresAt forward without rewriting the metadata
SSR_PATH_TEARDOWNPath is no longer valid (listing sold/cancelled, profile deleted)Marks state GONE with a reason and an optional grace window

Each event carries the path, a monotonic version, and an emittedAt timestamp. The version field means that even if events arrive out of order across the gossip mesh, every node converges on the same final state — the latest version always wins.

#Deterministic Shortcodes

Every SSR path gets a shortcode derived from the path itself via the protocol-shared shortcodeForPath helper. Because the function is deterministic, every node independently arrives at the same code for the same path without any coordination. /s/<code> lookups resolve to the canonical URL, and click counts are tracked per-shortcode in ssrShortlinks.

A separate ssrShortlinks table holds optional vanity codes owned by a profile. These are the user-created custom slugs ("/s/my-drop") that point at an existing ssrPaths row, with optional metadata overrides. Auto-generated codes live on the ssrPaths row directly; vanity codes are layered on top.

#Gateway Injection

The Rust gateway is the only actor that sees crawler requests directly. When a request arrives:

  • The gateway checks the User-Agent against a crawler list (Twitterbot, Facebook, Slackbot, Discord, search engines)
  • If the request is from a crawler, the gateway looks up the path in its replicated ssrPaths cache
  • The matching meta blob is injected into the skeleton HTML's <head> (title, description, OG tags, structured data, canonical URL)
  • For OG image requests (/_og/:asset), the gateway returns a content-hashed pre-rendered image

Real users never see this path — they get the normal SPA shell and hydrate against the API. Only crawlers receive the injected meta.

#OG Image Rendering

Open Graph images are rendered server-side using resvg (a Rust SVG → PNG renderer). The flow:

  • The node-side emitter composes an SVG template from the asset metadata (image, title, price, chain badge)
  • resvg rasterizes the SVG to PNG
  • The image is content-hashed; the hash becomes the asset path under /_og/:hash.png
  • Subsequent identical requests hit the cache by hash with no re-rendering

Content hashing means image cache invalidation is automatic — change the underlying metadata, the hash changes, the gateway serves the new image.

#Why Protocol Events for SSR

A naive design would have nodes ask each other for SSR metadata over HTTP at request time. That couples crawler latency to peer reachability and introduces a coordination point. Treating SSR state as a first-class protocol event means:

  • Every node has the full SSR table locally — no remote lookup on the hot path
  • Updates replicate at gossip speed (sub-second to all peers)
  • TEARDOWNs propagate as fast as anything else, so stale unfurls cannot persist after a delisting
  • The gateway never trusts a single node's claim about page metadata; it consumes the same gossiped events as every other node
PreviousData ShardingNext Local Node Telemetry Rollups

On this page

  • SSR & Shortlinks
  • The ssrPaths Table
  • Three Protocol Events
  • Deterministic Shortcodes
  • Gateway Injection
  • OG Image Rendering
  • Why Protocol Events for SSR