Getting Started with Envio
Learn how to create and run an indexer with Envioβs HyperIndex, from initialization to local testing and deployment.
Indexer Initializationβ
Prerequisitesβ
- Node.js (v22 or newer recommended)
- pnpm (v8 or newer)
- Docker Desktop (required to run the Envio indexer locally)
Note: Docker is required only if you plan to run your indexer locally. You can skip installing Docker if you'll only be using Envio's hosted service.
Additionally for Windows Users:β
- WSL Windows Subsystem for Linux
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 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.