Skip to content

Using the Hardhat 3 plugin template

This guide shows you how to use the official GitHub template repository to build your own Hardhat 3 plugin. The template includes all the boilerplate needed for a new plugin.

To use the template, you’ll need Node.js 22+ and pnpm installed on your machine.

To create a new repository based on the template, click here and follow the instructions on GitHub.

Then, clone your new repository to your local machine.

The repository you just created is structured as a pnpm monorepo with the following packages:

  • packages/plugin: The plugin itself, including the plugin boilerplate.
  • packages/example-project: An example Hardhat 3 project that uses the plugin.

You’ll do all development in the packages/plugin directory, while packages/example-project is a playground to experiment with your plugin and manually test it.

To learn how to write automated tests for your plugin, read this guide.

Before changing anything, let’s test the boilerplate plugin.

Terminal window
pnpm install
pnpm build

Try the plugin out in packages/example-project with:

Terminal window
cd packages/example-project
pnpm hardhat my-task

This should print Hola, Hardhat!.

Learn more about the Hardhat 3 plugin template’s setup by reading its README.md.