Skip to main content

Installation

Get up and running with Compose in just a few minutes.

Packages​

Compose is published as two npm packages:

Prerequisites​

  • Node.js >= 20: required for the CLI and Foundry workflows. Hardhat 3 projects generated by Compose require Node.js 22.13 or newer.
  • Foundry (Optional): required if you use a Foundry scaffold or integrate Solidity with Forge
  • Git: used by Foundry dependency installs inside generated projects

Create a new project with Compose CLI​

Run the CLI with npx (no global install):

npx @perfect-abstractions/compose-cli init
cd my-diamond
npm run build
npm test
npm run validate

The generated package.json exposes native framework commands as npm run build and npm test (plus npm run fmt for Foundry), and the Compose npm run validate workflow. Use npx compose for the remaining Compose commands, including npx compose deploy.

Manual Installation​

To install the CLI globally instead:

npm install -g @perfect-abstractions/compose-cli
compose init

Add Compose library to an existing project​

Foundry​

forge install Perfect-Abstractions/Compose@tag=compose@0.0.7

Create a remappings.txt file in the root of your project with the following content:

@perfect-abstractions/compose/=lib/Compose/src/

Hardhat / NPM​

npm install @perfect-abstractions/compose

Import in your project​

import {DiamondMod} from "@perfect-abstractions/compose/diamond/DiamondMod.sol";

What's Next?​

Now that you have Compose installed, let's understand the core concepts:

Getting Help​

Having trouble with installation?

Newsletter

Get notified about releases, feature announcements, and technical deep-dives on building smart contracts with Compose.

No spam. Unsubscribe anytime.