What is Scaffold HBAR?
Scaffold HBAR is an interactive CLI tool (similar tocreate-next-app or create-react-app) for the Hedera ecosystem. It generates monorepo projects with:
- Smart contracts (Hardhat or Foundry)
- Frontend (Next.js App Router with RainbowKit, wagmi, and viem)
- Hedera network configuration (Testnet or Mainnet with Hashio RPC)
- Pre-built UI components for wallet connection, address display, and HBAR input
Quick Start
Create your first Hedera dApp in under a minute
Templates
Browse pre-built templates for common use cases
Scaffold UI
Shared components, hooks, and MCP server for AI agents
GitHub
Source code and contributing guide
Quick Start
Prerequisites
Before using Scaffold HBAR, ensure you have:- Node.js ≥ 20.18.3 — nodejs.org
- Git with
user.nameanduser.emailconfigured — git-scm.com - Yarn (scaffolded projects use Yarn workspaces):
Create a New Project
Run the CLI with npx:- Project name — Directory name for your new project
- Template — Starting point for your dApp (blank, HTS token, NFT, etc.)
- Frontend —
nextjs-appornone(contracts only) - Solidity framework —
foundry,hardhat, ornone - Network —
testnetormainnet
Non-Interactive Mode
Non-Interactive Mode
For CI pipelines or scripting, use flags to skip prompts:
| Flag | Description |
|---|---|
-y, --yes | Use defaults for all prompts |
-t, --template <key> | Template key (see Available Templates) |
-f, --frontend <fw> | nextjs-app or none |
-s, --solidity-framework <fw> | foundry, hardhat, or none |
--network <network> | testnet or mainnet |
--skip-install | Don’t run yarn install after scaffolding |
Start Development
After scaffolding, start the development servers:- Foundry
- Hardhat
Available Templates
Scaffold HBAR includes starter templates for common Hedera use cases. The CLI fetches templates dynamically fromtemplates/* branches:
| Template | CLI Value | Description | Framework |
|---|---|---|---|
| Blank Starter | blank | Minimal baseline scaffold with no opinionated features—ideal starting point for custom dApps | Foundry or Hardhat |
| Hedera Native | hedera-demo | Demo focused on Hedera-native services (HTS, HCS, Mirror Node) with end-to-end UI—no Solidity contracts | Next.js only |
| Onchain Cron Job | payments-scheduler | Scheduled payments using Hedera Schedule Service (HSS) with a ScheduledVault pattern and pluggable strategies (e.g., DCA) | Foundry |
| Bridge | bridge | Cross-chain bridge connecting Ethereum Sepolia and Hedera Testnet with Axelar, CCIP, or LayerZero providers | Foundry |
| Oracles | oracles | Provider-agnostic oracle pattern with adapters for Chainlink, Supra, and Pyth price feeds | Foundry |
| Tokenize Subscriptions | tokenise-subscriptions | SubRent NFT marketplace—tokenize subscriptions (gym, WiFi, streaming) as HTS NFTs with rental and sales | Hardhat |
| x402 Pay-Per-Use | x402-pay-per-use | Pay-per-download file marketplace using the x402 protocol with HashPack payments and MinIO storage | Hardhat |
Templates are maintained in the scaffold-hbar repository as separate branches (
templates/*). The CLI fetches templates at runtime, so you always get the latest version.External Templates
Beyond the built-in templates, Scaffold HBAR supports external templates from any GitHub repository. This allows the community to create and share specialized templates.Using External Templates
Specify an external template using theowner/repo or owner/repo#branch format:
Featured: LayerZero on Hedera Template
The template-hedera-lz-app is a comprehensive tutorial template for building cross-chain applications using LayerZero V2 on Hedera.| Chapter | Topic | Description |
|---|---|---|
| 1 | Cross-Chain OFT | Send native ETH from Base Sepolia to Hedera as an HTS-wrapped token |
| 2 | Cross-Chain Vault | ERC4626 vault with omnichain deposits and share token redemptions |
| 3 | ETF Strategy | Auto-investing vault that swaps deposits into a 50/50 HBAR + HUSTLERS basket via SaucerSwap |
This template uses pnpm (not Yarn) and requires testnet funds on both Base Sepolia and Hedera Testnet. See the template README for complete setup instructions.
Creating Your Own Template
Any GitHub repository can be used as an external template. To make your template compatible:- Structure — Use a monorepo layout with
packages/for contracts and frontend - Manifest (optional) — Add a
template.jsonto specify capabilities:
- Share — Users can scaffold with
npx create-scaffold-hbar@latest --template your-org/your-repo
Project Structure
A scaffolded project has this structure:Key Features
Auto-generated Contract Types After deploying contracts, ABIs are automatically generated topackages/nextjs/contracts/deployedContracts.ts. This provides full TypeScript support when interacting with your contracts.
Pre-built Hooks
The frontend includes scaffold hooks for common operations:
- Hashio JSON-RPC endpoints for Testnet and Mainnet
- Mirror Node API integration
- Proper gas estimation for Hedera’s fee model
- RainbowKit with Hedera wallet support
Common Commands
| Command | Description |
|---|---|
yarn foundry:chain / yarn hardhat:chain | Start local development chain |
yarn foundry:deploy / yarn hardhat:deploy | Deploy contracts |
yarn next:start | Start Next.js frontend |
yarn next:build | Build frontend for production |
yarn lint | Run linters on all packages |
yarn format | Format code with Prettier |
yarn foundry:test / yarn hardhat:test | Run contract tests |
Deploying to Testnet
- Get testnet HBAR from the Hedera Portal Faucet
- Configure your account:
- Foundry
- Hardhat
packages/foundry/.env:- Deploy to testnet:
- Verify contracts (optional):
Hedera Skills (AI-Assisted Development)
All scaffolded projects include Hedera Skills by default—a collection of AI coding assistant skills that help you build on Hedera faster. What’s included:- Agent prompts — Pre-configured prompts for Cursor, Claude Code, and other AI assistants
- Code generation skills — Hedera-specific patterns for HTS, HCS, smart contracts, and more
- Documentation context — Embedded Hedera docs for accurate AI responses
Ecosystem
Scaffold UI
Shared React components and hooks for Hedera dApps, plus an MCP server for AI-assisted development
Hedera Skills
AI coding assistant skills for Hedera development
Resources
- GitHub: create-scaffold-hbar — CLI source and issues
- GitHub: scaffold-hbar — Templates repository
- Hedera Portal — Account creation and testnet faucet
- HashScan — Block explorer for Hedera