Overview
Thecreate command is the primary entry point for create-nextjs-dapp. It scaffolds a new Next.js project pre-configured with your chosen blockchain and wallet provider.
Syntax
How It Works
The command follows a structured workflow (src/index.ts:14-61):- Displays intro - Shows the
create-nextjs-dappbanner - Parses arguments - Processes command-line flags and options
- Runs prompts - Interactively gathers missing configuration (or uses defaults with
--yes) - Generates project - Creates the project structure with selected templates
- Shows summary - Displays next steps and configuration details
- Checks for updates - Notifies if a newer version is available (cached for 24 hours)
Basic Usage
Interactive Mode
Run without arguments to start the interactive wizard:- Project name (defaults to “my-dapp”)
- Blockchain (EVM or Solana)
- Wallet provider (filtered by selected blockchain)
With Project Name
Non-Interactive Mode
Use--yes to skip all prompts and use defaults:
- Project name: “my-dapp”
- Chain: EVM
- Wallet provider: First available for chain (RainbowKit for EVM, Wallet Adapter for Solana)
- Git: Not initialized
- Install: Dependencies not installed
Full Examples
Create EVM dApp with RainbowKit
Create Solana dApp with Dynamic
Create with Git and Install Dependencies
Specify Package Manager
Complete Non-Interactive Setup
Project Name Validation
The command validates project names according to npm package naming rules (src/cli/args.ts:87-95):- Must not be empty
- Must be lowercase
- Can contain hyphens and underscores
- Cannot start with dots or underscores
- Cannot contain special characters or spaces
- Cannot be a reserved npm name
Exit Codes
The command uses standard exit codes:- 0 - Success (src/cli/args.ts:20, 25) or cancelled by user (src/cli/prompts.ts:56, 82, 127)
- 1 - Error occurred:
- Invalid arguments (src/cli/args.ts:85)
- Invalid project name (src/cli/args.ts:90-94)
- Invalid wallet/chain combination (src/cli/args.ts:34-47, 54-68)
- Directory conflicts in non-interactive mode (src/cli/prompts.ts:158)
- Wallet incompatible with chain in
--yesmode (src/cli/prompts.ts:105) - Directory not writeable (src/cli/prompts.ts:145)
- Unhandled exception (src/index.ts:60)
Behavior Details
Directory Handling
If the project directory already exists:- Interactive mode: Prompts to overwrite conflicting files
- Non-interactive mode (
--yes): Exits with error listing conflicts
package.json, next.config.js, .env.local, etc.
Package Manager Detection
If no--use-* flag is provided, the command detects the package manager:
- Checks for lock files in current directory
- Falls back to
npmif none found
bun.lockb→ Bunpnpm-lock.yaml→ pnpmyarn.lock→ Yarnpackage-lock.json→ npm
Update Notifications
The command checks for updates once per day (src/index.ts:12):Related
Command Options
Detailed documentation of all command options
Flags Reference
Complete reference of all available flags