HTTP API routes and feature controls
The HTTP API is the server-facing boundary for Explorer data that needs shared access, protected provider keys, or server-side chain reads. Its routes validate public inputs, normalize provider responses into small JSON contracts, and apply cache rules so browser views and other clients can use metadata, token data, identity data, chain state, and supply data without calling every upstream service directly. This page complements integration surfaces and MCP service.
API route groups
The route groups expose focused data contracts. Most routes accept a Solana address or a small set of query parameters, reject invalid input before an upstream call, and return cacheable success data when the result is stable.
| Route group | Main purpose | Main upstream or source |
|---|---|---|
/api/metadata/proxy | Fetch token metadata and images through a controlled HTTP proxy | User-provided HTTP or HTTPS resource |
/api/log-drain | Receive deployment log events and forward them to the log store | Vercel log drain and Grafana Cloud Loki |
/api/token-info, /api/token-image/[mintAddress] | Resolve token identity and image links for one or more mints | Unified token list, Solana RPC, and digital-asset data |
/api/token-price/[mintAddress], /api/token-market-data/[address] | Return current price and market facts | Jupiter and CoinGecko |
/api/domain-info/[domain], /api/sns-domains/[address], /api/ans-domains/[address] | Resolve a domain or list wallet-owned domains | Solana name records, Bonfida, and ANS accounts |
/api/verification/* | Report provider-specific token verification or risk results | Jupiter, CoinGecko or GeckoTerminal, and Rugcheck |
/api/search, /api/idl-latest, /api/security-txt, /api/stake-rewards/[address], /api/ping/[network], /api/slot-time, /api/supply | Provide cluster-aware search, program identity, security, stake, network, slot-time, and supply data | Token providers, Solana RPC, Solana program data, Solscan, and Validators App |
The route boundary also keeps provider-specific response shapes out of callers. A caller can use a small result such as { price }, { verified }, { domains }, or { idls } instead of learning each provider's schema. Routes validate provider responses where the result affects trust or display, and they map missing data to an explicit empty or negative result when that is safe.
Metadata proxy
The metadata proxy gives the browser a controlled path to remote token metadata and images. It accepts one encoded uri, allows only HTTP and HTTPS resources, limits fetch time and response size, and accepts JSON, JSON-like plain text, or image content before returning JSON or binary data with browser-safe headers. The route is available only when NEXT_PUBLIC_METADATA_ENABLED is set to true. app/…/route.ts• L18-45 app/…/fetch-resource.ts• L11-15
The proxy treats the remote resource as untrusted content. For each redirect hop, it resolves the host, rejects private or local addresses, and reuses the approved addresses for the connection. This closes the gap in which a host could resolve to a public address during validation and to a private address during connection. It also stops oversized bodies during both the declared-length check and the body read. Success responses use a browser cache, while errors use a short private cache so a failed image request can be checked without downloading the resource again. app/…/config.ts• L7-45 app/…/fetch-resource.ts• L17-24 app/…/ip.ts• L37-70
The fetch lifecycle drains successful response bodies before it closes per-hop connection resources. It can stop on a failed response or redirect without waiting for a stalled body. This keeps large valid responses complete while preventing unusable upstream responses from holding the request open. app/…/fetch-resource.integration.spec.ts• L98-136
Upstream failures use a stable proxy status and error code. Known upstream statuses pass through when they have the same meaning to the caller, while other upstream errors become 502; a 429 can carry its Retry-After value. The route logs these errors by class, keeps ordinary remote failures below exception level, and reports proxy faults or important size and reachability signals for diagnosis. The same fetch and logging surface is available to in-process callers without an HTTP round trip. app/…/upstream-status.ts• L3-14 app/…/errors.ts• L1-67 app/…/log-proxy-error.ts• L14-53 app/…/index.ts• L1-4
The endpoint contract tests cover the route's feature gate, URI validation, redirect safety, status mapping, cache headers, retry hints, logging, and encoded-URI round trips. app/…/endpoint.test.ts• L34-350
References: app/…/route.ts• L18-57 app/…/config.ts• L7-74 app/…/fetch-resource.ts• L17-24 app/…/fetch-resource.ts• L68-131 app/…/ip.ts• L37-70 app/…/read-body-with-limit.ts• L16-27 app/…/upstream-status.ts• L3-14 app/…/errors.ts• L1-67 app/…/log-proxy-error.ts• L14-53 app/…/index.ts• L1-4 app/…/fetch-resource.integration.spec.ts• L98-136 app/…/endpoint.test.ts• L34-350
Log drain
The log-drain route receives Vercel's deployment log events and forwards them to Grafana Cloud Loki. Vercel uses a verification response when it checks the drain URL, while event delivery uses a separate shared secret so only the configured drain can submit logs. app/…/route.ts• L24-53
The route treats the request body as newline-delimited JSON. It skips blank or malformed lines, groups valid events by source and bounded severity, and keeps each original event as a searchable JSON line in Loki. It returns success only after Loki accepts the batch; missing credentials, transport errors, and rejected pushes return a retryable upstream failure so the delivery system does not treat lost logs as delivered. app/…/route.ts• L60-135
References: app/…/route.ts• L24-53 app/…/route.ts• L60-135 app/…/route.spec.ts• L30-123
Token and market data
Token routes turn a mint address into display data. /api/token-info accepts a single address or a de-duplicated batch in a POST body, validates the cluster and optional genesis hash, and returns an array in content for both request shapes. It can optionally fill list gaps with on-chain Metaplex metadata when the caller sets includeOnChainFallback to true; custom clusters skip that fallback because the server does not accept a caller-supplied RPC endpoint. The upstream list read has an abort bound and a route-duration backstop. /api/token-image/[mintAddress] returns the image link from digital-asset data, requires a known non-custom cluster, and caches only a found image. app/…/route.ts• L19-25 app/…/route.ts• L44-102 app/…/route.ts• L122-171 app/…/route.ts• L18-50 app/…/route.spec.ts• L31-122
The token-info route keeps an empty list distinct from an upstream outage. Invalid JSON, invalid addresses, unsupported cluster identity, and requests above the de-duplicated address limit return 400; an empty valid request returns an empty content array. A total token-list failure returns 503 so the result is not cached as a valid empty response, while a partial provider failure keeps the usable results and logs the dropped entries. A genuine all-not-found response remains a successful empty result. The list lookup has a one-hour data-cache window and an invocation time backstop. app/…/route.ts• L44-102 app/…/route.ts• L105-120 app/…/config.ts• L7-14 app/…/route.spec.ts• L262-342
Price and market routes use different provider roles. /api/token-price/[mintAddress] returns a current USD price from Jupiter and returns { price: null } when Jupiter has no usable price. /api/token-market-data/[address] returns a wider CoinGecko view such as market cap, rank, volume, and 24-hour change. Market data can still return a price when optional market fields are absent, but it returns no market data when no USD price exists. Both routes validate the mint or address and return null or an error when the provider has no usable data. app/…/route.ts• L9-15 app/…/route.ts• L25-81 app/…/route.ts• L26-101 app/…/route.test.ts• L34-89
These routes use cache headers to reduce repeated provider calls. A valid price or a valid no-price result is cacheable, but provider errors, missing configuration, and response-shape failures are not treated as fresh data. The price route rejects non-positive prices and ignores data for other mints in a provider response. Token batch size and price cache duration are part of the route contract. app/…/config.ts• L5-12 app/…/config.ts• L1-7 app/…/route.spec.ts• L46-170
References: app/…/route.ts• L19-25 app/…/route.ts• L44-102 app/…/route.ts• L105-171 app/…/config.ts• L7-14 app/…/route.spec.ts• L46-342 app/…/route.ts• L18-50 app/…/route.ts• L9-15 app/…/route.ts• L25-81 app/…/config.ts• L1-7 app/…/route.spec.ts• L34-170 app/…/route.ts• L26-101 app/…/route.test.ts• L34-160
Domain resolution
Domain routes support two directions of lookup. /api/domain-info/[domain] maps a domain name to its name account and owner. /api/sns-domains/[address] and /api/ans-domains/[address] map a wallet to the domains it owns. The resolver selects SNS for .sol names and ANS for other supported name records. app/…/route.ts• L17-35 app/…/resolve-domain.ts• L22-29
The wallet-list routes use different sources because the two name systems expose ownership in different ways. SNS names come from the Bonfida service and are converted to name-account addresses. ANS names come from on-chain account scans and reverse records. An empty ANS result is a successful empty list, while an unavailable SNS list is reported as not found; provider failures remain uncached errors. A domain that is valid but not found returns a cached null, while invalid domain text is rejected before resolution. app/…/fetch-sns-domains.ts• L9-27 app/…/fetch-ans-domains.ts• L51-67 app/…/route.spec.ts• L46-82 app/…/route.spec.ts• L46-73 app/…/route.spec.ts• L23-81
References: app/…/route.ts• L17-35 app/…/route.spec.ts• L23-81 app/…/route.ts• L15-36 app/…/route.spec.ts• L30-82 app/…/route.ts• L15-33 app/…/route.spec.ts• L30-73 app/…/resolve-domain.ts• L22-52 app/…/fetch-sns-domains.ts• L9-27 app/…/fetch-ans-domains.ts• L51-67
Verification providers
Verification routes expose separate signals rather than one universal trust score. Jupiter and CoinGecko report provider verification flags. Rugcheck reports a normalized token risk score. The shared token-verification feature can combine these provider results while keeping each provider's failure and data rules at its own route. app/…/route.ts• L15-20 app/…/route.ts• L30-76 app/…/route.ts• L18-73 app/…/route.ts• L25-83
The routes protect provider keys on the server and check address format before spending provider or RPC quota. CoinGecko uses its keyed service when COINGECKO_API_KEY is present and falls back to the keyless GeckoTerminal endpoint when it is absent. A provider response must match the expected shape before it becomes a positive signal. Missing verification fields become false, optional CoinGecko coin IDs are omitted when absent, and Rugcheck's provider score becomes the small { score } result. Timeouts use a short negative cache. Rate limits, missing keys, and unusable responses keep distinct HTTP outcomes so callers can avoid treating an outage as a real verification result. app/…/route.ts• L32-40 app/…/route.ts• L27-45 app/…/route.ts• L48-85 app/…/route.ts• L34-40 app/…/route.ts• L51-96 app/…/route.test.ts• L32-85 app/…/route.test.ts• L31-124 app/…/route.test.ts• L31-114
Rugcheck uses a provider-specific no-data mapping because that service reports some missing or unprocessable tokens as 400 with an error message. Known messages become 404 or 422 no-data results instead of provider faults. Other failures pass through as errors. app/…/route.ts• L51-70 app/…/route.ts• L100-125 app/…/route.test.ts• L38-62
References: app/…/route.ts• L15-20 app/…/route.ts• L30-87 app/…/route.test.ts• L25-124 app/…/route.ts• L18-111 app/…/route.test.ts• L28-149 app/…/route.ts• L25-125 app/…/route.test.ts• L25-131
Chain and program lookups
Chain lookup routes provide data that must be read against a selected network or a protected server-side provider. /api/search resolves text and address queries against a cluster, normalizes discovery results, and can fill a missing token icon from digital-asset data. /api/idl-latest resolves program interface descriptions. /api/security-txt reads a program's security contact data. /api/stake-rewards/[address] returns lifetime stake rewards on mainnet. /api/ping/[network] returns validator latency and throughput samples for mainnet. /api/slot-time estimates slot duration from recent performance samples. /api/supply returns cluster supply data from a finalized ledger view. app/…/route.ts• L36-92 app/…/route.test.ts• L85-275 app/…/route.ts• L48-96 app/…/route.ts• L23-69 app/…/route.ts• L20-59 app/…/route.ts• L21-61
Cluster identity is part of the data contract. Known clusters map to fixed server RPC endpoints or chain IDs. Search accepts a custom cluster only when its genesis hash identifies one of the supported networks; otherwise it returns no results instead of guessing the network. Other server-side lookups refuse clusters that have no approved endpoint or chain identity. The supply and slot-time routes accept only the canonical ?cluster=<value> query shape. This prevents a result from one network being shown as a result from another and keeps alternate URL spellings from creating unbounded ledger or RPC work. app/…/route.ts• L50-84 app/…/get-chain-id.ts• L19-32 app/…/chain-id.ts• L1-12 app/…/route.ts• L20-49 app/…/route.ts• L21-51
Search limits input length and can remove unverified tokens through NEXT_PUBLIC_SEARCH_DISABLE_UNVERIFIED_TOKENS. For a custom cluster, the route uses the supplied genesis hash to select a supported network before it queries token discovery. An unknown genesis hash returns an empty result with no-store headers. This keeps search results tied to a known chain while still allowing the shared search interface to handle recognized custom-cluster requests. app/…/route.ts• L12-33 app/…/route.ts• L41-83 app/…/route.test.ts• L183-275
Some lookups are deliberately limited to one network. Stake rewards are mainnet-only because the upstream index covers only mainnet. The route checks the feature state and the cluster before it makes a metered provider request. Supply data returns large quantities as decimal strings and omits the non-circulating account list because callers do not need it. Supply also uses a longer shared cache because each miss scans ledger state. Slot-time data uses a short shared cache because the estimate changes at epoch boundaries and many clients ask for the same value. RPC timeouts and retryable failures remain distinct from a successful measurement so callers can retry without treating an outage as a reading. app/…/route.ts• L24-68 app/…/config.ts• L9-17 app/…/route.ts• L52-97 app/…/config.ts• L11-19 app/…/route.ts• L21-99 app/…/route.spec.ts• L65-109
IDL and security lookups classify transient RPC failures as retryable upstream errors. A program with no published security data is still a successful lookup with no securityTxt value. The ping route validates the returned provider shape and reports unsupported networks or bad upstream data without caching them as valid measurements. app/…/route.spec.ts• L68-160 app/…/route.spec.ts• L53-109 app/…/route.spec.ts• L17-87
The following diagram shows the common boundary from an external request to a normalized result or a safe failure.
flowchart LR
C[Browser or integration client] --> R[HTTP route]
R --> V[Validate address, query, or cluster]
V --> S{Route enabled and configured?}
S -->|No| F[Explicit HTTP error]
S -->|Yes| U[Provider or Solana RPC]
U --> N[Validate and normalize response]
N --> O[Cacheable JSON or binary result]
U --> E[Timeout, rate limit, or bad data]
E --> F
References: app/…/route.ts• L36-92 app/…/route.test.ts• L47-275 app/…/route.ts• L48-96 app/…/route.spec.ts• L40-160 app/…/route.ts• L23-69 app/…/route.spec.ts• L25-109 app/…/route.ts• L24-70 app/…/route.ts• L30-79 app/…/route.spec.ts• L17-87 app/…/route.ts• L20-99 app/…/route.ts• L21-99 app/…/route.spec.ts• L56-355 app/…/get-chain-id.ts• L19-32
Feature controls
Feature controls operate at two levels. Environment gates turn optional application capabilities on or off at runtime. The feature-gate data set describes Solana protocol features and their activation state on devnet, testnet, and mainnet. Keeping these roles separate prevents a deployment switch from being confused with an on-chain protocol state.
Environment gates
Environment gates protect features that may need provider keys, special capacity, or a staged release. The metadata proxy checks NEXT_PUBLIC_METADATA_ENABLED. Stake rewards checks its server-side enablement before it spends RPC or Solscan quota. Feature-gate Open Graph output checks FEATURE_GATE_OG_ENABLED. app/…/route.ts• L18-21 app/…/route.ts• L24-33 app/…/env.ts• L1-9
Configuration also selects safe provider behavior. A CoinGecko key selects the higher-limit Pro API while its absence uses the public fallback. Jupiter price and verification routes and Rugcheck require their server keys before they call protected services. Metadata limits and timeouts use positive integer overrides and fall back to safe defaults when values are missing or malformed; malformed values are reported so a bad deployment does not silently disable a guard. Feature-gate URLs use a configured base URL when present and otherwise use the Explorer base URL. The log drain uses separate Vercel verification and delivery secrets plus Grafana Loki credentials, and it must not forward events when that destination is not configured. app/…/route.ts• L108-114 app/…/route.ts• L17-35 app/…/route.ts• L22-40 app/…/route.ts• L98-110 app/…/route.ts• L34-40 app/…/config.ts• L7-37 app/…/env.ts• L7-9 app/…/route.ts• L48-53 app/…/route.ts• L96-105
References: app/…/route.ts• L18-21 app/…/route.ts• L24-56 app/…/env.ts• L1-9 app/…/route.ts• L108-114 app/…/route.ts• L17-35 app/…/route.ts• L22-40 app/…/route.ts• L98-110 app/…/route.ts• L34-40 app/…/config.ts• L7-37 app/…/route.ts• L24-53 app/…/route.ts• L96-105
Protocol feature-gate data
The protocol feature-gate data set is a shared view of Solana feature activation. Each record links a feature account to its proposal data, required client versions, and activation epochs for the supported clusters. A non-null activation epoch means the feature is active on that cluster; invalid or unsupported cluster values are not treated as active. app/…/feature-gates-schema.ts• L27-46 app/…/is-feature-activated.ts• L5-15
Consumers use the data to split features into active and upcoming groups. An upcoming feature is active on another supported cluster but not on the selected cluster. The full feature-gates page shows those groups for standard clusters, links each feature to its account page, and links activation epochs to epoch views. The smaller upcoming-feature section applies a readiness filter for each standard cluster and omits custom clusters. app/…/partition-features.ts• L28-72 app/…/filter-upcoming-features.ts• L7-25 app/…/FeatureGatesView.tsx• L43-69 app/…/UpcomingFeatures.tsx• L17-31
The feature-gates page orders activated features by their activation epoch and lets the reader reverse that order through the URL. Long upcoming lists open with a short preview and a control to show the remaining rows. Cluster changes reset that preview state. The same filtered upcoming data can appear in a smaller page section that links to the full feature-gates view. app/…/sort-activated-features.ts• L7-13 app/…/preview-upcoming-features.ts• L1-13 app/…/FeatureGatesView.tsx• L83-141 app/…/UpcomingFeatures.tsx• L17-54
SIMD entries are paired with their proposal links before rendering. A feature detail view can fetch the linked proposal text from the Solana improvement-document repository. A successful fetch returns markdown; a failed or unavailable fetch keeps the original link and reports that the proposal text is unavailable. app/…/partition-features.ts• L92-101 app/…/fetch-feature-gate-information.ts• L11-47 app/…/SimdLinks.tsx• L19-29
References: app/…/feature-gates-schema.ts• L27-56 app/…/server.ts• L1-13 app/…/is-feature-activated.ts• L5-15 app/…/partition-features.ts• L27-101 app/…/filter-upcoming-features.ts• L7-25 app/…/preview-upcoming-features.ts• L1-13 app/…/sort-activated-features.ts• L7-13 app/…/fetch-feature-gate-information.ts• L11-47 app/…/FeatureGatesView.tsx• L43-141 app/…/UpcomingFeatures.tsx• L17-54 app/…/ClusterEpoch.tsx• L10-23 app/…/SimdLinks.tsx• L19-29
Feature-gate update pipeline
The update script keeps the checked-in feature-gate data aligned with protocol schedules, proposal documents, and live chain state. It reads the existing data, imports pending features from the Agave schedule, resolves SIMD proposal links, fills missing links and descriptions, checks activation epochs on devnet, testnet, and mainnet, validates the result, and writes the data once. The three cluster checks run in parallel while requests within one cluster stay sequential. scripts/update-feature-gates.ts• L4-20 scripts/update-feature-gates.ts• L44-100 scripts/update-feature-gates.ts• L145-176 scripts/…/schedule.ts• L19-65 scripts/…/simd-proposals.ts• L13-23 scripts/…/simd-summary.ts• L13-20
The schedule import selects sections by their Pending name and checks the fields it reads. It ignores unrelated extra columns but fails when a required field changes. SIMD links stay aligned with their SIMD numbers. If a proposal lookup fails, a later run can fill empty link slots without replacing links that already exist. Descriptions come from the first usable paragraph under a Summary-like heading in the linked proposal and remain short enough for the shared data view. scripts/…/schedule.ts• L38-65 scripts/…/schedule.ts• L119-161 scripts/…/simd-proposals.ts• L44-89 scripts/…/simd-summary.ts• L35-70 scripts/…/schedule.spec.ts• L29-79
The normal daily mode checks devnet and testnet rows that are not active on mainnet. It checks mainnet after devnet and testnet are active. The --refresh-activated mode checks every feature on every cluster and clears stored activation values when the chain confirms that an account is missing or not active. The RPC probe distinguishes missing, unactivated, activated, and unreachable accounts. Short or malformed account data is treated as unactivated rather than as an activation epoch. An unreachable RPC keeps the stored value because a network fault is not evidence that a feature changed. Rate-limit responses are retried, while other RPC failures are reported as unreachable. scripts/update-feature-gates.ts• L21-29 scripts/update-feature-gates.ts• L61-100 scripts/…/rpc.ts• L11-27 scripts/…/rpc.ts• L49-89 scripts/…/rpc.spec.ts• L65-113 scripts/…/merge.ts• L27-45
The JSON file is a contract between the update process and its readers. The write boundary validates feature records and emits a stable ASCII form. This keeps bad upstream data from becoming a silent change in the feature view and keeps generated file changes easy to review. scripts/…/feature-store.ts• L17-41
The scheduled GitHub workflow builds the workspace packages, runs the normal mode each day, and opens a signed pull request for the generated change. The workspace build uses a temporary pnpm release-age quarantine for selected package releases. The release-age test checks that named exemptions expire on the recorded date, so this build safeguard does not remain after its upgrade window. .github/…/update-feature-gates.yml• L1-44 pnpm-workspace.yaml• L36-45 scripts/…/release-age-exclusions.spec.ts• L6-34
The feature-gate tests cover the schedule and proposal mapping, summary extraction, on-chain result classes, merge rules, file validation, and the plain Node module graph used by the cron. The module-graph check prevents a server-only import marker from stopping the cron before the pipeline starts. Committed snapshots represent the live schedule and proposal listing; the fixture refresh script updates those snapshots after an upstream format change. scripts/…/refresh-test-fixtures.ts• L3-13 scripts/…/scrape-pipeline.spec.ts• L8-14 scripts/…/module-graph.spec.ts• L19-43
References: scripts/update-feature-gates.ts• L44-56 scripts/update-feature-gates.ts• L61-100 scripts/update-feature-gates.ts• L145-181 scripts/…/schedule.ts• L38-65 scripts/…/simd-proposals.ts• L44-89 scripts/…/simd-summary.ts• L35-70 scripts/…/rpc.ts• L49-89 scripts/…/rpc.spec.ts• L65-113 scripts/…/schedule.spec.ts• L29-154 scripts/…/merge.ts• L27-45 scripts/…/feature-store.ts• L17-41 scripts/…/refresh-test-fixtures.ts• L21-57 scripts/…/module-graph.spec.ts• L29-42 .github/…/update-feature-gates.yml• L1-44 scripts/…/release-age-exclusions.spec.ts• L6-34
Update scripts
The update scripts turn upstream program data, route data, and build output into checked-in artifacts. They make these artifacts repeatable and validate them before downstream pages, search, or release checks use them.
Verified program catalog
The verified-program update builds a compact catalog of Solana programs that OSecure confirms as verified. It enriches each address with a name from the program IDL or repository URL, keeps a safe HTTPS repository link, records the verification time, validates the final records, and refuses to replace the existing catalog when no verified programs remain. scripts/update-verified-programs.ts• L3-12 scripts/update-verified-programs.ts• L89-132
The script uses a mainnet RPC for IDL names and limits provider work with small concurrent batches and retries. It excludes programs whose verification status is false or unavailable. A high status-request failure rate stops the update instead of producing a catalog that looks complete but is not. scripts/update-verified-programs.ts• L82-85 scripts/update-verified-programs.ts• L156-185 scripts/update-verified-programs.ts• L203-224
References: scripts/update-verified-programs.ts• L21-30 scripts/update-verified-programs.ts• L71-85 scripts/update-verified-programs.ts• L89-132 scripts/update-verified-programs.ts• L156-185 scripts/update-verified-programs.ts• L203-224
Sitemap generation
The sitemap update builds the public sitemap index from the generated route table and the known mainnet program addresses. It writes separate sitemaps for static pages and account pages, excludes API and parameterized routes, omits routes that should not be announced yet, and validates every XML document before writing it. scripts/update-sitemap.ts• L3-16 scripts/update-sitemap.ts• L72-103 scripts/update-sitemap.ts• L146-160
The account list joins deployed mainnet program IDs with loader, special, sysvar, and token IDs. The static list comes from bench/BUILD.md, so route changes must first appear in the build report before they can appear in the sitemap. scripts/update-sitemap.ts• L52-65 scripts/update-sitemap.ts• L107-160
References: scripts/update-sitemap.ts• L30-68 scripts/update-sitemap.ts• L72-103 scripts/update-sitemap.ts• L107-160 scripts/update-sitemap.ts• L197-227
Build route reports
The build-info tools provide one shared view of route shape and client size. The generator runs the production build, reads its route and bundle manifests, and writes a markdown table that marks routes as static or dynamic and reports rounded gzip sizes. API routes have no client bundle size, and the generator keeps the prior displayed cell when a change is only rounding noise. scripts/update-build-info.js• L22-47 scripts/update-build-info.js• L108-134 scripts/update-build-info.js• L141-205 scripts/update-build-info.js• L247-305
The diff tool compares a fresh table with a base or committed table. It reports added, removed, changed, and static-to-dynamic routes while suppressing changes within one display step. The report script prepares a base table from the selected remote ref. CI comments the report only when the completed run has an artifact and an open pull request whose head matches the run exactly. scripts/build-info-diff.ts• L1-13 scripts/build-info-diff.ts• L69-107 scripts/build-info-report.sh• L1-24 scripts/build-info-locate-pr.mjs• L3-31
The build-info check is a freshness gate. It requires byte equality between the committed table and a fresh build, so route changes, real size changes, and stale generated prose cannot pass unnoticed. The build-info tests protect the size-rounding, diff, stale-table, and exact pull-request matching rules. scripts/build-info-diff.ts• L182-217 scripts/…/update-build-info.spec.ts• L3-55 scripts/…/build-info-diff.spec.ts• L92-217 scripts/…/build-info-locate-pr.spec.ts• L40-78
References: scripts/update-build-info.js• L22-47 scripts/update-build-info.js• L108-205 scripts/update-build-info.js• L247-305 scripts/build-info-diff.ts• L69-107 scripts/build-info-diff.ts• L182-217 scripts/build-info-report.sh• L8-23 scripts/build-info-locate-pr.mjs• L3-31 scripts/…/update-build-info.spec.ts• L3-55 scripts/…/build-info-diff.spec.ts• L92-217 scripts/…/build-info-locate-pr.spec.ts• L40-78
Change checklist
When these files or sections are changed, remember to consider these:
- A metadata proxy change must preserve the HTTP and HTTPS boundary, per-hop public DNS check, pinned connection addresses, redirect limit, body-size limit, and timeout behavior.
- A metadata proxy status change must keep the stable client status text, error code, upstream-status mapping,
Retry-Afterhandling, and log policy aligned. - A metadata proxy export change must keep the route and in-process callers on the same fetch, status, configuration, and logging contract.
- A provider response change must be reflected in the route's normalized JSON contract and its response-shape validation.
- A token-info request or fallback change must preserve the single-address and batch forms, de-duplication before the request cap, cluster validation, the upstream abort bound, and the distinction between a partial result, an all-not-found result, and a total upstream outage.
- A price or verification provider change must preserve address validation, server-side key use, response-shape checks, normalized fields, and the cache policy for valid data versus errors.
- A CoinGecko verification change must keep keyed Pro and keyless GeckoTerminal selection aligned with the shared
{ verified, coinGeckoId? }contract. - A Rugcheck change must preserve the mapping of known provider no-data messages to
404or422and must not turn them into a false risk score. - A search change must preserve the unverified-token gate, missing-icon enrichment, custom-cluster genesis check, and no-store behavior for unresolved custom clusters.
- A log-drain change must preserve Vercel's verification response, delivery-secret check, bounded Loki labels, original event lines, and retryable failure status.
- A new cluster-aware route must define how known, custom, and unsupported clusters map to server RPC URLs or chain IDs. Do not let a caller select a server RPC URL.
- A supply or slot-time route change must preserve the canonical query contract and must not allow caller-controlled RPC endpoints.
- A new provider key or optional service must define its missing-key response before any metered upstream call.
- A cache-header change must keep successful data separate from errors and missing data. For supply, review the shared cache cost because each miss reads ledger state. For slot-time, review the freshness window because many clients share the result.
- A feature-gate field change must update the schema, the update writer, and every reader that uses activation or proposal data.
- A feature-gate view change must preserve the distinction between activated and upcoming records, the supported-cluster rule, the cluster-specific compact upcoming filter, the URL sort state, and the proposal-link fallback when proposal text is unavailable.
- A change to feature-gate refresh rules must preserve the distinction between the daily incremental run and
--refresh-activated. - A change to the generated feature-gate file must preserve the workflow's package-build, validation, and signed pull-request path.
- A temporary package release-age exclusion must update its expiry check so the exclusion does not outlive the related upgrade.
- A verified-program catalog change must keep the OSecure status filter, safe repository URL rules, output schema, and empty-result abort aligned.
- A sitemap route change must preserve the dependency on bench/BUILD.md, the exclusion of API and parameterized routes, and XML validation for all three outputs.
- A build-info change must keep route manifests, bundle statistics, rounded cells, freshness checks, and bundle reports on the same table format.
- A build-info workflow change must keep report comments tied to the exact run head and its matching open pull request.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
NEXT_PUBLIC_METADATA_ENABLED is not true | Metadata and image proxy requests return 404 | Check the deployment gate before enabling clients that build proxy URLs |
| A metadata size or timeout override is malformed | The proxy uses its safe default and reports the bad setting | Keep overrides as positive integers |
| A metadata redirect resolves to a private address or changes its DNS answer after validation | The proxy refuses the remote resource | Validate every hop and use the pinned lookup supplied by the safe DNS check |
| An upstream response body stalls after a failed response or redirect | The proxy can return without waiting for the body to end | Keep early error and redirect handling separate from successful body draining |
| An upstream response body is closed before a successful large body is drained | Valid metadata can be truncated or fail to parse | Close per-hop connection resources only after successful body processing |
| A metadata upstream returns an unlisted status | The proxy returns 502 instead of passing through an ambiguous upstream status | Keep the upstream status map aligned with the client contract |
A metadata upstream returns 429 with Retry-After | The proxy returns 429 and gives the client the upstream retry hint | Preserve the response header when mapping rate limits |
| A metadata body exceeds the declared or streamed size limit | The proxy returns 413 and does not complete the oversized fetch | Keep both the header pre-check and streamed byte limit active |
| The log-drain delivery secret is wrong or absent | Vercel cannot deliver logs, or the route reports a server configuration error | Keep VERCEL_DRAIN_SECRET aligned with the Vercel drain configuration |
| Grafana Loki credentials are absent or Loki rejects the batch | The route returns 502 and logs the failure to Sentry so delivery can retry | Configure GRAFANA_LOKI_URL, GRAFANA_LOKI_USER, and GRAFANA_LOKI_TOKEN |
| A required Jupiter, Rugcheck, or price provider key is absent | The protected route returns a configuration error without a provider call | Configure the required server secret; CoinGecko verification instead uses its documented keyless fallback |
| A provider returns a changed or invalid schema | The route returns an error or a negative result instead of exposing untrusted fields | Update the schema and normalized contract together |
| Jupiter or Rugcheck returns a timeout | The route returns a short-lived retryable timeout result instead of a cached verification or score | Keep the upstream timeout and error-cache policy aligned |
Rugcheck returns a known no-data error in a 400 body | The route returns 404 or 422 no-data status | Keep the provider message map and its tests aligned |
| The token list provider fails for every requested mint | A valid empty token response could be mistaken for a real not-found result and cached | Preserve the 503 total-outage response and keep partial results separate |
| A token-info request exceeds the de-duplicated address limit or uses an unsupported cluster | The route returns 400 before the token lookup | De-duplicate addresses first and send a supported cluster or matching genesis hash |
| The token list call exceeds its abort or route-duration budget | The route returns an unavailable response instead of waiting without a bound | Keep the upstream signal and maxDuration backstop aligned with the provider call |
| On-chain token fallback is requested for a custom cluster | Missing tokens are not filled from Metaplex | Use a supported server-known cluster when the fallback is required |
| A domain input is invalid | The route returns 400 without spending provider or chain work | Validate the domain or wallet address before resolution |
| SNS returns no domain list | The wallet route returns 404 with no-store data | Keep SNS not-found distinct from a successful empty ANS list |
| The supply request has an extra query parameter or a non-canonical encoding | The route returns 400 before starting a ledger scan | Send exactly ?cluster=<value> |
| A supply value is outside the valid range or cannot be trusted | The route returns a retryable failure instead of caching a false ledger result | Validate the finalized values and keep large integers as decimal strings |
| A custom search cluster lacks a recognized genesis hash | Search returns an empty result rather than guessing the network | Send a supported cluster or a genesis hash for a supported network |
| A custom cluster is sent to token-image lookup | The route refuses the request instead of using an untrusted endpoint | Use a supported server-known cluster for image lookup |
| Search receives no Jupiter key | Search returns an empty token list without a provider request | Configure the search key when token discovery is required |
| A search result omits verification while unverified tokens are disabled | The token is filtered out | Treat only explicit verified results as eligible when the gate is on |
| A slot-time query uses an extra parameter or a non-canonical encoding | The route returns 400 before it reads performance samples | Send exactly ?cluster=<value> |
| The slot-time RPC times out or returns a retryable error | The route returns 504 or 503 with an error cache policy instead of a stale measurement | Keep the server RPC reachable and let the client retry the failed read |
| Ping receives an unsupported network or a non-array payload | The route returns an uncached error instead of publishing a false measurement | Restrict the route to supported network names and validate the provider shape |
| An IDL or security lookup gets a transient RPC failure | The route returns a retryable 502 rather than a false empty result | Preserve transient error classification and client retry behavior |
| A supply or other cluster has no approved endpoint | The route rejects the request or returns a configuration error | Configure a known server-side cluster endpoint and never pass a caller URL |
| A custom cluster opens the feature-gates page | The page cannot enumerate gates for that cluster | Keep the custom-cluster state explicit and do not start epoch or slot-time reads |
| A feature-gate consumer uses the full upcoming list without its cluster filter | The compact view can show features that are not ready for that cluster | Apply the cluster-specific upcoming rules before rendering the compact section |
| A feature-gate proposal fetch fails or returns a non-success response | The feature remains usable but its proposal text is unavailable | Keep the original proposal URL and render an unavailable result rather than markdown text |
| The feature-gate schedule has no pending section or a required field changes name | The refresh stops before it can write a misleading data set | Keep the upstream shape check and review schedule changes before updating the parser |
| The SIMD proposal listing is unavailable | New rows can lack links and existing empty link slots remain empty for that run | Let a later run back-fill only empty slots and never replace existing links |
| A feature-gate RPC is unreachable | The stored activation value remains in place | Treat unreachable as a transient error; use --refresh-activated only for confirmed missing or unactivated accounts |
| A feature-gate record fails validation | The update cannot write a new data set | Fix the source or merge result before the generated pull request is accepted |
| A short or malformed feature account is treated as active | An invalid activation state can enter the shared feature view | Treat incomplete account data as unactivated and require a valid activation slot |
| The daily feature-gate refresh checks only pending rows after a stale activation value | An old activation epoch can remain until a full refresh | Use --refresh-activated when repairing or auditing stored activation state |
| A pipeline module imports a server-only marker under plain Node | The scheduled update can fail before it reaches live RPC or GitHub | Keep the plain-Node module-graph check passing |
| A release-age exemption remains after its expiry date | The release-age test fails and the temporary build exception is visible as stale configuration | Remove the exemption or update it only with the matching upgrade rationale and expiry check |
MAINNET_RPC_URL is missing or OSecure status failures exceed half of the catalog | The verified-program update stops without replacing the existing file | Provide the mainnet RPC and investigate the upstream status service before rerunning |
| No program remains verified after status checks | The verified-program update aborts instead of overwriting the catalog with an empty list | Treat an empty verified set as an upstream or data-quality incident |
| bench/BUILD.md is missing or its route table is stale | Sitemap generation cannot reflect the current route set | Run the build-info generator before the sitemap update and commit the matching table |
| A Next.js manifest or bundle-stat shape changes | Build-info generation fails loudly instead of producing an incomplete route table | Update the generator's manifest contract with the Next.js change |
| A fresh build differs from the committed build table | The freshness check fails and the bundle report marks the table stale | Run pnpm build:info and commit the generated bench/BUILD.md |
| A workflow run has no bundle artifact or its PR head no longer matches the run | CI skips the bundle comment instead of commenting on the wrong pull request | Keep the artifact check and exact head, branch, state, and repository match |
Key files
| File | Why to read it |
|---|---|
| app/…/route.ts | Defines the controlled remote-resource boundary and its enablement behavior. |
| app/…/config.ts | Defines metadata limits, timeouts, security headers, and browser cache policy. |
| app/…/fetch-resource.ts | Defines the shared fetch flow and its normalized upstream failures. |
| app/…/ip.ts | Defines the network safety boundary for remote metadata hosts. |
| app/…/errors.ts | Defines the stable error codes and HTTP statuses for proxy callers. |
| app/…/log-proxy-error.ts | Defines logging levels and reporting rules for proxy failures. |
| app/…/index.ts | Defines the in-process surface that reuses proxy behavior without an HTTP round trip. |
| app/…/fetch-resource.integration.spec.ts | Shows the body-drain and stalled-response guarantees of the remote fetch boundary. |
| app/…/endpoint.test.ts | Shows the route-level gate, input, security, status, cache, logging, and URI-preservation contract. |
| app/…/route.ts | Defines the authenticated log-delivery boundary and its Loki forwarding contract. |
| app/…/route.spec.ts | Shows the verification, authentication, grouping, and delivery-failure guarantees for the log drain. |
| app/…/route.ts | Shows the validated single-address and batch token contract, bounded upstream read, outage handling, and optional on-chain fallback. |
| app/…/route.spec.ts | Shows the transport contract for validation, de-duplication, fallback opt-in, and outage versus empty-result behavior. |
| app/…/route.ts | Shows cluster validation and cache behavior for image links. |
| app/…/route.ts | Shows a small protected provider route for current price data and its explicit no-price result. |
| app/…/route.ts | Shows normalization of optional market fields and CoinGecko provider selection. |
| app/…/route.spec.ts | Shows missing-key, provider-error, schema, no-price, timeout, and cache behavior for price data. |
| app/…/route.ts | Shows name resolution from a domain to its owner. |
| app/…/route.spec.ts | Shows the SNS empty-result, cache, validation, and provider-failure contract. |
| app/…/route.spec.ts | Shows the ANS empty-list and failure contract. |
| app/…/fetch-ans-domains.ts | Shows wallet-owned domain lookup from on-chain records. |
| app/…/route.ts | Shows server-keyed provider verification and normalized boolean results. |
| app/…/route.ts | Shows keyed Pro and keyless GeckoTerminal provider selection plus verification normalization. |
| app/…/route.ts | Shows risk-score normalization and provider-specific no-data mapping. |
| app/…/route.test.ts | Shows keyless and keyed provider selection plus negative verification outcomes. |
| app/…/route.test.ts | Shows provider status, schema, timeout, and normalized verification behavior. |
| app/…/route.test.ts | Shows no-data status mapping, schema checks, timeout, and risk-score behavior. |
| app/…/route.ts | Shows cluster-aware token discovery, icon enrichment, and the unverified-token feature gate. |
| app/…/route.test.ts | Shows search validation, keyless behavior, filtering, icon fallback, and custom-cluster routing. |
| app/…/route.ts | Shows a cluster-bound chain data route with canonical input and shared caching. |
| app/…/route.spec.ts | Shows endpoint selection, integer output, deadlines, cache policy, and RPC error classes. |
| app/…/route.ts | Shows a cluster-bound performance estimate with canonical input, RPC error classes, and shared caching. |
| app/…/route.ts | Shows cluster-aware program lookup and retryable RPC errors. |
| app/…/route.ts | Shows canonical program security metadata lookup and transient RPC handling. |
| app/…/route.ts | Shows the supported-network validator statistics route. |
| app/…/get-chain-id.ts | Defines how cluster and genesis data become a supported chain identity. |
| app/…/feature-gates-schema.ts | Defines the shared feature-gate data contract. |
| app/…/partition-features.ts | Defines the activated and upcoming views shared by feature-gate pages. |
| app/…/filter-upcoming-features.ts | Defines cluster-specific filtering for compact upcoming-feature lists. |
| app/…/preview-upcoming-features.ts | Defines the preview and expand behavior for long upcoming lists. |
| app/…/sort-activated-features.ts | Defines the activation-epoch sort used by the feature-gates page. |
| app/…/fetch-feature-gate-information.ts | Defines proposal-text retrieval and the unavailable-proposal result. |
| app/…/FeatureGatesView.tsx | Defines the cluster-aware feature-gates page and its two feature states. |
| app/…/FeatureGateTable.tsx | Defines the shared feature rows, activation links, proposal links, and empty states. |
| app/…/UpcomingFeatures.tsx | Defines the compact upcoming-feature view used outside the full page. |
| scripts/update-feature-gates.ts | Defines the schedule-to-chain-to-file refresh pipeline. |
| scripts/…/schedule.ts | Defines which upstream schedule rows become feature records. |
| scripts/…/rpc.ts | Defines the distinction between active, inactive, missing, and unreachable feature accounts. |
| scripts/…/feature-store.ts | Defines validation and stable writing of the generated feature-gate file. |
| scripts/…/module-graph.spec.ts | Ensures the cron's plain-Node module graph loads before the live update runs. |
| .github/…/update-feature-gates.yml | Defines the scheduled build, update, and pull-request flow. |
| scripts/update-verified-programs.ts | Defines the verified-program catalog refresh and its fail-safe output rules. |
| scripts/update-sitemap.ts | Defines the static-page, account-page, and sitemap-index outputs. |
| scripts/update-build-info.js | Defines the production-build route table and size data used by sitemap and CI reports. |
| scripts/build-info-diff.ts | Defines route-change reports and the committed-table freshness check. |
| scripts/build-info-locate-pr.mjs | Defines how CI selects the exact pull request for a build report comment. |
| pnpm-workspace.yaml | Defines the temporary package release-age quarantine used during workspace builds. |
| scripts/…/release-age-exclusions.spec.ts | Defines the expiry check for temporary package release-age exemptions. |