Skip to main content
Use this section when you need historical or stateful chain data in a Postgres-backed shape instead of one-off RPC reads. Whether you are building a backend indexer, a read model, an ETL pipeline, or a historical replay service, this is the starting point.

Use This When

  • you need a backend to keep a SQL view of on-chain events or account state
  • you want to expose indexed chain data through app APIs
  • you need filtering, joins, and pagination over chain data that would be awkward to do directly from RPC
  • you are building an analytics pipeline, read model, or historical replay service

Choosing A Package

Use this table to decide which package fits your indexing use case.
PackageUse it whenWhat it gives you
@thru/thru-sdkYou need direct chain reads, simple streaming, or ad-hoc RPC queries without persistence.Typed RPC client for accounts, transactions, and chain state. No storage or checkpointing.
@thru/replayYou need an ordered backfill-plus-live feed for analytics, ETL, or event processing without managing your own database writes.Historical replay with live handoff, reconnect handling, and typed async iterators. You bring your own storage.
@thru/indexerYou need a persistent backend indexer with Postgres storage, resumable checkpoints, and optional generated read APIs.Stream definitions, Drizzle schema generation, checkpoint management, and mountable Hono routes. Built on top of @thru/replay.
If you are building a backend indexer, start with @thru/indexer. If you only need an ordered feed and want full control over where and how data lands, use @thru/replay directly. If you only need to read current chain state without indexing history, @thru/thru-sdk is sufficient.

Core Packages

PackageRole
@thru/indexerDefines streams, manages checkpoints, writes rows to Postgres, and can mount generated API routes.
@thru/replaySupplies the historical-plus-live replay layer and the ChainClient used by the indexer runtime.

The Shape Of A Thru Indexer

Most projects follow this pattern:
  1. define one or more event or account streams
  2. export the resulting stream tables in the Drizzle schema
  3. construct new Indexer(...) with a DB client, ChainClient factory, and stream arrays
  4. optionally mount generated routes for those streams in a Hono app

Start Here

Build an Indexer

Build a working token indexer and learn the production concerns for a real backend service.

Streams

Learn how event streams and account streams differ, and how to write each safely.

Running the Indexer

See the runtime architecture, tech-stack assumptions, and the indexer boot flow.

Querying Indexed Data

Query stream tables directly or expose them through generated routes.

Next Steps

  1. Read Build an Indexer for the first successful end-to-end setup and production guidance.
  2. Move to Streams when you need to add or customize event or account parsing.
  3. Use Running the Indexer when you are wiring runtime config, checkpoints, migrations, or deployment shape.
  4. Use Querying Indexed Data once data is landing in Postgres.