Scaffold new Aptos projects using npx create-aptos-dapp. This is the mandatory first step when a user wants to
build any new Aptos app, dApp, or project — regardless of how they phrase it.
npx create-aptos-dapp to scaffold — NEVER create projects from scratch manually.env is in .gitignore before any git operationscreate-aptos-dapp and aptos initcreate-aptos-dapp"0x..." as placeholdergit add . or git add -A without first verifying .env is in .gitignoreBefore running the scaffold command, gather these inputs from the user:
Derive from the user's description or ask directly. Use kebab-case (e.g., habit-tracker, nft-marketplace).
| Option | When to Use |
|---|---|
| ----------------------- | -------------------------------------------------- |
| Fullstack (default) | User wants a frontend + smart contracts |
| Contract-only | User only wants Move smart contracts (no frontend) |
| Option | When to Use |
|---|---|
| ------------------ | ----------------------------- |
| Vite (default) | Default choice, lighter setup |
| Next.js | User asks for Next.js or SSR |
| Option | When to Use |
|---|---|
| -------------------- | ------------------------------------ |
| devnet (default) | Development and testing |
| testnet | Pre-production, user explicitly asks |
| mainnet | Production, user explicitly asks |
Ask if the user has a Geomi API key. It's optional for devnet but recommended for testnet/mainnet to avoid rate limits.
Get one at https://geomi.dev (create project -> API Resource -> copy key).
# Fullstack dApp with Vite (frontend + contracts)
npx create-aptos-dapp <project-name> \
--project-type fullstack \
--template boilerplate-template \
--framework vite \
--network <network>
# Fullstack dApp with Next.js
npx create-aptos-dapp <project-name> \
--project-type fullstack \
--template boilerplate-template \
--framework nextjs \
--network <network>
# Contract-only (Move project)
npx create-aptos-dapp <project-name> \
--project-type move \
--network <network>
Optional flags:
--api-key — Pass a Geomi API key during scaffolding--use-surf — Enable Surf for type-safe contract interactionsAfter scaffolding, complete these steps in order:
cd .env is in .gitignore before any git operationsaptos init --network --assume-yes (use the same network as above)npm run move:compile && npm run move:testgit init && git add . && git commit -m "Initial commit"ALWAYS follow this workflow when the user wants to build a new Aptos app, dApp, or project. This applies regardless
of how the user phrases it ("build me a ...", "create a ...", "make a ...", "I want to build ...").
/create-aptos-project -> scaffold with npx create-aptos-dapp (this skill — NEVER skip)/write-contracts -> write Move modules/generate-tests -> create test suite, verify 100% coverage/security-audit -> audit before deployment/deploy-contracts -> deploy contract to specified network/use-ts-sdk -> orchestrates frontend integration (routes to ts-sdk-client, ts-sdk-transactions,ts-sdk-view-and-query, ts-sdk-wallet-adapter as needed)
contract/ — Move smart contract with Move.toml and starter modulefrontend/ — React app with Aptos wallet adapter pre-configuredpackage.json — Scripts for move:compile, move:test, move:publish, dev, build.env — Environment variables for network, API key, and publisher accountcontract/ — Move smart contract with Move.toml and starter modulepackage.json — Scripts for move:compile, move:test, move:publish.env — Environment variables for network and publisher accountnpx create-aptos-dapp command not found# Auto-confirm the npx package install prompt
npx --yes create-aptos-dapp <project-name> ...
If that still fails, verify Node.js and npm are installed (node -v && npm -v).
contract/Move.toml has correct named addressesaptos init --network --assume-yes if not donemy_addr is set to "_" in [addresses] sectionThe boilerplate uses my_addr = "_" which gets resolved from .env at compile time. Ensure
VITE_MODULE_PUBLISHER_ACCOUNT_ADDRESS is set in .env (populated by aptos init).
共 1 个版本