Here is a more detailed explanation to get the backend up and running locally.
Generate models based on schema.graphql definitions
npm run sqd:codegen
Generate types from ABIs inside the abi/
folder
npm run sqd:typegen
To build and generate the lib/ folder
npm run sqd:build
Run the following to get your database up and running (to destroy the database, just replace up
with down
)
npm run sqd:up
Run the following only in case the schema.graphql for a change
npm run sqd:migration
That will start indexing one of the supported networks of your choosing
npm run sqd:process
To start the GraphQL API
npm run sqd:graphql
When running locally most of the npm actions will use the commands.json definitions under the hood. That is the reason we have a tsconfig.squid.json
so we leave the main one to be used by NextJS avoiding problems like "the build mixing up with the nextJS build".
Note
For more information related to subsquid check the official documentation
PS: It is up to you but you don't have to install the @subsquid/cli as it is a dev dependency here. you also have a npm script called sqd
so you can pass any of the flags.