Skip to content

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.

  • 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.

Forklift provides a unified Harness class that works across three execution modes:

ModeWhat It DoesUse For
Local SimulationRuns entirely in memory, instant executionDevelopment, unit tests, CI
Network ForkingFetches real chain state, simulates locallyTesting against mainnet/testnet without spending gas
Live ExecutionExecutes real transactionsDeploying 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();