Create dApps

Overview

Create BlockDAG dApp is a lightweight CLI tool that scaffolds a full-featured BlockDAG decentralized application in seconds. It generates a “batteries-included” project with a modern frontend, dual smart-contract environments, and Web3 integration, bootstrapping everything—from Git initialization to basic wallet connection—for you.

Quick Start

Install and run the generator with a single command:

// npx create-blockdag-dapp@latest

This will prompt you for a project name, clone the starter kit, and install all initial dependencies automatically.

Features

  • Streamlined Setup: One command creates a complete BlockDAG app foundation.

  • Modern Stack: Next.js 14+ frontend with TypeScript and Tailwind CSS.

  • Dual Smart Contract Environments: Includes both Hardhat (JS/TS) and Foundry (Solidity) setups.

  • Web3 Integration: Out-of-the-box wallet connection UI.

  • Clean Start: Initializes a fresh Git repository.

Project Structure

The scaffolded project follows this layout:

your-app/ ├── frontend/ │ ├── src/ # React components & pages │ ├── public/ # Static assets │ ├── tailwind.config.ts # Tailwind CSS config │ └── package.json # Frontend dependencies & scripts └── contracts/ ├── hardhat/ │ ├── contracts/ # Solidity contracts │ ├── scripts/ # Deployment scripts │ ├── test/ # Contract tests │ └── hardhat.config.ts └── foundry/ ├── src/ # Solidity contracts ├── test/ # Contract tests ├── script/ # Deployment scripts └── foundry.toml

Environment Setup

After scaffold completes, configure environment variables:

1. Frontend (frontend/.env.local)

Copy frontend/.env.example to .env.local, then add:

// NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_wallet_connect_project_id

(Get your ID from WalletConnect Cloud.)

2. Smart Contracts (contracts/hardhat/.env & contracts/foundry/.env)

In each contracts subfolder, copy .env.example.env and add:

// PRIVATE_KEY=your_private_key_here  
RPC_URL=your_rpc_url_here

Development Workflow

  1. Create Project

// npx create-blockdag-dapp@latest
   cd your-project-name
  1. Install Dependencies & Set Up Envs

// # Frontend
   cd frontend
   cp .env.example .env.local
   yarn install
   yarn dev
  1. Foundry Setup

// cd ../contracts/foundry
   cp .env.example .env
   forge install
   forge build
  1. Hardhat Setup

// cd ../hardhat
   yarn install
   npx hardhat compile
  1. (Optional) Add Submodules

// git submodule add https://github.com/OpenZeppelin/openzeppelin-contracts.git contracts/foundry/lib/openzeppelin-contracts
   git submodule add https://github.com/foundry-rs/forge-std contracts/foundry/lib/forge-std

Running Commands

Frontend

// cd frontend  
   npm run dev  # or yarn dev

Hardhat

// cd contracts/hardhat  
   npm run compile      # or npx hardhat compile  
   npm run test         # or npx hardhat test  

Foundry

// cd contracts/foundry  
   forge build  
   forge test  
   forge install       # if not installed earlier 

Last updated

Was this helpful?