Forklift
Forklift is a TypeScript framework for developing, testing, and scripting Aptos Move smart contracts.
Forklift complements the TypeScript SDK:
- Use the SDK to build client-side applications that interact with the blockchain
- Use Forklift for the contract development workflow — writing tests, scripting deployments, and verifying your code works before going live.
If you’re coming from Ethereum, think of Forklift as Hardhat/Foundry for Aptos.
Features
Section titled “Features”- Three Execution Modes: Local simulation, network forking, and live execution — same code works across all three.
- TypeScript Native: Write tests and scripts in standard TypeScript with full Node.js capabilities.
- Easy Setup: No need to manually spawn or manage a local validator node. Forklift handles the simulation lifecycle automatically.
- Isolation & Repeatability: Each session runs in isolation with deterministic results — perfect for automated testing/CI.
The Harness
Section titled “The Harness”Forklift provides a unified Harness class that works across three execution modes:
| Mode | What It Does | Use For |
|---|---|---|
| Local Simulation | Runs entirely in memory, instant execution | Development, unit tests, CI |
| Network Forking | Fetches real chain state, simulates locally | Testing against mainnet/testnet without spending gas |
| Live Execution | Executes real transactions | Deploying and interacting for real |
Network Forking is the killer feature — test your contracts against real deployed protocols and dry-run deployment scripts against production state, all without spending gas or affecting the network.
The same code works in all three modes. Write your workflow once, run it locally for fast iteration, fork mainnet to verify against real state, then execute live when ready.
import { Harness } from "@aptos-labs/forklift";
const harness = Harness.createLocal(); // or createNetworkFork(), createLive()
harness.init_cli_profile("alice");harness.fundAccount("alice", 100_000_000);
const result = harness.deployCodeObject({ sender: "alice", packageDir: "./move/my_contract", packageAddressName: "my_contract",});
harness.runMoveFunction({ sender: "alice", functionId: `${result.Result.deployed_object_address}::my_module::my_function`, args: ["u64:42"],});
harness.cleanup();Get Started
Section titled “Get Started” Forklift Repository Documentation, API reference, and installation instructions
TipJar Tutorial Complete walkthrough: develop → test → deploy → interact