init command
Create a new AO-powered application with ao-forge.
Syntax
ao-forge init <project-name> [options]
Arguments
<project-name>
- The name of your project (required)
Options
Option | Description | Default |
---|---|---|
--framework <framework> | Framework to use (nextjs, nuxtjs) | Interactive prompt |
--package-manager <manager> | Package manager (npm, pnpm, yarn) | pnpm |
--template <template> | Template to use | default |
--path <path> | Path to create project | Current directory |
--skip-install | Skip package installation | false |
--force | Overwrite existing files | false |
--help | Show help information | - |
Examples
Basic Usage
# Create a new project
ao-forge init my-app
# Specify framework
ao-forge init my-app --framework nextjs
ao-forge init my-app --framework nuxtjs
Advanced Usage
# Use specific package manager
ao-forge init my-app --package-manager npm
# Use custom template
ao-forge init my-app --template dao
# Create in specific directory
ao-forge init my-app --path ./projects/
# Skip installation
ao-forge init my-app --skip-install
# Overwrite existing files
ao-forge init my-app --force
Interactive Mode
When you run ao-forge init
without specifying options, it will prompt you for:
- Framework selection
? Select framework: ❯ Next.js Nuxt.js
- Package manager selection
? Select package manager: ❯ pnpm npm yarn
- Template selection
? Select template: ❯ Default DAO NFT Marketplace DeFi Protocol
Templates
Default Template
ao-forge init my-app --template default
Creates a basic AO application with:
- Counter process
- Basic frontend integration
- Development configuration
DAO Template
ao-forge init my-dao --template dao
Creates a DAO application with:
- Voting system
- Proposal management
- Member management
- Governance features
NFT Marketplace Template
ao-forge init my-nft --template nft
Creates an NFT marketplace with:
- NFT minting
- Trading functionality
- Marketplace features
- User management
DeFi Protocol Template
ao-forge init my-defi --template defi
Creates a DeFi protocol with:
- Token contracts
- Liquidity pools
- Staking mechanisms
- Yield farming
Generated Structure
Next.js Project
my-app/
├── README.md
├── package.json
├── ao.config.yml
├── tsconfig.json
├── next.config.js
├── tailwind.config.js
├── src/
│ ├── app/
│ │ ├── layout.tsx
│ │ ├── page.tsx
│ │ └── globals.css
│ └── ao/
│ └── counter.lua
└── public/
└── favicon.ico
Nuxt.js Project
my-app/
├── README.md
├── package.json
├── ao.config.yml
├── tsconfig.json
├── nuxt.config.ts
├── tailwind.config.js
├── app.vue
├── ao/
│ └── counter.lua
└── public/
└── favicon.ico
Configuration
The init command creates an ao.config.yml
file with default settings:
name: 'my-app'
version: '1.0.0'
description: 'My AO-powered application'
framework: 'nextjs'
packageManager: 'pnpm'
luaFiles: ['counter.lua']
autoStart: false
ports:
dev: 3000
Dependencies
The init command installs the following dependencies:
Next.js Dependencies
next
- Next.js frameworkreact
- React libraryreact-dom
- React DOMtypescript
- TypeScript supporttailwindcss
- CSS framework@types/node
- Node.js types@types/react
- React types
Nuxt.js Dependencies
nuxt
- Nuxt.js frameworkvue
- Vue.js librarytypescript
- TypeScript supporttailwindcss
- CSS framework@nuxt/typescript-build
- TypeScript build module
Error Handling
Common Errors
- Project name already exists
Error: Directory 'my-app' already exists Solution: Use --force to overwrite or choose a different name
- Invalid framework
Error: Invalid framework 'invalid' Solution: Use 'nextjs' or 'nuxtjs'
- Package manager not found
Error: Package manager 'yarn' not found Solution: Install yarn or use 'npm' or 'pnpm'
Best Practices
- Use descriptive names for your projects
- Choose the right framework for your needs
- Use consistent package managers across projects
- Review generated files before starting development
- Customize configuration after creation
Related Commands
ao-forge dev
- Start development serverao-forge build
- Build for productionao-forge config
- Manage configuration