Installation
Get up and running with Compose in just a few minutes.
Packages
Compose is published as two npm packages:
@perfect-abstractions/compose: Solidity library@perfect-abstractions/compose-cli: CLI to create Foundry or Hardhat diamond starter projects that use the library
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:
- Core Concepts - Learn about facets, libraries, and shared storage
- Explore Available Contracts - See what else you can add
Getting Help
Having trouble with installation?
- Check the FAQ
- Ask in Discord
- Open an issue on GitHub