Overview
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
Section titled “Use This When”- 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
Choosing A Package
Section titled “Choosing A Package”| Package | Use it when | What it gives you |
|---|---|---|
@thru/sdk | You 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/replay | You 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/indexer | You 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.
Core Packages
Section titled “Core Packages”| Package | Role |
|---|---|
@thru/indexer | Defines streams, manages checkpoints, and writes rows to Postgres-backed Drizzle tables. |
@thru/replay | Supplies the historical-plus-live replay layer and the ChainClient used by the indexer runtime. |
The Shape Of A Thru Indexer
Section titled “The Shape Of A Thru Indexer”Most projects follow this pattern:
- define one or more event or account streams
- export the resulting stream tables in the Drizzle schema
- construct
new Indexer(...)with a DB client,ChainClientfactory, and stream arrays - query the Drizzle tables directly from your backend
Start Here
Section titled “Start Here”Next Steps
Section titled “Next Steps”- Read Build an Indexer for the first successful end-to-end setup and production guidance.
- Move to Streams when you need to add or customize event or account parsing.
- Use Running the Indexer when you are wiring runtime config, checkpoints, migrations, or deployment shape.
- Use Querying Indexed Data once data is landing in Postgres.
Related
Section titled “Related”- Web SDKs Overview for the full list of web packages.
@thru/indexerreference for the complete indexer surface.@thru/replayreference for replay primitives and client details.