---
description: Forge is Foundry's build, test, and deploy tool for Solidity smart contracts.
---

import { Cards, Card } from 'vocs'

## Forge

Forge compiles, tests, and deploys Solidity smart contracts. It's the core development tool in the Foundry suite.

### Core workflows

<Cards>
  <Card
    title="Build and test"
    description="Compile contracts and run tests with traces."
    to="/forge/testing"
  />
  <Card
    title="Clone verified contracts"
    description="Create a Forge project from explorer-verified source."
    to="/forge/cloning"
  />
  <Card
    title="Document contracts"
    description="Generate and publish an API site from Solidity NatSpec."
    to="/forge/documentation"
  />
  <Card
    title="Generate contract bindings"
    description="Create typed Alloy bindings and Solidity JSON helpers."
    to="/forge/contract-bindings"
  />
  <Card
    title="Advanced testing"
    description="Fuzz, invariant, and fork-based testing workflows."
    to="/guides/invariant-testing"
  />
  <Card
    title="Deploy and verify"
    description="Ship contracts with scripts and verify on explorers."
    to="/guides/deploying-contracts"
  />
  <Card
    title="Debug and optimize"
    description="Trace failures and track gas usage."
    to="/forge/gas-tracking"
  />
</Cards>

### Key capabilities

| Feature | Description |
|---------|-------------|
| **Compilation** | Compile contracts with configurable Solidity versions and optimization |
| **Documentation** | Generate a Vocs API site from Solidity source and NatSpec comments |
| **Testing** | Write tests in Solidity with fuzzing, forking, and gas reporting |
| **Scripting** | Deploy and interact with contracts using Solidity scripts |
| **Verification** | Verify source code on Etherscan and other explorers |
| **Analysis** | Inspect bytecode, storage layouts, and gas usage |
| **Bindings** | Generate typed Alloy crates and Solidity JSON helpers |

### Common workflows

:::terminal
```bash [Build your project]
// [!include ~/snippets/output/hello_foundry/forge-build:command]
```

```ansi
// [!include ~/snippets/output/hello_foundry/forge-build:output]
```
:::

:::terminal
```bash [Run all tests]
// [!include ~/snippets/output/hello_foundry/forge-test:command]
```

```ansi
// [!include ~/snippets/output/hello_foundry/forge-test:output]
```
:::

:::terminal
```bash [Run tests with verbose output]
$ forge test -vvvv
```

```ansi
// [!include ~/snippets/output/cheatcodes/forge-test-vvvv:output]
```
:::

```bash [Deploy via script]
$ forge script script/Deploy.s.sol --broadcast --rpc-url $RPC_URL
```

```bash [Verify a deployed contract]
$ forge verify-contract $ADDRESS src/Counter.sol:Counter --etherscan-api-key $KEY
```

### Learn more

- [Building contracts](/forge/build) — Compilation, artifacts, and optimization
- [Cloning verified contracts](/forge/cloning) — Recreate a project from an address or proxy implementation
- [Contract documentation](/forge/documentation) — NatSpec, generated API pages, and publishing
- [Contract bindings](/forge/contract-bindings) — Alloy bindings and Solidity JSON helpers
- [Testing](/forge/testing) — Writing and running tests
- [Scripting](/forge/scripting) — Deployment and on-chain interactions
- [Debugging](/forge/debugging) — Traces, debugger, and troubleshooting
- [Gas tracking](/forge/gas-tracking) — Snapshots and reports
- [Linting](/forge/linting) — Code style enforcement
- [Reference](/reference/forge/forge) — Full CLI reference
