NeuroWealth 💰
AI-Powered DeFi Yield Platform on Stellar
NeuroWealth is an autonomous AI investment agent that automatically manages and grows your crypto assets on the Stellar blockchain. Deposit once, let the AI find the best yield opportunities across Stellar's DeFi ecosystem — and withdraw anytime with no lock-ups.
Overview Traditional savings accounts offer near-zero interest. Traditional DeFi is too complex for most users. NeuroWealth bridges the gap a simple chat interface web powered by an AI agent that autonomously deploys your funds into the highest-yielding, safest opportunities on Stellar.
Why Stellar?
Transaction fees of fractions of a penny — perfect for frequent AI-driven rebalancing 3–5 second finality — the AI can act on market changes instantly Native DEX + Soroban smart contracts — composable, programmable yield strategies Native USDC + XLM — borderless capital movement with no friction Growing DeFi ecosystem — Blend (lending), Templar (borrowing), RWA protocols
Features FeatureDescription🤖 AI AgentAutonomous 24/7 yield optimization across Stellar DeFi💬 Natural LanguageChat to deposit, withdraw, and check balances📈 Auto-RebalancingAgent shifts funds to best opportunities automatically🔐 Non-CustodialYour funds live in audited Soroban smart contracts⚡ Instant WithdrawalsNo lock-ups, no penalties, withdraw anytime📱 WhatsApp ReadyFull functionality through WhatsApp chat interface🌍 Global AccessNo geographic restrictions, no bank account required🛡️ Security FirstSoroban contracts with ReentrancyGuard and access controls
How It Works
- User deposits USDC via web app ↓
- Soroban vault contract receives and records the deposit ↓
- Contract emits a deposit event ↓
- AI agent detects the event and deploys funds to best protocol (e.g. Blend) ↓
- Yield accumulates 24/7 — agent rebalances hourly if better opportunities exist ↓
- User requests withdrawal anytime → agent pulls funds → sends back in seconds Three Investment Strategies
Conservative — Stablecoin lending on Blend. Low risk, steady 3–6% APY. Balanced — Mix of lending + DEX liquidity provision. Medium risk, 6–10% APY. Growth — Aggressive multi-protocol deployment. Higher risk, 10–15% APY.
Tech Stack Smart Contracts
Language: Rust (Soroban SDK 21.0.0) Standard: ERC-4626 inspired vault architecture Network: Stellar Mainnet / Testnet Security: OpenZeppelin-equivalent patterns (ReentrancyGuard, Pausable, Access Control)
Backend / AI Agent
Runtime: Node.js or Python Stellar SDK: @stellar/stellar-sdk AI: Claude API / OpenAI for natural language intent parsing Database: PostgreSQL / Supabase for user position tracking Queue: Bull / Redis for reliable transaction processing
Frontend
Framework: Next.js 15 Blockchain: Stellar SDK + Freighter wallet integration Styling: Tailwind CSS Charts: Recharts for portfolio analytics
Integrations
Yield Protocols: Blend Protocol (lending), Stellar DEX (liquidity) Price Feeds: Stellar anchor price feeds
Project Structure neurowealth/ ├── contracts/ # Soroban smart contracts (Rust) │ └── vault/ │ ├── Cargo.toml │ └── src/ │ └── lib.rs # Core vault contract ├── agent/ # AI agent backend │ ├── index.ts # Agent entry point │ ├── stellar.ts # Stellar transaction helpers │ ├── strategies/ # Yield strategy logic │ │ ├── conservative.ts │ │ ├── balanced.ts │ │ └── growth.ts │ ├── protocols/ # DeFi protocol integrations │ │ └── blend.ts │ └── nlp/ # Natural language intent parsing │ └── parser.ts ├── frontend/ # Next.js web app │ ├── app/ │ ├── components/ │ └── lib/ ├── whatsapp/ # WhatsApp bot handler │ ├── webhook.ts │ └── responses.ts ├── scripts/ # Deployment and utility scripts │ ├── deploy.sh │ └── initialize.sh └── README.md
WhatsApp Integration NeuroWealth is designed to be fully operable through WhatsApp, making it accessible to anyone with a smartphone — no wallet app or browser extension needed. User Flow
- User sends "hi" to NeuroWealth WhatsApp number
- Bot introduces itself and asks for phone number verification (OTP)
- OTP verified → agent creates a Stellar keypair for this user (custodial)
- User can now deposit, withdraw, and check balance entirely through chat
- Funds are secured in the Soroban vault contract under their wallet address Setting Up the Webhook bash# Your webhook endpoint receives WhatsApp messages POST /api/whatsapp/webhook
Example Conversation User: deposit 100 USDC Agent: Got it! Depositing 100 USDC into your Balanced strategy. This should take about 5 seconds on Stellar... ✅ Done! You're now earning ~8.4% APY. I'll optimize automatically.
User: what's my balance? Agent: 💰 Your NeuroWealth Portfolio Balance: 100.23 USDC Earnings today: +$0.23 Current APY: 8.4% Strategy: Balanced
User: withdraw everything Agent: Withdrawing 100.23 USDC... ✅ Done! Funds sent to your wallet. Arrived in 4 seconds.
- Node.js: 20.x or higher
- Yarn: 1.22.22 (managed via Corepack)
This project uses Yarn as the package manager. The version is specified in package.json:
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"Installation:
- Install Yarn globally:
npm install -g yarn - Or use Corepack (Node.js 16.9+):
corepack enable
Common Commands:
yarn install # Install dependencies
yarn dev # Start development server
yarn build # Build for production
yarn start # Start production server
yarn lint # Run ESLint
yarn typecheck # Run TypeScript type checking
yarn test # Run unit tests
yarn analyze # Run bundle analyzer (ANALYZE=true next build)
yarn qa:visual-baseline # Capture visual test baselinesTo analyze your production bundle:
ANALYZE=true yarn buildOr use the convenience script:
yarn analyzeThis generates a bundle analysis report in .next/analyze/. The output is git-ignored and intended for local development use only.
-
Clone the repository
git clone https://github.com/NeuroWealth/NeuroWealth-Frontend.git cd NeuroWealth-Frontend -
Install dependencies
yarn install
-
Configure environment variables
cp .env.example .env.local # Edit .env.local with your configuration -
Start development server
yarn dev
The app will be available at http://localhost:3000
# Public (embedded in browser bundle)
NEXT_PUBLIC_WEBHOOK_URL=http://localhost:2000
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org
# Demo Seed (for consistent mock data in demos/screenshots)
# Set to any string (e.g., "demo-123") to get deterministic random values
# Leave unset to use normal random behavior
NEXT_PUBLIC_DEMO_SEED=
# Server-only (do not expose)
# NEUROWEALTH_API_BASE_URL=http://localhost:8000
# NEUROWEALTH_PORTFOLIO_PATH=/portfolio/overview
# NEUROWEALTH_TRANSACTIONS_PATH=/transactions
AUTH_SECRET=change-me-in-productionWhen running demos or capturing screenshots, set NEXT_PUBLIC_DEMO_SEED to any string value to get deterministic random values from mock services. This ensures consistent data across runs:
NEXT_PUBLIC_DEMO_SEED=demo-123 yarn devWithout this variable set, mock services use normal random behavior.
- Install PostgreSQL (version 12 or higher)
- Create the database:
createdb neurowealth
- Run migrations:
psql -d neurowealth -f backend/migrations/001_create_users_table.sql psql -d neurowealth -f backend/migrations/002_create_deposits_table.sql
Network switching for the frontend is controlled via NEXT_PUBLIC_STELLAR_NETWORK and NEXT_PUBLIC_STELLAR_HORIZON_URL.
See:
The deposit detection system monitors user Stellar wallet addresses for incoming USDC deposits in real-time using the Horizon streaming API.
- Monitoring: When a user completes onboarding and receives a wallet address, the deposit monitor establishes a streaming connection to Horizon API
- Detection: USDC deposits are detected within 10 seconds of Stellar confirmation
- Recording: Deposits are recorded in PostgreSQL with idempotency (duplicate transactions are ignored)
- Notification: Users receive WhatsApp confirmation messages at two stages:
- "Deposit Received" - immediately after detection
- "Funds Deployed" - after AI agent deploys funds to yield strategy
- Deployment: The system emits deployment events for external AI agent handlers
- Real-time streaming with automatic reconnection
- Exponential backoff for connection failures (1s to 60s max)
- Transaction hash-based idempotency
- Atomic database transactions for portfolio updates
- Graceful error handling with user notifications
- Deposit Monitor: Streams payment events from Stellar Horizon
- Deposit Recorder: Records deposits in database with idempotency
- Deployment Coordinator: Emits deployment events and handles confirmations
- Deposit Messaging: Sends WhatsApp notifications for deposit lifecycle events
- Networks: frontend network switching config and current mainnet scope boundaries.
- Environment: server-only vs
NEXT_PUBLIC_*env, and future Edge runtime constraints. - Third-party scripts: how to add analytics/SDK scripts using
next/scriptwithout hurting LCP. - Security Policy: private vulnerability reporting process and response expectations.
-
Run linting and type checking
yarn lint yarn typecheck
-
Build the project
yarn build
-
Add
data-qaattributes to critical E2E flows- Primary CTAs
- Wallet connect buttons
- Transaction submit buttons
- See issue #160 for naming pattern
- Branch protection: Direct pushes to
mainare not allowed. All changes must go through pull requests. - Issue linkage: Link your PR to related issues using the issue tracker.
- Review process: All PRs require at least one approval before merging.
- Tests: Ensure new features include appropriate tests (unit or E2E).
- Documentation: Update relevant documentation for new features or breaking changes.
Use the appropriate issue template when reporting bugs or requesting features:
- Bug Report
- Feature Request
- Enhancement
See the issue queue for open issues and priorities.