This package contains the @coinbase/create-cdp-app CLI command, which allows developers to quickly bootstrap a React App using the CDP Web SDK.
This guide will help you get started with @coinbase/create-cdp-app. You'll learn how to create a new CDP-enabled React application with just a few commands.
Before you begin, make sure you have one of the following package managers installed:
Gather your project ID and whitelist your app from the CDP Portal:
http://localhost:3000 (or wherever your app will run)You can create a new CDP app using any of these methods:
# Using pnpm
pnpm create @coinbase/cdp-app@latest
# Using npm
npm create @coinbase/cdp-app@latest
# Using yarn
yarn create @coinbase/cdp-app@latest
The CLI will guide you through the setup process:
Currently, create-cdp-app offers the following templates:
react): A React application template that includes:
nextjs): A Next.js application template that includes:
react-native): A React Native with Expo template that includes:
You can also pass command-line arguments to pre-configure the setup process.
| Argument | Description |
|---|---|
<directory> |
Optional. The name of the directory to create the project in. Defaults to cdp-app. |
--template <name> |
Specifies the project template to use. Options: react, nextjs, react-native. |
--project-id <id> |
Your CDP Project ID from the portal. |
--account-type <type> |
Specifies the account type to configure. Options: evm-eoa (default), evm-smart, solana. |
--onramp |
Enables Coinbase Onramp. Note: This is only compatible with the nextjs template. If no template is specified, nextjs will be used automatically. If an incompatible template (e.g., react) is specified, this flag will be ignored and Onramp will be disabled. |
--no-onramp |
Disables Coinbase Onramp. |
# Create a Next.js app with EVM Smart Accounts and Onramp enabled
npm create @coinbase/cdp-app@latest my-next-app --template nextjs --project-id YOUR_PROJECT_ID --account-type evm-smart --onramp
# Create a React app with Solana support
npm create @coinbase/cdp-app@latest my-solana-app --template react --project-id YOUR_PROJECT_ID --account-type solana
# Create a React Native app with regular EVM accounts (default)
npm create @coinbase/cdp-app@latest my-mobile-app --template react-native --project-id YOUR_PROJECT_ID --account-type evm-eoa