Build and Deploy
Learn how to use ao-forge build for production builds and deployment.
Overview
ao-forge provides a build system that handles frontend framework builds. Note: The build command currently focuses on frontend builds only. AO process deployment is handled separately through the AOS CLI.
Basic Build Commands
# Build for production
ao-forge build
# Build with custom output directory
ao-forge build --output ./dist
# Clean build (removes output directory first)
ao-forge build --clean
Build Configuration
Production Build
# Standard production build
ao-forge build
# This creates:
# - Optimized frontend bundle (via framework's build command)
# - Build artifacts in output directory
Build Options
# Custom output directory
ao-forge build --output ./dist
# Clean build (removes output directory first)
ao-forge build --clean
Framework-Specific Builds
The build command automatically detects your framework and runs the appropriate build command:
Next.js Projects
# Build Next.js application
ao-forge build
# Runs: npm run build (or pnpm/yarn equivalent)
Nuxt.js Projects
# Build Nuxt.js application
ao-forge build
# Runs: npm run build (or pnpm/yarn equivalent)
React/Vue/Svelte Projects
# Build Vite-based projects
ao-forge build
# Runs: npm run build (or pnpm/yarn equivalent)
AO Process Management
Note: AO process building and deployment is handled separately through the AOS CLI, not through ao-forge build.
AO Process Development
# Start AO process for development
ao-forge process start
# List running processes
ao-forge process list
# Stop AO process
ao-forge process stop
AO Process Deployment
# Deploy AO process using AOS CLI directly
aos [process-name] --load ./ao/contract.lua
# Deploy with specific wallet
aos [process-name] --load ./ao/contract.lua --wallet ./wallet.json
# Deploy to testnet
aos [process-name] --load ./ao/contract.lua --testnet
Deployment Options
Note: The ao-forge deploy command exists but is currently in development. For production deployment, use your framework's standard deployment methods.
Frontend Deployment
# Build your project first
ao-forge build
# Deploy using your framework's tools:
# Next.js: Vercel, Netlify, etc.
# Nuxt.js: Vercel, Netlify, etc.
# React/Vue/Svelte: Vercel, Netlify, GitHub Pages, etc.
Manual Deployment
# Build for production
ao-forge build --output ./dist
# Upload dist/ folder to your hosting provider
# Examples: Vercel, Netlify, GitHub Pages, AWS S3, etc.
Build Configuration
ao.config.yml
# Project configuration
name: 'my-ao-app'
framework: 'nextjs'
packageManager: 'pnpm'
# AO process configuration
luaFiles:
- counter.lua
- token.lua
autoStart: false
processName: 'my-process'
# Development ports
ports:
dev: 3000
Build Process
The build command works by:
- Detecting your framework from package.json
- Running the framework's build command (npm run build, pnpm build, etc.)
- Copying build artifacts to the output directory
- Generating build summary
Build Output
# After running ao-forge build
dist/
├── index.html # Main HTML file
├── assets/ # CSS, JS, images
│ ├── main.js
│ ├── main.css
│ └── images/
└── manifest.json # Build manifest
Deployment Platforms
Since ao-forge build creates standard frontend build artifacts, you can deploy to any platform that supports your framework:
Vercel
# Build your project
ao-forge build
# Deploy using Vercel CLI
vercel --prod
Netlify
# Build your project
ao-forge build
# Deploy using Netlify CLI
netlify deploy --prod --dir=dist
GitHub Pages
# Build your project
ao-forge build
# Push dist/ folder to gh-pages branch
# Or use GitHub Actions for automated deployment
Build Scripts
package.json Scripts
{
"scripts": {
"build": "ao-forge build",
"build:clean": "ao-forge build --clean",
"dev": "ao-forge dev",
"process:start": "ao-forge process start",
"process:stop": "ao-forge process stop"
}
}
CI/CD Integration
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm ci
- run: ao-forge build
# Deploy using your preferred platform
- run: vercel --prod # or netlify deploy, etc.
Best Practices
Build Process
- Test builds locally before deployment
- Use clean builds for production (
ao-forge build --clean) - Check build output in the dist/ directory
- Verify framework build works independently
- Use appropriate package manager (pnpm recommended)
Deployment
- Build first, then deploy using platform-specific tools
- Use staging environment for testing
- Automate deployment with CI/CD
- Monitor deployment status
- Use CDN for static assets
AO Processes
- Use AOS CLI directly for process deployment
- Test processes thoroughly in development
- Use proper error handling in Lua code
- Monitor process performance
- Backup important data
Troubleshooting
Common Issues
- Build fails
# Check if framework build works independently npm run build # Clean build ao-forge build --clean # Check package.json scripts cat package.json | grep scripts - Framework not detected
# Check package.json for framework dependencies cat package.json | grep -E "(next|nuxt|react|vue|svelte)" # Ensure you're in a valid project directory ls -la package.json ao.config.yml - AO process issues
# Check AOS installation aos --version # List running processes ao-forge process list # Start process manually ao-forge process start
Getting Help
# Get help with build commands
ao-forge build --help
# Get help with process commands
ao-forge process --help
# Check project configuration
ao-forge config list
