Icon SunFilledIcon MoonStars
Icon SunFilledIcon MoonStars

Icon LinkA Fuel Indexer Project

Icon LinkUse Cases

The Fuel indexer project can currently be used in a number of different ways:

  • as tooling to compile arbitrary indicies
  • as a standalone service
  • as a part of a Fuel project, alongside other components of the Fuel ecosystem (e.g. Sway)

We'll describe these three different implementations below.

Icon LinkAs tooling for compiling indexers

The Fuel indexer provides functionality to make it easy to build and compile abitrary indexers by using forc index. For info on how to use indexer tooling to compile arbitrary indexers, check out our Quickstart and Hello World examples for a more in-depth exploration of how to compile indexers.

Icon LinkAs a standalone service

You can also start the Fuel indexer as a standalone binary that connects to a Fuel node to monitor the Fuel blockchain for new blocks and transactions. To do so, run the requisite database migrations, adjust the configuration to connect to a Fuel node, and start the service.

Icon LinkAs part of a Fuel project

Finally, you can run the Fuel indexer as part of a project that uses other components of the Fuel ecosystem, such as Sway. The convention for a Fuel project layout including an indexer is as follows:

.
├── contracts
│   └── hello-contract
│       ├── Forc.toml
│       └── src
│           └── main.sw
├── frontend
│   └── index.html
└── indexer
    └── hello-indexer
        ├── Cargo.toml
        ├── hello_indexer.manifest.yaml
        ├── schema
        │   └── hello_indexer.schema.graphql
        └── src
            └── lib.rs

Icon LinkAn Indexer Project at a Glance

Every Fuel indexer project requires three components:

  • a Manifest describing indexer metadata
  • a Schema containing models for the data you want to index
  • a Module which houses the logic for creating and saving the aforementioned data models