Overview
This guide will walk you through setting up Agora locally, configuring your DAO instance, and creating your first governance proposal. You’ll have a fully functional governance platform running in under 15 minutes.This guide assumes you have basic familiarity with Next.js, TypeScript, and PostgreSQL. You’ll also need Node.js 18+ and npm installed.
Prerequisites
Before you begin, ensure you have:Development tools
- Node.js 18+ and npm installed
- Git for cloning the repository
- PostgreSQL database (local or remote)
- Code editor (VS Code recommended)
API keys and accounts
- Alchemy API key for blockchain RPC access (Get one free)
- WalletConnect Project ID (Create project)
- Database connection strings for PostgreSQL
Step 1: Clone and Install
First, clone the Agora repository and install dependencies:The installation process will also generate TypeChain types and Prisma client automatically.
Step 2: Configure Environment Variables
Create a.env.local file in the project root. You can start by copying the sample file:
Core Configuration
These variables are required for Agora to run:.env.local
Blockchain RPC Configuration
Add your Alchemy API keys for blockchain access:.env.local
Database Configuration
Configure PostgreSQL connection strings:.env.local
Agora uses a dual-database pattern:
- WEB2 Database: User-generated content (profiles, settings, forum posts)
- WEB3 Database: Blockchain-indexed data (proposals, votes, delegates)
Wallet Connection
Add your WalletConnect Project ID:.env.local
Authentication
Generate a JWT secret for user sessions:.env.local
Step 3: Set Up the Database
Agora uses Prisma as its ORM. Pull the latest schema and generate the Prisma client:Database Structure
Agora uses a multi-schema PostgreSQL database:- agora: Shared cross-tenant data
- config: Configuration and contracts
- [dao-namespace]: DAO-specific data (e.g.,
ens,optimism,uniswap)
Step 4: Start the Development Server
Now you’re ready to run Agora locally:- Generate TypeChain types from contract ABIs
- Generate the Prisma client
- Start the Next.js development server on
http://localhost:3000
The development server supports hot reload. Changes to your code will automatically refresh the browser.
Step 5: Connect Your Wallet
To interact with Agora, you’ll need to connect a wallet:Step 6: Create Your First Proposal
Now let’s create a governance proposal:Option A: Using the UI
If your tenant has theeasv2-govlessvoting feature enabled:
Choose proposal type
Select between:
- Temp Check: Off-chain temperature check via Snapshot or EAS
- Gov Proposal: Full onchain governance proposal
Fill in details
Enter proposal information:
- Title: Clear, descriptive title
- Description: Detailed proposal body (supports markdown)
- Proposal Type: Standard, approval voting, etc.
- Voting Period: Start and end times
Add transactions (onchain only)
For onchain proposals, add executable transactions:
- Target contract addresses
- Function calls and parameters
- ETH values (if sending funds)
Option B: Using the API
Create a proposal programmatically:API authentication requires an API key. Generate one using the CLI:
npm run generate-apikey -- --email [email protected] --address 0x... --chain-id 1 --description "API access"Step 7: Vote on a Proposal
Once a proposal is active, you can vote:Using the UI
Using the API
Step 8: Explore Delegation
Delegation allows token holders to delegate their voting power to trusted representatives:Delegate Your Voting Power
Create a Delegate Profile
To become a delegate:Fill in your statement
Add information about yourself:
- Bio and governance philosophy
- Social links (Twitter, Discord, Warpcast)
- Email for notifications (optional)
Next Steps
Congratulations! You now have Agora running locally and understand the core workflows. Here’s what to explore next:Architecture Deep Dive
Learn about Agora’s system design, multi-tenant architecture, and database schema.
Configuration Guide
Explore all environment variables and advanced configuration options.
Deployment Guide
Deploy Agora to production on Vercel or your own infrastructure.
API Reference
Comprehensive API documentation for building integrations.
Troubleshooting
Database Connection Issues
Error: Can't reach database server
Error: Can't reach database server
Cause: PostgreSQL is not running or connection string is incorrect.Solution:
- Verify PostgreSQL is running:
pg_isready - Check connection string format:
postgres://user:password@host:port/database - Ensure database exists:
createdb agora_dev
Error: Schema not found
Error: Schema not found
Cause: Database schema hasn’t been created for your tenant.Solution: Run migrations from the queries repository to create the required schemas.
RPC and Blockchain Issues
Error: Could not fetch data from blockchain
Error: Could not fetch data from blockchain
Cause: Invalid or rate-limited Alchemy API key.Solution:
- Verify your Alchemy API key is correct
- Check Alchemy dashboard for rate limit status
- Use separate keys for client and server
Wrong network detected
Wrong network detected
Cause: Wallet connected to incorrect network.Solution: Switch your wallet to the correct network for your tenant (Mainnet for ENS, Optimism for OP, etc.).
Build and Runtime Errors
TypeScript errors
TypeScript errors
Solution:
- Regenerate types:
npm run generate-typechain - Regenerate Prisma client:
npx prisma generate - Check TypeScript:
npm run typecheck
Environment variable not found
Environment variable not found
Solution: Ensure
.env.local is in the project root and contains all required variables. Restart the dev server after changes.For additional help, join the Discord community or open an issue on GitHub.
Additional Resources
- Environment Variables: See the README for a complete list of all environment variables
- Database Manual: Database setup guide
- Queries Repository: Database schema and migrations