1)create an npm project by going to an empty folder, running
npm init -y
2)then
yarn add --dev hardhat
3)To create the sample project in your project folder:,run
npx hardhat => select javascript,typescript and other setting you like
4)Install other dependencies require
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers