Skip to main content

Getting Started

Indexer Initialization

Prerequisites

Note: Docker is specifically required to run your indexer locally. You can skip Docker installation if you plan only to use Envio's hosted service.


Initialize Your Indexer

Envio provides several ways to initialize an indexer depending on your needs:

Automatically generate an indexer based on one or more smart contracts deployed on a blockchain. Ideal for rapid development.

2. Templates

Quickly create an indexer using pre-defined templates:

  • ERC20 Template (Token standard)
  • Greeter Template (docs →)

Run the following command to initialize using a template:

pnpx envio init

Select your preferred template from the interactive prompt.

3. Examples

Use existing example indexers as a starting point. You can find these examples in:

Important: Always verify the Envio version used by the example indexer matches the latest npm version. You may need minor adjustments to ensure compatibility.


Essential Files

After initialization, your indexer will contain three main files that are essential for its operation:

  1. config.yaml – Defines indexing settings such as blockchain endpoints, events to index, and advanced behaviors.
  2. schema.graphql – Defines the GraphQL schema for indexed data and its structure for efficient querying.
  3. src/EventHandlers.* – Contains the logic for processing blockchain events.

Note: The file extension for Event Handlers (*.ts, *.js, or *.res) depends on the programming language chosen (TypeScript, JavaScript, or ReScript).

You can customize your indexer by modifying these files to meet your specific requirements.


Running Your Indexer

Run Locally

You can easily test and run your indexer locally using Docker and Hasura by following these steps:

  1. Navigate to your project directory (if applicable):
cd your-indexer-directory
  1. Ensure Docker is running on your machine.

  2. Start the indexer by running:

pnpm envio dev

This command automatically launches your local environment and opens the Hasura dashboard, where you can view indexed blockchain data.

Local Hasura Admin Password:

testing

Stopping the Indexer

When you're done, stop and clean up your local environment with:

pnpm envio stop

This will shut down and remove all Docker containers used for your local development environment.

For more detailed instructions, refer to our guide to running the indexer locally.

Deploy to Hosted Service

Once you're ready, effortlessly deploy your configured indexer to Envio's hosted service and begin querying your endpoint immediately.

Check out our hosted service documentation for details on deployment and usage.


For a complete walkthrough of the process, refer to the Quickstart guide.