Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (create-core-dapp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
create-core-dapp
A lightweight, developer-friendly full-stack starter kit for building DApps on Core. Preconfigured with Hardhat, Next.js, and RainbowKit, it offers a seamless developer experience from testing and deploying smart contracts to frontend connectivity.
π Quick Start
Spin up your DApp with just one command:
# Full-stack DApp (Next.js + Hardhat)
npx create-core-dapp your-dapp-name
# Hardhat-only project
npx create-core-dapp your-dapp-name --hardhat⨠Features
- β‘ Next.js 15 βFast, flexible frontend with server-side rendering.
- ποΈ Wagmi + Viem - Modern React hooks and utilities for blockchain interaction.
- π RainbowKit β Pre-integrated with RainbowKit for hassle-free wallet login.
- β Hardhat β preconfigured for Core Mainnet and Testnet environments
- π React Toastify β Built-in, minimal toast notifications for better UX
- π¦ Auto-synced ABIs β No manual copyingβjust compile and integrate it in frontend
π Prerequisites
- Node.js: Version 20.x or higher is recommended. You can check your version with:Download from nodejs.org.
node --version
π¦ Installation
Using npm (Recommended)
# Full-stack DApp
npx create-core-dapp@latest your-dapp-name
# Hardhat-only project
npx create-core-dapp@latest your-dapp-name --hardhatUsing yarn
# Full-stack DApp
yarn create-core-dapp your-dapp-name
# Hardhat-only project
yarn create-core-dapp your-dapp-name --hardhatClone manually:
You can also clone the repository and run it locally:
# Clone the repository
git clone https://github.com/your-username/create-core-dapp.git
# Navigate to the project directory
cd create-core-dapp
# Install dependencies
npm install
# or
yarn install
π Project Types
Full-Stack DApp (Default)
Creates a complete DApp with both frontend and smart contract development capabilities:
- Next.js frontend with RainbowKit wallet integration
- Hardhat for smart contract development
- Pre-configured for Core Mainnet and Testnet
- Auto-synced ABIs between contracts and frontend
Hardhat-Only Project
Creates a minimal project focused solely on smart contract development:
- Hardhat configuration for Core networks
- Smart contract templates and deployment scripts
- No frontend dependencies
- Perfect for contract-only development or when you want to use a different frontend framework
βΆοΈ Usage
For Full-Stack Projects
# Navigate to the created dApp folder
cd your-dapp-name
# Install dependencies
npm install
# Start development server
npm run dev
# or
yarn devFor Hardhat-Only Projects
# Navigate to the created project folder
cd your-dapp-name
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Compile contracts
npm run compileπ§ Configuration
For Full-Stack Projects
Create a .env.local file in the root directory:
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_here
PRIVETKEY=your_private_keyFor Hardhat-Only Projects
Copy the .env.example file to .env and fill in your values:
PRIVATEKEY=your_private_key_here
CORE_TEST2_SCAN_KEY=your_api_key
CORE_MAIN_SCAN_KEY=your_api_keyποΈ Project Structure
create-dapp-template/
βββ artifacts/ # Hardhat compiled contract artifacts
βββ cache/ # Hardhat cache
βββ contracts/ # Smart contracts
βββ scripts/ # Hardhat deployment scripts
βββ src/
β βββ abi/ # Auto-synced ABIsfor frontend usage
β βββ pages/ # Next.js pages
β βββ styles/ # CSS styles
β βββ wagmi.ts # Wallet configuration
βββ test/ # Test files
βββ package.json # Project dependencies
βββ tsconfig.json # TypeScript configuration
βββ hardhat.config.js # Hardhat configurationπ οΈ Compile Contracts
Place them in the contracts/ folder
Example: Replace Lock.sol with your custom .sol file
npx hardhat compileβ Run Tests
Place them in the test/ folder
Format: <contract-name>.test.js
npx hardhat testπ Deploy Contracts
Place your deployment scripts inside the scripts/ directory (e.g., deploy.js).
Ensure your wallet's private key is added to the .env file, and that the wallet has sufficient funds on the target network.
npx hardhat run scripts/deploy.js --network <network_name>Replace <network_name> with the network you want to deploy to (e.g., core_testnet2)
π Wallet Setup
// src/wagmi.ts
import { getDefaultConfig } from "@rainbow-me/rainbowkit";
import { coreDao, coreTestnet2 } from "wagmi/chains";
export const config = getDefaultConfig({
appName: "Core Quickstart",
projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
chains: [coreDao, coreTestnet2],
ssr: true,
});π Run the Frontend
After setting up your contracts and installing dependencies, you can start the Next.js frontend development server with:
npm run devor
yarn devThis will start the application at http://localhost:3000 by default.
π ABI Usage
After compiling your smart contracts with Hardhat, the ABI (Application Binary Interface) will be automatically copied to the src/abi directory by a custom Hardhat task.
To use the ABI in your frontend:
Import the ABI in your component:
Use a default import to bring the ABI into your TypeScript/React component:// Example usage in a React component import YourContractABI from '../abi/YourContract.json'; import { useReadContract } from 'wagmi'; export function YourComponent() { const { data } = useReadContract({ address: 'YOUR_CONTRACT_ADDRESS', abi: YourContractABI, functionName: 'yourFunction', }); return ( // Your component JSX ); }
Note: If you encounter a TypeScript error when importing the JSON file, ensure your
tsconfig.jsonincludes"resolveJsonModule": trueundercompilerOptions.Keep ABIs up to date:
Whenever you update and recompile your contracts, the ABI insrc/abiwill be updated automatically.