YieldPilot is a production-oriented MVP for optimizing DeFi yield allocations. It connects Privy authentication, Coinbase AgentKit through Privy embedded wallets, Zapper portfolio discovery, DefiLlama yield markets, Tenderly cost estimates, a Prisma/PostgreSQL persistence layer, and an OpenAI Responses API recommendation route.
- Next.js 15, React, TypeScript
- Tailwind CSS and shadcn/ui-style local primitives
- Next.js API routes
- PostgreSQL and Prisma ORM
- Privy authentication
- Coinbase AgentKit with Privy embedded wallet execution
- Zapper GraphQL API, DefiLlama Yield API, Tenderly Simulation API
- OpenAI Responses API
- Vitest unit tests
cp .env.local.example .env.local
npm install
docker compose up -d postgres
npm run db:generate
npm run db:migrate
npm run db:seed
npm run devOpen http://localhost:3000/dashboard.
By default USE_FIXTURES=true lets the MVP run without third-party API keys. Set it to false after configuring Zapper, Tenderly, Privy, and OpenAI credentials.
npm run test/dashboard- portfolio overview, allocation chart, scenarios, recommendation panelGET /api/portfolio- portfolio overviewGET /api/portfolio?type=balances- token balancesGET /api/portfolio?type=positions- protocol positionsGET /api/opportunities- DefiLlama yield opportunitiesGET /api/scenarios- cost-adjusted conservative, balanced, and yield-maximized scenariosPOST /api/ai/recommendation- OpenAI explanation for recommendationsGET /api/agent-wallet- Coinbase AgentKit credential/status boundary
Live execution is guarded by EXECUTION_ENABLED. The execution foundation stores execution plans and steps, defines Base USDC safety caps, and fails closed unless execution is explicitly enabled. Stage 2 adds calldata builders for Aave V3 Base USDC and one allowlisted Morpho Base USDC ERC-4626 vault.
EXECUTION_ENABLED="false"
BASE_RPC_URL=""
BASE_USDC_ADDRESS="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
MORPHO_BASE_USDC_VAULT_ADDRESS=""
EXECUTION_MAX_GAS_USD="25"
EXECUTION_MAX_APPROVAL_USD="100"The Aave adapter uses the official Aave address book package for the Base Pool address. The Morpho adapter requires MORPHO_BASE_USDC_VAULT_ADDRESS and will not build deposit steps without it.
YieldPilot uses the user's Privy embedded wallet for both portfolio discovery and execution.
For Privy apps using TEE execution, automation is enabled with Privy session signers rather than the older delegated-actions hooks.
The dashboard provisions server-side access with useSessionSigners when the user clicks Enable Automation.
Required server values for automation:
PRIVY_APP_SECRET=""
PRIVY_WALLET_AUTHORIZATION_PRIVATE_KEY=""
PRIVY_DELEGATED_NETWORK_ID="base-mainnet"
NEXT_PUBLIC_PRIVY_SIGNER_ID=""
NEXT_PUBLIC_PRIVY_POLICY_IDS=""NEXT_PUBLIC_PRIVY_SIGNER_ID is the signer/key quorum ID from Privy:
- Open the Privy Dashboard.
- Select the YieldPilot app.
- Go to
Wallet infrastructure->Authorization keys. - Click
Create new key. - Copy the key quorum ID / signer ID into
NEXT_PUBLIC_PRIVY_SIGNER_ID.
The private key shown during this flow must be stored server-side only. Do not put it in a NEXT_PUBLIC_ variable.
NEXT_PUBLIC_PRIVY_POLICY_IDS is optional. Use it only after creating one or more policies in Wallet infrastructure -> Policies. For local testing it can stay empty:
NEXT_PUBLIC_PRIVY_POLICY_IDS=""For production automation, create a restrictive policy and set its policy ID:
NEXT_PUBLIC_PRIVY_POLICY_IDS="policy_id_1"See SETUP.md, ENVIRONMENT_VARIABLES.md, and ARCHITECTURE.md.