Prerequisites
Before you begin, ensure your development environment meets these requirements:Required software
- Node.js >= 20.18.3 - Download
- Yarn 3.2.3 - Installed automatically via Corepack
- Git - Download
- Web3 wallet - MetaMask or similar for testing
Clone the repository
Get started by cloning the Agora DAO repository:Install dependencies
Agora DAO uses Yarn 3 workspaces to manage the monorepo structure. Install all dependencies with a single command:packages/hardhat- Smart contracts and Hardhat toolingpackages/nextjs- Next.js frontend application
The project uses Yarn 3 (packageManager: “[email protected]”) which is automatically managed via Corepack. You don’t need to install Yarn globally.
Project structure
Understand the monorepo layout:Smart contract setup
Configure the Hardhat environment for smart contract development.Configure environment variables
Edit
packages/hardhat/.env with your API keys:packages/hardhat/.env
For local development, you can leave these empty. Default values are provided in
hardhat.config.ts for prototyping.Compile contracts
Compile the Solidity contracts:This generates TypeScript types and artifacts in
packages/hardhat/artifacts/.Start local blockchain
Run a local Ethereum network for development:http://127.0.0.1:8545 with:
- 20 pre-funded test accounts
- Instant block mining
- Full Ethereum JSON-RPC support
- Console logging of transactions
Leave this terminal running. Open a new terminal for subsequent commands.
Deploy contracts
Deploy the smart contracts to your local network:Deploy to local network
In a new terminal, run:This executes the deployment scripts in
packages/hardhat/deploy/:00_deploy_agora_factory.ts- Deploys AgoraDaoFactory01_deploy_agora_dao.ts- Additional setup
Contracts are automatically deployed when you start the Next.js development server. Manual deployment is only needed if you make contract changes.
Frontend setup
Configure the Next.js application.Configure environment variables
Edit
packages/nextjs/.env.local:packages/nextjs/.env.local
Default values are provided in
scaffold.config.ts. You only need to set these for production or if you want to use your own API keys.scaffold.config.ts
Get API keys (optional)
For production or custom development:Alchemy API Key
- Visit Alchemy Dashboard
- Create a new app
- Copy the API key
- Visit WalletConnect Cloud
- Create a new project
- Copy the project ID
Start development server
Launch the Next.js application:The application runs on
http://localhost:3000.Available scripts
Common commands for development:Root level commands
Hardhat-specific commands
Next.js-specific commands
Network configuration
Configure different networks inpackages/hardhat/hardhat.config.ts:
hardhat.config.ts
scaffold.config.ts to match:
scaffold.config.ts
Troubleshooting
Node version error
Node version error
If you see “The engine ‘node’ is incompatible”:
Yarn not found
Yarn not found
If Yarn 3 is not available:
Contract compilation fails
Contract compilation fails
If Solidity compilation fails:
MetaMask connection issues
MetaMask connection issues
If you can’t connect to the local network:
- Reset MetaMask account (Settings > Advanced > Reset Account)
- Verify Hardhat network configuration:
- RPC URL: http://127.0.0.1:8545
- Chain ID: 31337
- Ensure local blockchain is running (
yarn chain)
Port already in use
Port already in use
If port 3000 or 8545 is already in use:
Next steps
You’re all set up! Here’s what to do next:Create your first DAO
Follow the quickstart to create and join a DAO
Explore smart contracts
Understand the contract architecture
Configure your project
Learn how to configure environment and settings
Deploy to production
Deploy your DAO to Vercel or IPFS