Chapter 2

Project Structure and Tooling

A well-organized Solidity project makes collaboration, auditing, and deployment predictable. Whether you choose Foundry or Hardhat, the same layers appear: source contracts, tests, deployment scripts, and dependency management.

Foundry stores dependencies in lib/ via git submodules or forge install, while Hardhat typically uses npm packages. Both approaches work — pick one stack and stay consistent so imports and remappings do not drift between environments.

Always pin the Solidity compiler version in your config file rather than using floating pragmas in production code. A small version bump can change bytecode hashes, break deterministic deploys, and invalidate audit reports tied to a specific build.