Project Setup Commands

The project setup commands include cre init to initialize new CRE projects or add workflows, and cre generate-bindings to generate contract bindings for type-safe contract interactions.

cre init

Initializes a new CRE project or adds a workflow to an existing project. The behavior depends on your current directory:

  • In a directory without a project: Creates a new project with the first workflow
  • In an existing project directory: Adds a new workflow to the existing project

Usage:

cre init [flags]

Flags:

FlagDescription
--non-interactiveFail instead of prompting; supply all inputs via flags (for CI/CD and non-TTY environments).
-p, --project-nameName for the new project (required for a new project when using --non-interactive).
-t, --templateTemplate name to use (for example hello-world-go). Run cre templates list to see IDs and required networks.
-w, --workflow-nameName for the new workflow.
--refreshBypass the template cache and fetch fresh data from GitHub.
--rpc-urlRPC endpoint for a chain, repeatable. Format: chain-name=url. Often required with --non-interactive when the template needs RPCs.

Inherited global flags include -R, --project-root, which cre init uses as the directory where the project is created when you pass it explicitly.

Interactive mode (recommended):

Running cre init without flags starts an interactive setup that guides you through the process:

  1. Project name (only if creating a new project)
  2. Language (Go or TypeScript)
  3. Workflow template (fetched dynamically from configured template sources)
  4. Workflow name

Example:

# Interactive setup
cre init

Non-interactive mode (scripting / CI):

Pass --non-interactive plus the flags your template needs. Use cre templates list (or cre templates list --json) to see required networks and choose --rpc-url values.

cre init \
  --non-interactive \
  --project-name my-cre-project \
  --workflow-name my-workflow \
  --template hello-world-go \
  --rpc-url sepolia=https://sepolia.infura.io/v3/YOUR_KEY

For a detailed walkthrough, see Part 1 of the Getting Started guide.

cre generate-bindings

Generates Go bindings from contract ABI files. This enables type-safe contract interactions in your Go workflows.

Usage:

cre generate-bindings <chain-family> [flags]

Arguments:

  • <chain-family> — (Required) Chain family. Currently supports: evm

Flags:

Flag
Description
-a, --abiPath to ABI directory (default: "contracts/{chain-family}/src/abi/")
-l, --languageTarget language (default: "go")
-k, --pkgBase package name; each contract gets its own subdirectory (default: "bindings")
-p, --project-rootPath to project root directory (default: current directory)

Supported input file formats:

The command accepts two ABI file formats in the same directory:

FormatExtensionDescription
Raw ABI*.abiA JSON array of ABI entries, as output by solc or extracted from a compiled artifact
JSON artifact*.jsonA compiled artifact file (Hardhat, Foundry, or any tool) with a top-level "abi" field

Both formats can coexist in the same --abi directory. The CLI detects the format automatically based on file extension and content.

How it works:

  • Supports EVM chain family and Go language
  • Each contract gets its own package subdirectory to avoid naming conflicts
  • For example, IERC20.abi generates bindings in generated/ierc20/ package
  • Generated bindings are placed in contracts/{chain-family}/src/generated/
  • For each contract, two files are generated:
    • <ContractName>.go — Main binding for contract interaction
    • <ContractName>_mock.go — Mock implementation for testing workflows without deployed contracts

Examples:

  • Generate bindings for all ABI files in the default directory

    cre generate-bindings evm
    
  • Generate bindings from Hardhat/Foundry artifact files (.json)

    # Place your compiled artifact files in contracts/evm/src/abi/
    # The CLI reads the "abi" field from each .json file automatically
    cre generate-bindings evm
    
  • Generate bindings with custom ABI directory

    cre generate-bindings evm --abi ./custom-abis
    
  • Generate bindings with custom package name

    cre generate-bindings evm --pkg mycontracts
    

For a detailed guide, see Generating Contract Bindings.

Project initialization workflow

The typical project setup flow for Go workflows:

  1. cre init — Create a new project or add a workflow (interactive or with flags)
  2. Add contract ABIs — Place ABI files in contracts/evm/src/abi/
  3. cre generate-bindings evm — Generate Go bindings from ABIs
  4. Sync dependencies — Run go mod tidy to update your go.mod
  5. Start development — Write your workflow code

Learn more

Get the latest Chainlink content straight to your inbox.