Prerequisites
- Node.js 20.x or later is installed.
- Docker is installed, and you have basic knowledge of using it.
Instructions
Install Subquid
Create a Squid: Follow the instructions for creating a Squid.- During setup, create a new Squid with a name of your choice. This will be used later.
Create the Indexer
Initialize the JavaScript environment
Install required packages
Add tsconfig.json
Create a tsconfig.json
file in your project root with the following configuration:
Define the schema
Create aschema.graphql
file and define the database schema. For example:
Generate TypeORM entities
Run the following command to generate TypeORM entities based on the schema:Create a .env
file
Define the database credentials in a .env
file:
Create docker-compose.yaml
Create a docker-compose.yaml
file to set up a PostgreSQL database:
Compile TypeORM classes
Compile the generated TypeORM classes:Generate and apply migrations
- Generate the migration file:
- Apply the migration:
Tie the code together
Create asrc/main.ts
file and add the following code:
Compile and start the processor
- Compile the code:
- Start the processor: