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
-p, --project-nameName for the new project
-t, --template-idID of the workflow template to use
-w, --workflow-nameName for the new workflow

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 (example templates for the chosen language)
  4. Workflow name

Example:

# Interactive setup
cre init

Non-interactive mode:

# Create a new project with initial workflow
cre init \
  --project-name my-cre-project \
  --workflow-name my-workflow \
  --template-id 1

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)

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 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.