A peer-to-peer payment application built with Next.js, Alchemy Account Kit, and AAVE Protocol. Send USDC payments to other users while optionally earning yield on your balance.
- Smart Account Wallet: Powered by Alchemy Account Kit with email-based authentication
- Instant P2P Payments: Send USDC to other users on the platform
- Yield Earning: Automatically earn interest on your balance through AAVE Protocol
- Intelligent Token Conversion: Automatically converts between USDC and aUSDC based on recipient preferences
- Gas Sponsorship: All transactions are gasless thanks to Alchemy's gas sponsorship
- Activity Feed: View all platform transactions in real-time
- Transaction History: Track all your sent and received payments
- Framework: Next.js 15 with App Router
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Database: PostgreSQL with Drizzle ORM
- Smart Accounts: Alchemy Account Kit
- DeFi Protocol: AAVE V3
- Network: Base Sepolia (testnet)
- Node.js 18+
- PostgreSQL database (local or hosted)
- Alchemy account with API key and Gas Policy ID
- Git
git clone https://github.com/alchemyplatform/chain-money-account-kit.git
cd chain-money-account-kitnpm installCopy .env.example to .env.local:
cp .env.example .env.localThen update the values:
# Database Configuration
DATABASE_URL=postgresql://user:password@host:port/database
# Alchemy Configuration
ALCHEMY_API_KEY=your-alchemy-api-key
ALCHEMY_POLICY_ID=your-alchemy-gas-policy-id- Sign up at Alchemy Dashboard
- Create a new app on Base Sepolia network
- Get your API key from the app dashboard
- Create a Gas Policy:
- Navigate to Account Kit → Gas Manager
- Create a new policy for Base Sepolia
- Copy the Policy ID
Run the database migrations:
npm run db:pushnpm run devOpen http://localhost:3000 to see the app.
Users authenticate via email using Alchemy Account Kit, which creates a smart contract wallet for each user. No seed phrases or private keys needed!
The app intelligently handles different token preferences:
- Check balances: Sender's USDC and aUSDC balances are checked
- Determine token: Based on recipient's yield preference (earning or not)
- Convert if needed:
- If recipient wants yield but sender has USDC → Convert to aUSDC via AAVE
- If recipient doesn't want yield but sender has aUSDC → Withdraw from AAVE to USDC
- Send payment: Transfer the correct token in a single atomic transaction
All operations (approve, supply/withdraw, transfer) are batched together for efficiency.
When yield earning is enabled on the /wallet page:
- USDC is deposited into AAVE Protocol
- User receives aUSDC (interest-bearing tokens)
- Balance automatically grows over time
- Can be withdrawn at any time
├── app/ # Next.js app router pages
│ ├── api/ # API routes
│ │ ├── profile/ # User profile management
│ │ ├── rpc/ # Alchemy RPC proxy
│ │ ├── transactions/ # Transaction recording
│ │ └── users/ # User listing
│ ├── send-payment/ # Payment sending page
│ ├── wallet/ # Wallet management page
│ └── page.tsx # Home page
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ └── ... # Custom components
├── contexts/ # React contexts
│ ├── smart-account-context.tsx # Account Kit integration
│ └── user-context.tsx # User profile state
├── hooks/ # Custom React hooks
├── lib/ # Utilities and configurations
│ ├── aave-abis.ts # AAVE contract ABIs
│ ├── account-kit-config.ts # Account Kit setup
│ └── constants.ts # Contract addresses
└── src/
└── db/ # Database configuration
└── schema.ts # Drizzle schema
- USDC:
0x036CbD53842c5426634e7929541eC2318f3dCF7e - aUSDC:
0xf53B60F4006cab2b3C4688ce41fD5362427A2A66 - AAVE V3 Pool:
0x07eA79F68B2B3df564D0A34F8e19D9B1e339814b
After modifying src/db/schema.ts, push changes to the database:
npm run db:pushnpx tsc --noEmitnpm run lint- Navigate to the Wallet page
- Copy your smart account address
- Get test USDC from Circle Faucet
- Select Base Sepolia network
- Paste your address
- Request 10 USDC
This app can be deployed to Vercel:
Make sure to add all environment variables from .env.example to your Vercel project settings.
- Alchemy Account Kit Documentation
- AAVE V3 Documentation
- Next.js Documentation
- Drizzle ORM Documentation
MIT