Skip to main content

Squid CLI Cheatsheet

The sqd CLI tool has built-in aliasing that picks up custom commands defined in commands.json in the project root. All squid templates include a pre-populated commands.json file with handy scripts for common development tasks.

Getting Help

View all available commands (including custom commands from commands.json):
sqd --help
Custom commands defined in commands.json will appear in the SQUID COMMANDS help section.

Initial Setup

Before using the sqd CLI tool, install all project dependencies:
npm i

Building the Squid

Build your squid project:
sqd build
Delete all build artifacts:
sqd clean

Running the Squid

The sqd up and sqd down commands assume that the docker compose command is supported and the Docker daemon is running. Modify the definitions in commands.json if docker-compose should be used instead.
Start a local PostgreSQL database:
sqd up
Stop and remove the local PostgreSQL database:
sqd down
Run all services defined in squid.yaml locally:
sqd run [PATH]
Start the GraphQL server (development mode):
sqd serve
Start the GraphQL API server with caching and limits (production mode):
sqd serve:prod

Database Migrations

For detailed information, see TypeORM Migration generation. Apply pending migrations:
sqd migration:apply
Generate a migration for the schema defined in schema.graphql:
sqd migration:generate
Clean the db/migrations folder:
sqd migration:clean

Code Generation

For more details, see TypeORM Model generation and Type-safe decoding. Generate TypeORM entities from schema.graphql:
sqd codegen
Generate data access classes for ABI files in the ./abi folder:
sqd typegen
Depending on the template, sqd typegen is aliased to a different typegen tool specific to the chain type. Run sqd typegen --help for details.

Next Steps