Introducing a new way to review your PRs.

Read the announcement

solana-foundation / explorer

Explorer for Solana clusters

View on GitHub

23 documents · Updated Nov 23, 2026

docs / search-and-routing

Search and route resolution

Search turns a user's query into a short list of Explorer destinations. It combines known chain names, direct identifiers, external explorer links, remote token data, and feature-gate references, then sends the selected result to the correct view while preserving the relevant cluster. This page complements Discovery and identity and Domains, programs, and security. Server-only search exports keep token discovery and its shared response types behind the server boundary. app/…/server.ts• L1-6

Search surface

Search entry point

The search bar is available in the shared application shell on large and small screens. It waits briefly after the user stops typing before it runs search, so the UI does not start a new lookup for every keystroke. The bar opens a result panel for non-empty input and supports / and mod+k as focus shortcuts. app/layout.tsx• L37-69, app/…/SearchBar.tsx• L15-30, app/…/BaseSearch.tsx• L86-124

When the panel is open, Tab and Shift+Tab move between visible result filters. Escape closes the panel, while the arrow keys can open it when the input is focused. Clearing the input closes the panel and removes focus. app/…/BaseSearch.tsx• L50-83 Search analytics records each completed non-empty query with its result count and group count. It also records the selected result type and verification state. app/…/use-search-analytics.test.ts• L32-114, app/…/SearchBar.test.tsx• L53-88

References: app/layout.tsx• L16-69 app/…/SearchBar.tsx• L15-30 app/…/BaseSearch.tsx• L50-124 app/…/use-search-analytics.test.ts• L32-114 app/…/SearchBar.test.tsx• L53-88

Result groups and filters

Results are grouped by the kind of destination they represent. The panel exposes only groups with results and lets the user narrow them to Tokens, Programs, Feature Gates, or Other. Programs include verified programs and program loaders. Other includes accounts, blocks, domain owners, epochs, name-service accounts, sysvars, and transactions. app/…/filter-tabs.ts• L3-47, app/…/BaseSearch.tsx• L172-233

The filter counts come from the result groups and appear on the filter buttons. When only one non-All group has results, the panel hides All and selects that group. With All selected, token results appear first, domain owners appear next, and feature gates appear last. app/…/filter-tabs.ts• L50-99, app/…/SearchFilters.tsx• L12-39, app/…/BaseSearch.tsx• L176-183

A result can show a name, address, icon, and source-verification mark before selection. If an icon cannot load, the result uses the first letter of its label instead. Verified-build results also warn the user to trust the source code. app/…/SearchResultItem.tsx• L7-35, app/…/SearchResultItem.tsx• L38-56

While a lookup is pending, the panel shows Searching.... An empty completed lookup shows No results found. Selecting an item records the selection, navigates to its path, clears the query, and closes the panel. app/…/SearchBar.tsx• L30-45, app/…/BaseSearch.tsx• L193-231 The search surface shows the loading state during the debounce window for non-blank input. It resets the input after selection or clearing. app/…/SearchBar.test.tsx• L53-64, app/…/SearchBar.test.tsx• L104-163

References: app/…/filter-tabs.ts• L3-99 app/…/BaseSearch.tsx• L176-231 app/…/SearchFilters.tsx• L12-39 app/…/SearchGroupHeading.tsx• L1-6 app/…/SearchResultItem.tsx• L7-56 app/…/SearchBar.tsx• L30-45 app/…/SearchBar.test.tsx• L53-163

Query resolution

Provider tiers

Search providers are small query resolvers that return labeled destinations. The system separates them into local providers for known data, fallback providers for raw input, and remote providers for network-backed data. Higher priority places a provider earlier within its tier, and each tier keeps priorities unique. Feature-gate results rank below block and epoch results because a bare number is more likely to mean a block or epoch. app/…/types.ts• L20-37, app/…/registry.ts• L19-61, app/…/registry.test.ts• L5-37

The search flow runs remote providers at the same time as local providers. It uses fallback providers only when local providers return no results, then combines the results from all completed tiers. A failed provider is logged and removed from the result rather than failing the whole search. app/…/use-search.ts• L38-79

References: app/…/types.ts• L20-37 app/…/registry.ts• L19-61 app/…/use-search.ts• L38-79 app/…/registry.test.ts• L5-37 app/…/use-search.test.ts• L28-200

Lookup context

The search hook trims the query and does not start a lookup for empty input. Each lookup uses the active cluster and genesis hash so that a result matches the selected network. Numeric input also loads the current epoch and adds it to the lookup context, which lets epoch results stay within the current network range. app/…/use-search.ts• L10-35

The current epoch is part of the cached lookup key only for numeric queries. A new epoch can therefore refresh the valid numeric-result range without changing the cache identity of address or signature searches. app/…/use-search.test.ts• L220-253

References: app/…/use-search.ts• L10-35 app/…/use-search.test.ts• L220-253 app/…/provider-test-utils.ts• L1-7

Query classes

The provider set treats a query as a possible name, identifier, number, URL, domain, encoded transaction, or SIMD number. This lets a direct paste reach a useful page without first proving that the value exists on the selected cluster.

Feature-gate search accepts a SIMD number with or without a SIMD prefix and separator. It matches the complete normalized number, returns every gate that carries that number, and does not treat a numeric prefix as a match. This keeps older gates searchable even when their titles do not contain the SIMD number. app/…/feature-gate-search-provider.test.ts• L44-110

Verified program search is limited to the mainnet snapshot. It needs at least two query characters, returns up to ten name or address matches, and excludes programs that already have a known program entry. Matching results lead to verified-build views and carry a verification mark. app/…/verified-programs-search-provider.ts• L18-57

Query shapeDestinationMain condition
Known program, loader, sysvar, special account, or feature gate nameAccount viewThe name or address matches a built-in registry.
Program name or address from the verified-build listVerified-build viewThe snapshot match is on mainnet and is not already a known program.
Valid base-58 public keyAccount viewThe value decodes to a Solana public key.
Valid base-58 transaction signatureTransaction viewThe value decodes to a transaction signature.
Numeric valueBlock view and, when valid, epoch viewThe value is a natural number. An epoch result is limited by the current epoch plus one.
SIMD number or feature-gate titleFeature-gate account viewThe query matches a registry title or its SIMD number.
Valid domain nameDomain owner's account viewThe domain resolves on mainnet.
Token name, ticker, or addressToken account viewRemote token discovery returns a match.
Parseable base64 transactionTransaction InspectorThe input is not base-58 and decodes to a valid transaction.
Supported external explorer URLMatching local viewThe host, route segment, and identifier are recognized.

The same value can produce more than one group. For example, a numeric value can represent both a block slot and an epoch, while a token address can also produce the generic account fallback when local search has no stronger match. A SIMD number can also match a feature gate while remaining a possible numeric query. A valid domain query currently produces a Domain Owners result only; the name-service account result is not shown. app/…/block-search-provider.ts• L15-35, app/…/epoch-search-provider.ts• L16-39, app/…/account-search-provider.ts• L22-48, app/…/transaction-search-provider.ts• L20-46, app/…/base64-tx-search-provider.ts• L27-93, app/…/domain-search-provider.ts• L16-60

References: app/…/program-search-provider.ts• L21-49 app/…/verified-programs-search-provider.ts• L18-57 app/…/provider-test-utils.ts• L1-7 app/…/domain-search-provider.ts• L12-67 app/…/domain-struct.ts• L6-21 app/…/block-search-provider.ts• L15-35 app/…/epoch-search-provider.ts• L16-39 app/…/feature-gate-search-provider.ts• L22-51 app/…/parse-simd-number.ts• L1-17 app/…/feature-gate-search-provider.test.ts• L44-110 app/…/account-search-provider.ts• L22-48 app/…/transaction-search-provider.ts• L20-46 app/…/base64-tx-search-provider.ts• L27-93

Token search API

Token discovery contract

The token search API is the remote part of the search feature. GET /api/search accepts q or query and a cluster slug, then returns normalized token data for the UI to turn into account destinations. It limits very long or empty input and returns an empty successful result instead of calling an upstream service. Server-only exports provide the discovery source, resolver, cache headers, and shared token type to the API layer without exposing them to client code. app/…/route.ts• L12-50, app/…/fetch-token-results.ts• L25-70, app/…/server.ts• L1-6

For supported clusters, the server uses the primary token discovery source and can enrich missing token images from chain asset data. The response is cacheable for a short period, while cluster cases that cannot be safely shared return no-store responses. app/…/resolve-search-tokens.ts• L8-17, app/…/resolve-search-tokens.ts• L31-72, app/…/discover-with-jupiter.ts• L22-75

References: app/…/route.ts• L27-107 app/…/route.test.ts• L47-82 app/…/fetch-token-results.ts• L25-79 app/…/resolve-search-tokens.ts• L31-72 app/…/discover-with-jupiter.ts• L22-71 app/…/server.ts• L1-5

Cluster API behavior

The API resolves the requested cluster before it searches. An unknown cluster is a client error. A custom cluster needs a known genesis hash before the server can use a shared cluster data source, and the experimental SIMD-296 cluster returns no token matches because it has no supported token lists. app/…/route.ts• L50-101

The API identifies whether the trimmed query looks like a public key or general text. A configuration flag can remove unverified primary-source token results. app/…/route.ts• L27-34, app/…/route.ts• L59-83, app/…/resolve-search-tokens.ts• L44-46

References: app/…/route.ts• L27-34 app/…/route.ts• L50-107 app/…/route.test.ts• L183-275 app/…/resolve-search-tokens.ts• L44-46

Route selection

Cluster-aware navigation

Each search result carries a local pathname and may carry its own cluster. Navigation uses the result's cluster when present; otherwise it keeps the current cluster context. Mainnet uses the default URL without a cluster parameter. app/…/types.ts• L3-13, app/…/use-search-navigation.ts• L16-41

When a result contains its own query string, navigation keeps those target parameters and adds the selected cluster. This supports pre-filled Inspector data without replacing it with the parameters from the current page. Ordinary paths retain the current URL parameters. The route parser splits only at the first question mark, so a literal question mark inside a target value remains part of that value. app/…/use-search-navigation.ts• L21-43, app/…/use-cluster-path.ts• L24-38, app/…/use-cluster-path.ts• L50-114, app/…/use-search-navigation.test.ts• L25-85

References: app/…/types.ts• L3-13 app/…/use-search-navigation.ts• L10-45 app/…/use-cluster-path.ts• L24-38 app/…/use-cluster-path.ts• L50-114 app/…/use-search-navigation.test.ts• L25-85

External explorer translation

Pasted links from supported Solana explorers are translated into local Explorer routes. The parser accepts HTTP(S) URLs from Solscan or Orb Markets, maps the known entity segment to an account, transaction, block, or epoch path, and ignores sub-paths after the identifier. app/…/parse-explorer-url.ts• L12-50, app/…/parse-explorer-url.ts• L65-96

The source URL's cluster selects the destination cluster. Missing or unknown external cluster values default to mainnet-beta. Unsupported hosts, protocols, route segments, or missing identifiers produce no search result rather than an unsafe destination. The parser also trims and decodes the identifier and rejects an identifier that is empty after decoding. app/…/parse-explorer-url.ts• L98-124, app/…/explorer-url-search-provider.ts• L15-37

References: app/…/parse-explorer-url.ts• L12-50 app/…/parse-explorer-url.ts• L65-124 app/…/parse-explorer-url.test.ts• L6-203 app/…/explorer-url-search-provider.ts• L15-37 app/…/explorer-url-search-provider.test.ts• L9-60

Redirects and errors

Legacy route redirects

Search normally performs client-side navigation to the result pathname. Legacy page routes can still redirect when an old URL is opened directly. The deprecated Anchor program path sends the user to the generic IDL view for the same address. app/…/page.tsx• L18-25

References: app/…/use-search-navigation.ts• L16-43 app/…/page.tsx• L18-25

Search failure states

Search treats a bad match or an unavailable provider as an empty result so one failing source does not hide valid results from other sources. The API uses a clear client error for an invalid cluster, while unsupported custom-cluster context and SIMD-296 use successful empty responses. A route that does not exist reaches the shared Page not found screen. app/…/use-search.ts• L64-79, app/…/route.ts• L52-75, app/…/route.ts• L86-97, app/not-found.tsx• L1-10

Domain search adds its own guards to this model. It accepts only a valid domain name on mainnet, stops the lookup after five seconds, and checks the response before it creates a Domain Owners result. A failed request, non-success response, null result, or malformed owner data therefore behaves like no domain match. app/…/domain-search-provider.ts• L10-67, app/…/resolved-domain-info-schema.ts• L4-11

If a rendered page throws after navigation, the application error boundary shows Something went wrong and offers a retry. These states separate “the query found no destination” from “the selected page failed to render.” app/error.tsx• L9-17

References: app/…/use-search.ts• L64-79 app/…/domain-search-provider.ts• L10-67 app/…/domain-search-provider.test.ts• L72-122 app/…/route.ts• L43-57 app/…/route.ts• L61-97 app/…/route.test.ts• L236-275 app/not-found.tsx• L1-10 app/error.tsx• L9-17

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep provider group labels aligned with the filter groups. A new label can make a valid result invisible to a filter.
  • Keep the filter's hidden-All and group-order rules aligned with the groups that the UI can display. A single result category should not leave an invalid active tab.
  • Keep keyboard filter movement aligned with the visible tab list. Hidden or removed tabs must not leave the active filter without a valid next tab.
  • Keep result labels, icons, verification marks, and fallback text aligned with the data returned by providers. A display change must not hide the route identity.
  • Keep each result pathname compatible with its cluster rules. A result-level cluster must override the current page cluster when the source query identifies another network.
  • Preserve target query parameters when adding cluster data to Inspector or other pre-filled routes.
  • Keep external explorer route maps and cluster maps aligned. An accepted source URL must resolve to a local route and a safe cluster.
  • Keep the /api/search response shape aligned with the client validator. Invalid token data is discarded instead of shown.
  • Treat cacheability as part of cluster behavior. Custom endpoints and unsupported cluster sources must not become shared cache entries.
  • Keep feature-gate SIMD values normalized as numbers so padded registry values and user queries resolve to the same gate.
  • Keep domain validation, mainnet-only lookup, and owner-result labeling aligned. A domain can be valid input but still have no searchable owner.
  • Keep the domain response schema aligned with the API's address and owner fields. A schema change can silently turn domain matches into empty results.
  • Keep the domain request timeout and provider failure handling aligned with the shared provider isolation model.
  • Keep the server-only search exports aligned with the API's discovery source, resolver, cache headers, and token type. A missing export can break the server boundary without changing the client search contract.
  • Keep numeric-query epoch context aligned with the search cache key. A changed current epoch must be able to refresh the valid epoch result range without changing non-numeric lookups.
  • Keep provider priorities unique within each tier and keep feature-gate priority below block and epoch priority. Numeric queries can produce several result groups.
  • Keep completed-search analytics tied to non-empty queries and loading transitions. Re-renders must not count one completed query more than once.
  • Keep the discovery response validator aligned with the upstream token fields. A changed upstream shape must still produce safe normalized token results.
  • Keep token discovery and asset enrichment time limits separate. A slow enrichment source must not extend the upstream discovery wait.
  • Keep verified-program snapshot scope, minimum query length, result limit, and known-program exclusion aligned with the verified-build route and its verification mark.
  • Keep external URL decoding and route mapping aligned with the external-link result shape. A recognized source URL must retain its source label, entity type, local path, and cluster.
  • Keep target-path query parsing limited to the first question mark. Inspector payloads can contain a literal question mark in a value.

Important failure modes

TriggerConsequenceGuard
Invalid cluster slug sent to /api/searchThe request returns HTTP 400 and no upstream search runs.Resolve the cluster before discovery and handle the unsuccessful response as an empty token group.
Custom cluster has no recognized genesis hashToken search returns no results and a no-store response.Pass the active genesis hash and do not assume a custom endpoint maps to a shared cluster.
Primary token discovery is unavailableToken search returns no token results.Treat upstream failure, invalid data, missing credentials, and cancellation as an empty discovery result.
Search provider throwsThat provider's group is omitted while other providers can still return results.Use settled provider resolution and log the provider name.
Query is not a valid domain or the active cluster is not mainnetNo Domain Owners result appears.Apply the shared domain check and mainnet guard before the request.
Domain lookup exceeds five seconds or returns malformed dataThe domain behaves as an empty search result.Abort slow requests and validate both returned addresses before building the result.
Verified-program query is shorter than two characters or uses a non-mainnet clusterNo verified-build result appears.Apply the snapshot's minimum-length and mainnet guards before matching.
External URL has an unsupported host or routeNo external-link result appears.Accept only mapped explorer hosts, entity segments, and identifiers.
Selected page does not existThe shared not-found page shows Page not found.Keep result pathnames tied to real Explorer routes.
Selected page throws during renderThe shared error boundary shows a retryable Something went wrong state.Use the error boundary retry action after the page or data source recovers.

Key files

FileWhy to read it
app/…/SearchBar.tsxShows the user-facing search state, debounce, filters, and selection handoff.
app/…/BaseSearch.tsxShows the search panel, keyboard behavior, filter display, loading state, and empty state.
app/…/SearchFilters.tsxShows filter labels, counts, active state, and filter selection.
app/…/SearchGroupHeading.tsxShows how result groups are labeled in the panel.
app/…/SearchResultItem.tsxShows result identity, icon fallback, and verification warnings.
app/…/filter-tabs.tsDefines result groups, filter counts, the hidden-All rule, and group order.
app/…/use-search.tsDefines lookup context, provider ordering, fallback behavior, and failure isolation.
app/…/use-search.test.tsStates the search-tier contract and the epoch-aware lookup-key behavior.
app/…/registry.test.tsStates the provider tier, priority, and numeric-result ordering contract.
app/…/feature-gate-search-provider.test.tsStates exact SIMD matching and the handling of shared or absent gate numbers.
app/…/use-search-analytics.test.tsStates when completed-search analytics fires and how result counts are measured.
app/…/registry.tsShows the available search tiers and their display priorities.
app/…/domain-search-provider.tsShows mainnet-only domain lookup, timeout handling, response checks, and owner routing.
app/…/domain-search-provider.test.tsStates the domain provider contract for normalization, cluster limits, malformed data, and request failure.
app/…/verified-programs-search-provider.tsShows the mainnet verified-program snapshot match and verified-build routing.
app/…/feature-gate-search-provider.tsShows how feature-gate titles and SIMD numbers become account results.
app/…/parse-simd-number.tsDefines the shared rules for reading SIMD numbers from queries and registry values.
app/…/use-search-navigation.tsDefines how a result becomes a cluster-aware Explorer URL.
app/…/use-search-navigation.test.tsStates cluster override and query-parameter preservation rules for selected results.
app/…/parse-explorer-url.tsDefines external explorer URL translation and cluster defaults.
app/…/parse-explorer-url.test.tsStates accepted explorer hosts, route segments, identifiers, protocols, and cluster values.
app/…/explorer-url-search-provider.tsTurns a parsed external link into a selectable search result.
app/…/explorer-url-search-provider.test.tsStates the external-link result shape and unsupported-input behavior.
app/…/route.tsDefines the public token search API and cluster-specific responses.
app/…/route.test.tsStates token normalization, enrichment, verification filtering, upstream failure, and cluster response contracts.
app/…/server.tsDefines the server-only boundary for token discovery exports and their shared type.
app/…/resolve-search-tokens.tsExplains token discovery, enrichment, and cache timing.
app/…/discover-with-jupiter.tsDefines the upstream token response checks and normalization rules.
app/…/page.tsxShows the legacy route redirect that preserves old links.
app/not-found.tsxShows the result when navigation reaches no valid page.
app/error.tsxShows the retryable page-level failure state.
app/…/SearchBar.test.tsxStates selection, reset, loading, debounce, and empty-result behavior at the search surface.