Introduction
Build with the Compose Library
The Compose library gives developers access to a comprehensive standard library of smart contract facets. By using the library in combination with the ERC-2535 Diamond standard, you can build sophisticated on-chain systems with maximum code reusability.
Foundations
The building blocks of the Compose platform.
AUTHENTICATION
Access control and permission management for your diamond contracts. Implement role-based access control with composable facets.
FACETS & LIBRARIES
Understanding the core architecture: how facets and libraries work together through shared storage to build powerful systems.
DIAMOND STANDARD
Learn about ERC-2535 Diamonds and how Compose leverages this standard for upgradeable, modular smart contracts.
STORAGE PATTERNS
Master the shared storage architecture that enables seamless integration between standard facets and your custom logic.
Compose is currently in development and only available to contributors. It is NOT production ready. Use at your own risk in development environments only.
What is Compose?
Compose is a revolutionary smart contract library that helps developers create sophisticated smart contract systems using the ERC-2535 Diamond standard. It's designed from the ground up to prioritize code readability, on-chain composability, and developer understanding.
The Vision
Imagine having access to a comprehensive, verified standard library of smart contract components that you can combine like LEGO blocks to build complex systems—all deployed once on-chain and reused across your projects. That's Compose.
Key Features
On-Chain Standard Library
Access verified, audited facets deployed once and reused across multiple diamonds on multiple blockchains.
Composable Architecture
Mix and match facets and libraries to build exactly what you need without inheritance conflicts.
Readability First
Code designed to be understood. Smart Contract Oriented Programming prioritizes clarity over cleverness.
Upgradeable by Design
Full power of ERC-2535 Diamonds means your contracts can evolve without redeployment.
Battle-Tested Patterns
Community-reviewed implementations following proven best practices and security standards.
Developer Experience
Intuitive APIs, comprehensive documentation, and helpful libraries make development a breeze.
How It Works
Compose uses a shared storage architecture where both standard facets and your custom facets access the same data:
// Your custom facet integrates with Compose using libraries
import {LibERC721} from "compose/LibERC721.sol";
contract GameNFTFacet {
function mintWithGameLogic(address player, uint256 tokenId) external {
// Your custom game logic
require(playerHasEnoughPoints(player), "Not enough points");
// Use LibERC721 to mint - this modifies the SAME storage
// that ERC721Facet uses for balanceOf(), ownerOf(), etc.
LibERC721.mint(player, tokenId);
// Now the player owns this NFT and can use standard
// ERC721Facet.transferFrom() to transfer it!
updatePlayerStats(player);
}
}
Both your GameNFTFacet and the standard ERC721Facet work with the same storage in your diamond. This is the power of Compose's shared storage architecture.
Why Choose Compose?
Our value
- Readability: Code that's easy to understand and audit
- Reusability: Deploy once, use everywhere
- Standards: Battle-tested, community-reviewed implementations
- Upgradability: Full power of ERC-2535 Diamonds
- Composability: Mix and match functionality without conflicts
Perfect For:
- Building complex DeFi protocols
- Creating NFT platforms with custom logic
- Developing DAO governance systems
- Projects requiring upgradeable smart contracts
- Teams that prioritize code quality and maintainability
Core Principles
Read First
Code clarity is the top priority. Every line should be understandable by developers and auditors.
Diamond-Native
Designed specifically for ERC-2535. Not adapted from inheritance patterns.
Composition Over Inheritance
Combine facets instead of inheriting. Avoid the complexity of inheritance hierarchies.
Intentional Simplicity
Banned features lead to clearer code. Less magic, more understanding.
Next Steps
Installation
Set up your development environment and start building with Compose.
Quick Start
Build your first diamond in under 5 minutes with Compose facets.
Community & Support
Compose is built with 🩵 by a vibrant community of developers who care about code quality.
Discord Community
Get help and connect with other developers
GitHub Discussions
Share ideas and ask questions
GitHub Repository
Check out the source code
Blog
Stay updated with latest news
Ready to revolutionize your smart contract development? Let's get started! 🚀