Development Workflow
Learn how to use ao-forge dev effectively with AOS CLI integration for a smooth development experience.
Overview
The development workflow in ao-forge combines frontend development with AO process management, providing a seamless experience for building AO-powered applications.
Basic Development Commands
# Start development server only
ao-forge dev
# Start AO processes separately
ao-forge process start
# Start with monitoring
ao-forge process start --monitor
# Start with custom name
ao-forge process start -n my-process
Development Server
Frontend Development
# Start development server (auto-detects framework)
ao-forge dev
# Custom port
ao-forge dev --port 3001
# Open browser automatically
ao-forge dev --open
Hot Reloading
The development server includes:
- Hot module replacement for frontend changes
- Live reloading for configuration changes
- Error overlay for debugging
- TypeScript support with type checking
AO Process Management
Starting AO Processes
# Start with default configuration
ao-forge process start
# Start with custom process name
ao-forge process start -n my-process
# Start with specific wallet
ao-forge process start -w ./wallet.json
Process Configuration
# ao.config.yml
luaFiles:
- counter.lua
- token.lua
packageManager: 'pnpm'
framework: 'nextjs'
autoStart: true
ports:
dev: 3000
processName: 'my-process'
monitoring: true
AOS CLI Integration
Using AOS CLI Directly
# Install AOS CLI
npm i -g https://get_ao.g8way.io
# Start a process
aos my-process
# Load a contract
aos my-process --load ./ao/contract.lua
# Send a message
aos my-process --eval "Send({Target = 'process-id', Action = 'increment'})"
Integrated Workflow
# ao-forge handles AOS CLI integration
ao-forge dev:ao
# This automatically:
# 1. Starts the frontend development server
# 2. Initializes AO processes
# 3. Loads Lua contracts
# 4. Sets up monitoring
# 5. Provides process endpoints
Development Features
Process Monitoring
# List running processes
ao-forge process list
# Start process with monitoring
ao-forge process start --monitor
# Start specific process
ao-forge process start -n my-process
Debugging
# Start process for debugging
ao-forge process start
# List all processes
ao-forge process list
# Stop processes
ao-forge process stop
Environment Configuration
Development Environment
# Set environment
export NODE_ENV=development
# Set AO environment
export AO_ENV=testnet
# Set custom configuration
export AO_CONFIG=./config/dev.yml
Environment Variables
# Frontend environment
NEXT_PUBLIC_AO_PROCESS_ID=your-process-id
NEXT_PUBLIC_AO_GATEWAY=https://arweave.net
# AO environment
AO_WALLET_PATH=./wallet.json
AO_GATEWAY=https://arweave.net
AO_MODULE=your-module-id
Workflow Best Practices
1. Start with Development Server
# Always start with the development server
ao-forge dev
2. Add AO Processes Gradually
# Start with one process
ao-forge process start -n counter
# Add more processes as needed
ao-forge process start -n token
ao-forge process start -n dao
3. Use Process Management
# List running processes
ao-forge process list
# Start processes as needed
ao-forge process start
4. Test Frequently
# Test your processes regularly
ao-forge process list
# Check process status
ao-forge process start
Common Workflows
New Feature Development
- Start development server:
ao-forge dev - Create new process:
ao-forge ai generate -p "process feature" - Start process:
ao-forge process start -n feature - Integrate with frontend
- Build:
ao-forge build
Bug Fixing
- Start process:
ao-forge process start - List processes:
ao-forge process list - Check process status:
ao-forge process list - Fix issues and test
- Build fix:
ao-forge build
Performance Optimization
- List processes:
ao-forge process list - Monitor processes:
ao-forge process start - Optimize code
- Test performance:
ao-forge process list - Deploy optimized version:
ao-forge build
Troubleshooting
Common Issues
- Port already in use
# Kill process using port lsof -i :3000 kill -9 <PID> - AO process not starting
# Check AOS CLI installation aos --version # Check wallet aos --wallet ./wallet.json - Frontend not connecting to AO
# Check process ID ao-forge process list # Verify configuration ao-forge config validate
Getting Help
# Get help with dev commands
ao-forge dev --help
# Check status
ao-forge status
# View logs
ao-forge logs
