Build Process
Before deploying, you need to build the application for production.Standard Build
Create an optimized production build:next build which:
- Compiles TypeScript
- Optimizes React components
- Generates static assets
- Creates production bundles
Build Verification
After building, test the production build locally:http://localhost:3000.
Type Checking
Verify TypeScript types before deployment:Deployment Options
Agora DAO frontend can be deployed to various platforms:Vercel
Recommended for traditional web hosting
IPFS
Recommended for decentralized hosting
Vercel Deployment
Vercel is the recommended platform for deploying Next.js applications.Prerequisites
Deployment Commands
The project includes specialized Vercel deployment scripts:- Standard Deployment
- Skip Error Checks (YOLO)
Deploy with all checks enabled:This runs:
Environment Variables in Vercel
Configure environment variables in the Vercel dashboard:- Go to your project settings
- Navigate to “Environment Variables”
- Add the following variables:
Environment variables set in Vercel override those in
.env.local. Use different API keys for production and development.Deployment Workflow
IPFS Deployment
Deploy to IPFS for fully decentralized hosting.IPFS Build Configuration
The project is pre-configured for IPFS deployment usingbgipfs.
Deployment Command
Deploy to IPFS with a single command:- Sets
NEXT_PUBLIC_IPFS_BUILD=true - Builds static export with
yarn build - Initializes bgipfs upload configuration
- Uploads the
out/directory to IPFS - Returns the IPFS CID and public URL
What Happens During IPFS Build
WhenNEXT_PUBLIC_IPFS_BUILD=true, the Next.js config enables:
next.config.ts
IPFS Deployment Output
Successful deployment shows:IPFS Limitations
Ensure your application is compatible with static export before deploying to IPFS.IPFS Deployment Workflow
Pin to IPFS (Optional)
For persistence, pin your CID using:
Production Checklist
Before deploying to production, ensure:Environment Configuration
Environment Configuration
- Production API keys configured
- Correct network selected in
scaffold.config.ts - Environment variables set in hosting platform
- Contract addresses updated
Code Quality
Code Quality
- All TypeScript errors resolved
- ESLint warnings addressed
- Code formatted with Prettier
- Tests passing (if applicable)
Smart Contracts
Smart Contracts
- Contracts deployed to target network
- Contract addresses verified
- ABIs generated in
contracts/ - Contracts verified on block explorer
Testing
Testing
- Production build tested locally
- Wallet connections verified
- Contract interactions tested
- All routes accessible
- Mobile responsiveness checked
Security
Security
- No private keys in code
- No sensitive data in client-side code
- HTTPS enabled (Vercel provides this)
- Content Security Policy configured
Deployment Comparison
| Feature | Vercel | IPFS |
|---|---|---|
| Deployment Speed | Fast (~2 min) | Medium (~5 min) |
| Server-Side Rendering | ✅ Yes | ❌ No |
| API Routes | ✅ Yes | ❌ No |
| Image Optimization | ✅ Yes | ❌ No |
| Decentralization | ❌ No | ✅ Yes |
| Censorship Resistance | ❌ No | ✅ Yes |
| Custom Domain | ✅ Easy | ⚠️ Requires ENS/DNSLink |
| Cost | Free tier available | Pay for pinning services |
| Automatic HTTPS | ✅ Yes | ✅ Yes (via gateway) |
Continuous Deployment
Vercel Git Integration
Enable automatic deployments:- Connect your GitHub/GitLab repository to Vercel
- Configure production branch (usually
main) - Enable automatic deployments
- Set environment variables
GitHub Actions (IPFS)
Automate IPFS deployments with GitHub Actions:.github/workflows/deploy-ipfs.yml
Troubleshooting
Build fails with TypeScript errors
Build fails with TypeScript errors
Run
yarn check-types locally to see all errors. Fix them before deploying.If you need to deploy urgently (not recommended):Wallet won't connect after deployment
Wallet won't connect after deployment
Verify:
- Correct network configured in
scaffold.config.ts - Valid
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID - Contracts deployed to the target network
Contract interactions fail
Contract interactions fail
Check:
- Contract addresses in
contracts/deployedContracts.ts - Network ID matches deployed contracts
- ABIs are up to date
IPFS deployment fails
IPFS deployment fails
Common issues:
- Build errors (run
NEXT_PUBLIC_IPFS_BUILD=true yarn buildto debug) - API routes or SSR features (not supported on IPFS)
- Network connectivity to IPFS upload service
Next Steps
Monitoring
Set up monitoring with Vercel Analytics or custom solutions
Custom Domain
Configure a custom domain for your deployment
Performance
Optimize performance with caching and CDN
Security
Implement additional security measures