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, svelte, react, vue) | 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
ao-forge init my-app --framework react
ao-forge init my-app --framework vue
ao-forge init my-app --framework svelte
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 React Vue Svelte - 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
React Project
my-app/
├── README.md
├── package.json
├── ao.config.yml
├── tsconfig.json
├── vite.config.ts
├── tailwind.config.js
├── src/
│ ├── App.tsx
│ ├── main.tsx
│ └── ao/
│ └── counter.lua
└── public/
└── favicon.ico
Vue Project
my-app/
├── README.md
├── package.json
├── ao.config.yml
├── tsconfig.json
├── vite.config.ts
├── tailwind.config.js
├── src/
│ ├── App.vue
│ ├── main.ts
│ └── ao/
│ └── counter.lua
└── public/
└── favicon.ico
Svelte Project
my-app/
├── README.md
├── package.json
├── ao.config.yml
├── tsconfig.json
├── vite.config.ts
├── tailwind.config.js
├── src/
│ ├── App.svelte
│ ├── main.ts
│ └── 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
React Dependencies
react- React libraryreact-dom- React DOMvite- Vite build tooltypescript- TypeScript supporttailwindcss- CSS framework@types/react- React types@types/react-dom- React DOM types
Vue Dependencies
vue- Vue.js libraryvite- Vite build tooltypescript- TypeScript supporttailwindcss- CSS framework@vitejs/plugin-vue- Vue plugin for Vite
Svelte Dependencies
svelte- Svelte frameworkvite- Vite build tooltypescript- TypeScript supporttailwindcss- CSS framework@sveltejs/vite-plugin-svelte- Svelte plugin for Vite
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', 'nuxtjs', 'react', 'vue', or 'svelte' - 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
