Skip to content

Setting up a Hardhat project

Before you start, make sure you have Node.js 22+ and a package manager (such as npm or pnpm) installed:

Terminal window
node --version
npx --version

If you don’t have Node.js installed, or you have an older version, you can learn how to install or update it using nvm or volta in this guide.

You’ll create an empty directory and initialize a Hardhat project inside it:

Terminal window
mkdir hardhat-tutorial
cd hardhat-tutorial
npx hardhat --init

You’ll be prompted to select a few options. Accept the defaults for everything except the project type (we’ll use a minimal project):

  1. Version: “Hardhat 3 Beta”
  2. Directory: current directory (".")
  3. Project type: “A minimal Hardhat project” not default
  4. Install dependencies: yes

Once the setup is complete, let’s verify that everything is working:

Terminal window
npx hardhat --help

If you see Hardhat’s help output in your terminal, you’re all set!

Now that your project is set up, you’re ready to start building!