Skip to main content

What is Scaffold HBAR?

Scaffold HBAR is an interactive CLI tool (similar to create-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.name and user.email configured — git-scm.com
  • Yarn (scaffolded projects use Yarn workspaces):
    corepack enable && corepack prepare yarn@stable --activate
    
If you choose Foundry as the Solidity framework:
curl -L https://foundry.paradigm.xyz | bash
foundryup

Create a New Project

Run the CLI with npx:
npx create-scaffold-hbar@latest
You’ll be prompted to select:
  1. Project name — Directory name for your new project
  2. Template — Starting point for your dApp (blank, HTS token, NFT, etc.)
  3. Frontendnextjs-app or none (contracts only)
  4. Solidity frameworkfoundry, hardhat, or none
  5. Networktestnet or mainnet
For CI pipelines or scripting, use flags to skip prompts:
# Accept all defaults (blank template, Foundry, testnet)
npx create-scaffold-hbar@latest --yes

# Full customization
npx create-scaffold-hbar@latest my-scheduler-app \
  --template payments-scheduler \
  --frontend nextjs-app \
  --solidity-framework foundry \
  --network testnet
FlagDescription
-y, --yesUse 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-installDon’t run yarn install after scaffolding

Start Development

After scaffolding, start the development servers:
cd my-hedera-dapp

# Terminal 1: Start local chain
yarn foundry:chain

# Terminal 2: Deploy contracts
yarn foundry:deploy

# Terminal 3: Start frontend
yarn next:start
Open http://localhost:3000 to see your dApp.

Available Templates

Scaffold HBAR includes starter templates for common Hedera use cases. The CLI fetches templates dynamically from templates/* branches:
TemplateCLI ValueDescriptionFramework
Blank StarterblankMinimal baseline scaffold with no opinionated features—ideal starting point for custom dAppsFoundry or Hardhat
Hedera Nativehedera-demoDemo focused on Hedera-native services (HTS, HCS, Mirror Node) with end-to-end UI—no Solidity contractsNext.js only
Onchain Cron Jobpayments-schedulerScheduled payments using Hedera Schedule Service (HSS) with a ScheduledVault pattern and pluggable strategies (e.g., DCA)Foundry
BridgebridgeCross-chain bridge connecting Ethereum Sepolia and Hedera Testnet with Axelar, CCIP, or LayerZero providersFoundry
OraclesoraclesProvider-agnostic oracle pattern with adapters for Chainlink, Supra, and Pyth price feedsFoundry
Tokenize Subscriptionstokenise-subscriptionsSubRent NFT marketplace—tokenize subscriptions (gym, WiFi, streaming) as HTS NFTs with rental and salesHardhat
x402 Pay-Per-Usex402-pay-per-usePay-per-download file marketplace using the x402 protocol with HashPack payments and MinIO storageHardhat
Template selection:
# Interactive mode shows all available templates
npx create-scaffold-hbar@latest

# Or specify directly
npx create-scaffold-hbar@latest --template payments-scheduler
npx create-scaffold-hbar@latest --template hedera-demo
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 the owner/repo or owner/repo#branch format:
# Use the main branch
npx create-scaffold-hbar@latest --template hedera-dev/template-hedera-lz-app

# Use a specific branch
npx create-scaffold-hbar@latest --template hedera-dev/template-hedera-lz-app#main
The CLI fetches the template via giget, so any public GitHub repository can serve as a template. The template-hedera-lz-app is a comprehensive tutorial template for building cross-chain applications using LayerZero V2 on Hedera.
npx create-scaffold-hbar@latest my-lz-app --template hedera-dev/template-hedera-lz-app
What you’ll build:
ChapterTopicDescription
1Cross-Chain OFTSend native ETH from Base Sepolia to Hedera as an HTS-wrapped token
2Cross-Chain VaultERC4626 vault with omnichain deposits and share token redemptions
3ETF StrategyAuto-investing vault that swaps deposits into a 50/50 HBAR + HUSTLERS basket via SaucerSwap
Architecture:
BASE (Spoke)                           HEDERA (Hub)
┌─────────────────┐                   ┌─────────────────────────┐
│ MyNativeOFT     │◄──── LayerZero ──►│ MyHTSConnector          │
│ Adapter         │                   │ (wraps ETH as HTS)      │
└─────────────────┘                   └─────────────────────────┘
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:
  1. Structure — Use a monorepo layout with packages/ for contracts and frontend
  2. Manifest (optional) — Add a template.json to specify capabilities:
{
  "create-scaffold-hbar": {
    "capabilities": {
      "frontend": ["nextjs-app"],
      "solidityFramework": ["hardhat"],
      "packageManager": ["pnpm", "yarn"]
    },
    "defaults": {
      "frontend": "nextjs-app",
      "solidityFramework": "hardhat"
    }
  }
}
  1. Share — Users can scaffold with npx create-scaffold-hbar@latest --template your-org/your-repo

Project Structure

A scaffolded project has this structure:
my-hedera-dapp/
├── packages/
│   ├── foundry/          # OR hardhat/ (Solidity contracts)
│   │   ├── contracts/    # Smart contract source files
│   │   ├── script/       # Deployment scripts (Foundry)
│   │   ├── deploy/       # Deployment scripts (Hardhat)
│   │   └── test/         # Contract tests
│   │
│   └── nextjs/           # Frontend application
│       ├── app/          # Next.js App Router pages
│       ├── components/   # React components
│       ├── contracts/    # Auto-generated contract ABIs
│       ├── hooks/        # Custom React hooks
│       └── services/     # Web3 service utilities

├── package.json          # Workspace configuration
└── yarn.lock

Key Features

Auto-generated Contract Types After deploying contracts, ABIs are automatically generated to packages/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:
import { useScaffoldReadContract, useScaffoldWriteContract } from "~~/hooks/scaffold-hbar";

// Read contract state
const { data: greeting } = useScaffoldReadContract({
  contractName: "YourContract",
  functionName: "greeting",
});

// Write to contract
const { writeContractAsync } = useScaffoldWriteContract({
  contractName: "YourContract",
});

await writeContractAsync({
  functionName: "setGreeting",
  args: ["Hello, Hedera!"],
});
Hedera-Optimized Configuration Projects come pre-configured with:
  • 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

CommandDescription
yarn foundry:chain / yarn hardhat:chainStart local development chain
yarn foundry:deploy / yarn hardhat:deployDeploy contracts
yarn next:startStart Next.js frontend
yarn next:buildBuild frontend for production
yarn lintRun linters on all packages
yarn formatFormat code with Prettier
yarn foundry:test / yarn hardhat:testRun contract tests

Deploying to Testnet

  1. Get testnet HBAR from the Hedera Portal Faucet
  2. Configure your account:
# Generate a new account
yarn foundry:account:generate

# Or import an existing key
yarn foundry:account:import
Set your account alias in packages/foundry/.env:
ACCOUNT=your_keystore_alias
  1. Deploy to testnet:
yarn foundry:deploy --network hedera_testnet
# or
yarn hardhat:deploy --network hederaTestnet
  1. Verify contracts (optional):
yarn foundry:verify:testnet 0xYourContractAddress contracts/YourContract.sol:YourContract
# or
yarn hardhat:verify:testnet

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
Skills are installed automatically during scaffolding via:
npx skills add hedera-dev/hedera-skills --all
To skip Hedera Skills installation (e.g., for CI pipelines), use:
npx create-scaffold-hbar@latest --yes --skip-hedera-skills

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