Scaffold a sample app to get started with AI-assisted crypto development on Coinbase Developer Platform (CDP).
This guide walks you through setting up a sample app with source code to help you get started with AI-assisted crypto development on Coinbase Developer Platform (CDP).
You will be prompted to choose a template type and configure your project. This starter app works with the CDP Web SDK for embedded wallets, email authentication, and no seed phrases required.Find more detailed instructions on its setup in the Embedded Wallet Guide.
npm create onchain@latest my-defi-app
You will be prompted to choose a template type and configure your project. This starter app works with OnchainKit for external wallet connections, DeFi protocol integrations, and advanced trading features.Find more detailed instructions on its setup in the OnchainKit Getting Started Guide.
npm create onchain-agent@latest my-agent
You will be prompted to choose a template type and configure your project. This starter app works with AgentKit for building AI agents that can interact with blockchain networks, including trading, automated portfolio management, and 24/7 server-side operations.Find more detailed instructions on its setup in the AgentKit Quickstart Guide.
For complex projects that need features from multiple templates, you can start with one and use AI to integrate patterns from others:Consumer + DeFi Integration:
# Start with embedded wallet consumer appnpm create @coinbase/cdp-app@latest my-hybrid-appcd my-hybrid-app# Then ask AI to add DeFi features# "Add OnchainKit's Swap and Transaction components to enable DeFi trading while keeping embedded wallet authentication"
DeFi + AI Agent Integration:
# Start with DeFi appnpm create onchain@latest my-trading-appcd my-trading-app# Then ask AI to add automation# "Add AgentKit patterns to automate trading strategies and portfolio rebalancing"
Consumer + AI Agent Integration:
# Start with consumer appnpm create @coinbase/cdp-app@latest my-smart-walletcd my-smart-wallet# Then ask AI to add intelligent features# "Add AgentKit to create AI-powered spending insights and automated savings features"
Custom Modifications:
If no template fits perfectly, start with the closest match and modify:
# Example: DeFi app with embedded wallets instead of external wallet connectionsnpm create onchain@latest my-custom-app# Then ask AI to restructure# "Convert this OnchainKit app to use embedded wallets instead of external wallet connections, keeping all DeFi components but changing the authentication layer"
Once you have scaffolded your project, it should have come equipped with a hidden .env file.This file is used to store environment-specific variables for your development setup. It allows you to configure settings like API keys, project IDs, and network configurations without hardcoding them into your application code. This file is crucial for maintaining security and flexibility, as it keeps sensitive information out of your codebase and allows for easy changes to configuration settings.
Never commit your .env file to version control. It contains sensitive API keys that could compromise your CDP account if exposed publicly.
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.