Skip to content

Overview

View as Markdown

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.

  • you need a backend to keep a SQL view of on-chain events or account state
  • you want to query indexed chain data from backend code
  • 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
PackageUse it whenWhat it gives you
@thru/sdkYou need direct chain reads, writes, simple streaming, or ad-hoc RPC queries without persistence.Typed RPC client for accounts, transactions, blocks, events, and chain state. No storage or checkpointing.
@thru/replayYou need an ordered backfill-plus-live feed for analytics, ETL, or event processing without managed 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 and resumable checkpoints.Stream definitions, Drizzle table generation, checkpoint management, and a runtime 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 current chain state without indexing history, @thru/sdk is sufficient.

PackageRole
@thru/indexerDefines streams, manages checkpoints, and writes rows to Postgres-backed Drizzle tables.
@thru/replaySupplies the historical-plus-live replay layer and the ChainClient used by the indexer runtime.

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. query the Drizzle tables directly from your backend
  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.