dev command
Start the development server for your AO-powered application.
Syntax
ao-forge dev [options]
Options
Option | Description | Default |
---|---|---|
--port <port> | Port for development server | 3000 |
--host <host> | Host for development server | localhost |
--open | Open browser automatically | false |
--framework <framework> | Framework to use | Auto-detect |
--process <process> | Start specific AO process | All processes |
--monitor | Enable process monitoring | false |
--debug | Enable debug mode | false |
--verbose | Verbose logging | false |
--help | Show help information | - |
Examples
Basic Usage
# Start development server
ao-forge dev
# Start with specific port
ao-forge dev --port 3001
# Open browser automatically
ao-forge dev --open
Advanced Usage
# Start with specific framework
ao-forge dev --framework nextjs
# Start specific process
ao-forge dev --process counter
# Enable monitoring
ao-forge dev --monitor
# Enable debug mode
ao-forge dev --debug
# Verbose logging
ao-forge dev --verbose
Development Server
Frontend Development
The dev command starts a development server with:
- Hot module replacement - Changes are reflected immediately
- Live reloading - Page refreshes on file changes
- Error overlay - Shows errors in the browser
- TypeScript support - Type checking and IntelliSense
- Source maps - Better debugging experience
Server Configuration
# Custom host and port
ao-forge dev --host 0.0.0.0 --port 3001
# Development with HTTPS
ao-forge dev --https
# Custom configuration file
ao-forge dev --config ./config/dev.yml
AO Process Integration
Starting AO Processes
# Start all processes
ao-forge dev --process
# Start specific process
ao-forge dev --process counter
# Start with monitoring
ao-forge dev --process --monitor
Process Management
# Start with custom process name
ao-forge dev --process my-process
# Start with specific wallet
ao-forge dev --process --wallet ./wallet.json
# Start with custom module
ao-forge dev --process --module <module-id>
Monitoring and Debugging
Process Monitoring
# Enable monitoring
ao-forge dev --monitor
# Monitor specific process
ao-forge dev --monitor --process counter
# View process logs
ao-forge dev --logs
Debug Mode
# Enable debug mode
ao-forge dev --debug
# Debug specific process
ao-forge dev --debug --process counter
# Step-by-step execution
ao-forge dev --debug --step
Environment Configuration
Development Environment
# Set environment
ao-forge dev --env development
# Use custom environment file
ao-forge dev --env-file .env.development
# Override environment variables
ao-forge dev --env NODE_ENV=development
AO Environment
# Set AO environment
ao-forge dev --ao-env testnet
# Use custom AO configuration
ao-forge dev --ao-config ./ao.config.yml
# Override AO settings
ao-forge dev --ao-env mainnet --ao-gateway https://arweave.net
Framework-Specific Options
Next.js Options
# Next.js specific options
ao-forge dev --framework nextjs --next-options
# Custom Next.js config
ao-forge dev --framework nextjs --next-config ./next.config.js
# Next.js development mode
ao-forge dev --framework nextjs --next-dev
Nuxt.js Options
# Nuxt.js specific options
ao-forge dev --framework nuxtjs --nuxt-options
# Custom Nuxt.js config
ao-forge dev --framework nuxtjs --nuxt-config ./nuxt.config.ts
# Nuxt.js development mode
ao-forge dev --framework nuxtjs --nuxt-dev
Performance Options
Optimization
# Enable optimizations
ao-forge dev --optimize
# Disable optimizations
ao-forge dev --no-optimize
# Custom optimization level
ao-forge dev --optimize-level 2
Caching
# Enable caching
ao-forge dev --cache
# Disable caching
ao-forge dev --no-cache
# Clear cache
ao-forge dev --clear-cache
Error Handling
Common Errors
- Port already in use
Error: Port 3000 is already in use Solution: Use --port to specify a different port
- Process not found
Error: Process 'counter' not found Solution: Check process name or use --process to list available processes
- Framework not detected
Error: Framework not detected Solution: Use --framework to specify the framework
Development Workflow
Typical Development Session
# 1. Start development server
ao-forge dev
# 2. Make changes to your code
# 3. Changes are automatically reflected
# 4. Test your application
# 5. Debug if needed
ao-forge dev --debug
# 6. Monitor processes
ao-forge dev --monitor
Hot Reloading
The development server supports hot reloading for:
- Frontend changes - React/Vue components
- Configuration changes - ao.config.yml
- AO process changes - Lua files
- Style changes - CSS files
Best Practices
- Use monitoring for AO processes
- Enable debug mode when troubleshooting
- Use specific ports to avoid conflicts
- Test frequently during development
- Monitor resource usage for performance
Related Commands
ao-forge init
- Create new projectao-forge build
- Build for productionao-forge process
- Manage AO processes