Loading...
Loading...
Initializes new Aptos dApp projects using degit to bootstrap from official templates. Triggers on: 'create project', 'scaffold project', 'new dApp', 'new Move project', 'initialize project', 'setup project', 'start new contract', 'init aptos project', 'create fullstack dapp'.
npx skill4agent add iskysun96/aptos-agent-skills scaffold-projectdegit| Type | Template | Use Case |
|---|---|---|
| Fullstack dApp | | Frontend + smart contracts |
| Contract-only | | Smart contracts without frontend |
# Bootstrap fullstack template (no git history)
npx degit aptos-labs/create-aptos-dapp/templates/boilerplate-template my-dapp
cd my-dappNote: The degit command references a specific template path in the aptos-labs/create-aptos-dapp repository. If you encounter errors, verify the template path exists at https://github.com/aptos-labs/create-aptos-dapp/tree/main/templates
.env# Create .env file
cat > .env << 'EOF'
PROJECT_NAME=my-dapp
VITE_APP_NETWORK=devnet
VITE_APTOS_API_KEY=""
VITE_MODULE_PUBLISHER_ACCOUNT_ADDRESS=
# This is the module publisher account's private key.
# Be cautious about who you share it with, and ensure it is not exposed when deploying your dApp.
VITE_MODULE_PUBLISHER_ACCOUNT_PRIVATE_KEY=
EOFPROJECT_NAMEVITE_APP_NETWORKdevnettestnetmainnetVITE_APTOS_API_KEYVITE_MODULE_PUBLISHER_ACCOUNT_ADDRESSaptos initVITE_MODULE_PUBLISHER_ACCOUNT_PRIVATE_KEY~/.aptos/config.yaml.env.gitignore# Verify .env is gitignored (should already be there)
grep -q "^\.env$" .gitignore || echo ".env" >> .gitignorecontract/Move.toml[package]
name = "my_dapp" # Your project name
version = "1.0.0"
authors = []
[addresses]
my_dapp_addr = "_" # Will be set during deployment
[dev-addresses]
my_dapp_addr = "0xCAFE" # For testing
[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-framework.git", rev = "mainnet", subdir = "aptos-framework" }npm installgit init
git add .
git commit -m "Initial commit: Bootstrap Aptos dApp from boilerplate template"# Compile Move contracts
npm run move:compile
# Run Move tests
npm run move:test
# Start frontend development server
npm run devmy-dapp/
├── frontend/
│ ├── components/ # React UI components
│ ├── entry-functions/ # Write operations (transactions)
│ ├── view-functions/ # Read operations (queries)
│ ├── lib/ # Shared libraries (wallet, aptos client)
│ ├── utils/ # Helpers
│ ├── App.tsx
│ ├── constants.ts
│ └── main.tsx
├── contract/
│ ├── sources/ # Move modules
│ ├── tests/ # Move tests
│ └── Move.toml
├── scripts/move/ # Deployment scripts
├── package.json # npm scripts for move:compile, move:test, etc.
├── .env # Environment variables (NEVER commit!)
├── .gitignore # Must include .env
└── [config files] # vite, tailwind, typescript, etc.| Directory | Purpose |
|---|---|
| Transaction payloads for write operations |
| Queries for read operations |
| Aptos client and wallet provider setup |
| Move smart contract modules |
| Deployment and utility scripts |
# Bootstrap contract-only template
npx degit aptos-labs/create-aptos-dapp/templates/contract-boilerplate-template my-contract
cd my-contract.env# Create .env file
cat > .env << 'EOF'
PROJECT_NAME=my-contract
VITE_APP_NETWORK=devnet
VITE_APTOS_API_KEY=""
VITE_MODULE_PUBLISHER_ACCOUNT_ADDRESS=
# This is the module publisher account's private key.
# Be cautious about who you share it with, and ensure it is not exposed when deploying your dApp.
VITE_MODULE_PUBLISHER_ACCOUNT_PRIVATE_KEY=
EOF
# Ensure .env is gitignored
grep -q "^\.env$" .gitignore || echo ".env" >> .gitignorecontract/Move.toml[package]
name = "my_contract"
version = "1.0.0"
[addresses]
my_contract_addr = "_"
[dev-addresses]
my_contract_addr = "0xCAFE"
[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-framework.git", rev = "mainnet", subdir = "aptos-framework" }npm install
# Compile
npm run move:compile
# Test
npm run move:testgit init
git add .
git commit -m "Initial commit: Bootstrap Aptos contract from template"my-contract/
├── contract/
│ ├── sources/ # Move modules
│ ├── tests/ # Move tests
│ └── Move.toml
├── scripts/move/ # Deployment scripts
├── package.json # npm scripts
├── .env # Environment variables (NEVER commit!)
└── .gitignore # Must include .env# Move development
npm run move:compile # Compile Move contracts
npm run move:test # Run Move tests
npm run move:publish # Publish to network (uses .env)
# Fullstack only
npm run dev # Start frontend dev server
npm run build # Build for productionaptos move init# Initialize Move project
aptos move init --name my_module
# Configure Move.toml manually
# Create sources/ and tests/ directories# Bootstrap and setup
npx degit aptos-labs/create-aptos-dapp/templates/boilerplate-template my-dapp
cd my-dapp
npm install
git init
# Then create .env manually (see Step 2 above) - NEVER commit .env!# Bootstrap and setup
npx degit aptos-labs/create-aptos-dapp/templates/contract-boilerplate-template my-contract
cd my-contract
npm install
git init
# Then create .env manually (see Step 2 above) - NEVER commit .env!.env.env.gitignoreMove.tomlaptos init.envnpm run move:compilenpm run move:testnpm run dev.envgit statusaptos move init --name my_module[package]
name = "my_module"
version = "1.0.0"
[addresses]
my_addr = "_"
[dev-addresses]
my_addr = "0xCAFE"
[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-framework.git", rev = "mainnet", subdir = "aptos-framework" }// sources/main.move
module my_addr::main {
use std::signer;
struct Counter has key {
value: u64
}
public entry fun init_counter(account: &signer) {
move_to(account, Counter { value: 0 });
}
public entry fun increment(account: &signer) acquires Counter {
let counter = borrow_global_mut<Counter>(signer::address_of(account));
counter.value = counter.value + 1;
}
}aptos move compile
aptos move testdegit.env.env.gitignorenpm install.env.envVITE_MODULE_PUBLISHER_ACCOUNT_PRIVATE_KEY.envls -la .envcat .envVITE_MODULE_PUBLISHER_ACCOUNT_PRIVATE_KEYgit add .git add -A.gitignore.envwrite-contractsgenerate-testsconnect-contract-to-frontendintegrate-wallet-adapterdegit