{"id":18794514,"url":"https://github.com/chainstacklabs/foundry-vs-hardhat","last_synced_at":"2026-03-07T05:07:56.759Z","repository":{"id":43304811,"uuid":"468789416","full_name":"chainstacklabs/foundry-vs-hardhat","owner":"chainstacklabs","description":"Comparing Foundry and Hardhat in performance and the developer experience","archived":false,"fork":false,"pushed_at":"2024-04-04T14:31:46.000Z","size":2048,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-18T07:01:37.563Z","etag":null,"topics":["foundry","hardhat","smart-contracts"],"latest_commit_sha":null,"homepage":"https://chainstack.com/foundry-hardhat-differences-performance/","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chainstacklabs.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-11T14:49:05.000Z","updated_at":"2024-01-14T23:55:34.000Z","dependencies_parsed_at":"2024-12-29T16:41:11.122Z","dependency_job_id":null,"html_url":"https://github.com/chainstacklabs/foundry-vs-hardhat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chainstacklabs/foundry-vs-hardhat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Ffoundry-vs-hardhat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Ffoundry-vs-hardhat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Ffoundry-vs-hardhat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Ffoundry-vs-hardhat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chainstacklabs","download_url":"https://codeload.github.com/chainstacklabs/foundry-vs-hardhat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Ffoundry-vs-hardhat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30208730,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T03:24:23.086Z","status":"ssl_error","status_checked_at":"2026-03-07T03:23:11.444Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["foundry","hardhat","smart-contracts"],"created_at":"2024-11-07T21:29:38.984Z","updated_at":"2026-03-07T05:07:51.749Z","avatar_url":"https://github.com/chainstacklabs.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hardhat vs Foundry\n\n**[You can read the full article for this project in the Chainstack blog](https://chainstack.com/foundry-hardhat-differences-performance/)**\n\nThis repository contains two similar projects built with Hardhat and Foundry.\n\n## Differences\n\n\n|           | Foundry         | Hardhat          |\n| -------------------------- | --------------------------------- | -------------------------------------- |\n| Installation                                             | via CLI curl command                                                                        | not required with NPX, or via NPM                                                   |\n| CLI tools                                                | **forge** to manage the project (build/compile) \u0026 **cast** to interact with smart contracts | **hardhat** manage the project (build/compile/run scripts)                          |\n| Build \u0026 test performance                                 | 💨💨💨💨💨                                                                                  | 🐢🐢                                                                                |\n| Configuration file                                       | `foundry.toml`                                                                              | `hardhat.config.js`                                                                 |\n| Allows project folder configuration                      | Yes, in `foundry.toml` file                                                                 | Yes, in `hardhat.config.js` file                                                    |\n| Dependency management                                    | GitHub submodules (any repository)                                                          | NPM packages                                                                        |\n| Dependencies file                                        | .gitmodules                                                                                 | package.json                                                                        |     |     |\n| Files included in sample project                         | empty smart contract and basic test                                                         | Greeter smart contract (with set/get methods), test files and script to run locally |\n| Test file format                                         | Solidity contracts                                                                          | JavaScript test files                                                               |\n| Test assertion library (default)                         | ds-test                                                                                     | Mocha                                                                               |\n| Allows to alter blockchain status (time, block) in tests | Yes via cheatcodes                                                                          | Limited, via mainnet forking.                                                       |\n| Allows run specific tests?                               | Yes via --match-test --match-contract                                                       | Yes via \"only\" or \"skip\" in test files                                              |\n| Contract deployments                                     | Via forge CLI or Bash scripts (new solutions in progress)                                   | Via JS scripts                                                                      |\n| Blockchain / contracts interaction                       | via Cast CLI tool                                                                           | N/A                                                                                 |\n\n## Default project structure vs Hardhat\n\n| Files          | Foundry   | Hardhat       |\n| -------------- | --------- | ------------- |\n| Contract files | /src      | /contracts    |\n| Test files     | /src/test | /test         |\n| Output         | /out      | /artifacts    |\n| Dependencies   | /lib      | /node_modules |\n\n## Testing with Foundry\n\n| Pros                      | Cons                                                                        | Neither                  |\n| ------------------------- | --------------------------------------------------------------------------- | ------------------------ |\n| No async/await            | Test names not as descriptive as in JS tests                                | tests writen in solidity |\n| Tests require less code   | Cheats are difficult to understand at first                                 |\n| Tests run super fast      | `expectRevert` assertion is weird                                           |\n| Auto-generated gas report | `testFail` only tests if the test fails, not if the error is what we expect |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainstacklabs%2Ffoundry-vs-hardhat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainstacklabs%2Ffoundry-vs-hardhat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainstacklabs%2Ffoundry-vs-hardhat/lists"}