Getting Started
Indexer Initialization
Prerequisites
- Node.js (v18 or newer recommended)
- pnpm (v8 or newer)
- Docker Desktop (required to run the Envio indexer locally)
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:
1. Quickstart (recommended →)
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:
config.yaml
– Defines indexing settings such as blockchain endpoints, events to index, and advanced behaviors.schema.graphql
– Defines the GraphQL schema for indexed data and its structure for efficient querying.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:
- Navigate to your project directory (if applicable):
cd your-indexer-directory
-
Ensure Docker is running on your machine.
-
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.