ShiftMind is a production-ready, fully functional AI-powered DeFi trading bot that automatically analyzes crypto markets and executes intelligent swaps through SideShift.ai on the Polygon Network.
- ๐ค Advanced AI Analysis: RSI, MACD, Volatility, Moving Averages
- ๐ Real SideShift Integration: Instant cross-chain token swaps
- โก Polygon Network: Fast (2-3s), cheap (~$0.01 gas)
- ๐ Live Dashboard: Portfolio tracking, P&L, transaction history
- ๐ฏ 3 Trading Strategies: Safe, Balanced, Aggressive
- ๐ Non-Custodial: You control your funds 100%
- ๐ฑ Web3 Enabled: Connect via MetaMask
- React 18 - UI framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Lucide React - Icons
- Vite - Build tool
- Supabase - Database & Auth
- Edge Functions - Serverless compute
- PostgreSQL - Data storage
- Row Level Security - Access control
- Polygon Network - Fast L2 blockchain
- MetaMask - Wallet connection
- SideShift.ai - Token swap engine
- CoinGecko - Price feeds
- SideShift.ai API - Instant swaps (no account needed)
- CoinGecko API - Real-time prices (free tier)
- Polygon RPC - Blockchain interaction
# Node.js 18+
node --version
# Install dependencies
npm installnpm run devOpen http://localhost:5173 and connect your wallet!
| Guide | Purpose |
|---|---|
| QUICK_START.md | 5-minute beginner guide |
| SETUP_GUIDE.md | Initial setup walkthrough |
| PRODUCTION_SETUP.md | Complete technical docs |
1. Connect MetaMask wallet
โ
2. Choose trading strategy (Safe/Balanced/Aggressive)
โ
3. AI continuously analyzes market
โ
4. When opportunity detected:
- Generate signal with confidence score
- If auto-swap enabled โ Execute immediately
- If manual mode โ Show recommendation
โ
5. Dashboard updates with results
| Strategy | Risk | Timeframe | Best For |
|---|---|---|---|
| ๐ก๏ธ Safe | Low | 1-7 days | Beginners |
| โ๏ธ Balanced | Medium | 1-7 days | Most traders |
| ๐ Aggressive | High | 4-24 hours | Experienced |
Trigger: ETH drops 5% in 24h
Action: Auto-swap 100% to USDT (stablecoin)
Reason: Protect capital in bearish market
Trigger: SOL up 12% in 24h, RSI < 85
Action: Swap 50% ETH โ SOL
Reason: Ride the momentum wave
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Frontend (React + TypeScript) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ AppProduction.tsx โ โ
โ โ - Wallet connection โ โ
โ โ - State management โ โ
โ โ - Strategy selection โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Components โ โ
โ โ - AdvancedDashboard โ โ
โ โ - StrategySelector โ โ
โ โ - WalletConnect โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Services (Business Logic) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ swapManager.ts โ โ
โ โ - Create swaps โ โ
โ โ - Track status โ โ
โ โ - Store in DB โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ advancedAI.ts (AITrader) โ โ
โ โ - RSI calculation โ โ
โ โ - MACD analysis โ โ
โ โ - Signal generation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ prices.ts โ โ
โ โ - Fetch CoinGecko data โ โ
โ โ - Historical prices โ โ
โ โ - Volatility calc โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ sideshift.ts โ โ
โ โ - Get quotes โ โ
โ โ - Create orders โ โ
โ โ - Check status โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ External APIs & Blockchain โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ SideShift.ai โ โ
โ โ - Swap engine โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ CoinGecko โ โ
โ โ - Price data โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Polygon Network โ โ
โ โ - MetaMask transactions โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend (Supabase) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ PostgreSQL Database โ โ
โ โ - Users โ โ
โ โ - Swaps โ โ
โ โ - Signals โ โ
โ โ - Notifications โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Edge Functions โ โ
โ โ - monitor-swaps โ โ
โ โ - create-swap-order โ โ
โ โ - process-ai-signals โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
users
- Wallet address, strategy preference, auto-swap setting
- Total volume traded, profit/loss tracking
swap_transactions
- Every swap attempt (pending/completed/failed)
- Amount in/out, rates, profit/loss
market_signals
- AI-generated trading signals
- Action (buy/sell/hold/swap), confidence score
alerts_notifications
- User notifications for all events
- Swap execution, failures, milestones
portfolio_holdings
- Current token balances per user
- USD valuations, portfolio percentages
// Get swap quote
const quote = await getSwapQuote('eth', 'usdt', '1.0');
// Returns: rate, min, max amounts, expiry
// Create order
const order = await createShift('eth', 'usdt', walletAddress, '1.0');
// Returns: deposit address, settle address, order ID
// Check status
const status = await getShiftStatus(orderId);
// Returns: status (waiting/confirming/complete/error)// Get prices
const prices = await getTokenPrices(['eth', 'btc', 'matic']);
// Returns: current price, 24h/7d/30d changes, market cap
// Get history
const history = await getPriceHistory('eth', 7);
// Returns: array of prices for 7 daysImplements technical analysis indicators:
RSI (Relative Strength Index)
- Measures momentum (0-100)
-
70 = overbought (sell signal)
- < 30 = oversold (buy signal)
MACD (Moving Average Convergence Divergence)
- Trend indicator
- MACD > Signal = bullish
- MACD < Signal = bearish
Volatility
- Standard deviation of returns
- High = risky, Low = stable
- Factor into position sizing
Moving Averages
- 12-day and 26-day EMAs
- Price trends and crossovers
Score = (momentum * weight) + (volatility * weight) +
(trend * weight) + (rsi * weight)
Weight differs by strategy:
- Safe: Low momentum weight (0.1), high volatility penalty
- Balanced: Medium across the board
- Aggressive: High momentum weight (0.5), low penalties
- Private keys stay in MetaMask
- ShiftMind never touches funds
- User approves every transaction
-- Users can only see their own data
CREATE POLICY "Users can view own data"
ON users FOR SELECT
TO authenticated
USING (auth.uid() = id);- All API calls use public endpoints
- No private keys in code or database
- Environment variables for sensitive config
- Bundle size: 306 KB (gzipped: 91 KB)
- Type-safe with TypeScript
- Lazy component loading
- 3-region Supabase deployment
- Real-time subscriptions
- Indexed database queries
- Price updates: 60-second intervals
- Signal generation: On-demand
- Gas optimized: ~$0.01 per swap
npm run devnpm run build
# Creates optimized dist/ foldernpm install -g vercel
vercel# Drag dist/ folder or connect GitHub# Type checking
npm run typecheck
# Linting
npm run lint
# Build test
npm run build| Platform | Support |
|---|---|
| Desktop Chrome | โ Full |
| Desktop Firefox | โ Full |
| Desktop Safari | โ Full |
| Mobile Chrome | โ Full |
| Mobile Safari | โ Full |
| MetaMask Mobile | โ Full |
- Ethereum (ETH)
- Bitcoin (BTC)
- Polygon (MATIC)
- Solana (SOL)
- Ripple (XRP)
- Tether (USDT)
- USD Coin (USDC)
- Dai (DAI)
More tokens can be added to SUPPORTED_TOKENS array
- Connect MetaMask
- Select strategy
- Let AI trade or approve manually
- Monitor AI signals
- Adjust strategy mid-session
- Toggle auto-swap on/off
- Review transaction history
"Can't connect wallet"
- Refresh page, unlock MetaMask, try again
"Swap failed"
- Check minimum amounts, verify token pair, retry
"Prices not updating"
- Check internet connection, wait 60 seconds
"Gas fees high"
- Polygon gas is cheap, but peaks during congestion
- Mobile app (React Native)
- Multi-wallet support
- Advanced charting
- Telegram notifications
- Machine learning models
- Sentiment analysis
- Stop-loss automation
- Social trading features
- ๐ Full Documentation
- ๐ Quick Start
- ๐ง Setup Guide
ShiftMind is for educational purposes only.
Cryptocurrency trading involves substantial risk of loss. Past performance does not guarantee future results. Always do your own research and consult with financial advisors before trading.
- Not investment advice
- Use at your own risk
- Start with small amounts
- Never invest more than you can afford to lose
MIT License - See LICENSE file for details
Built with:
- React & TypeScript community
- Supabase team
- SideShift.ai
- Polygon community
- CoinGecko
npm install
npm run devVisit http://localhost:5173 and connect your wallet!
Let your crypto trade itself. ๐ค
- Lines of Code: 2,500+
- Components: 8
- Services: 6
- Database Tables: 10
- Edge Functions: 3
- API Integrations: 3
ShiftMind - AI-Powered DeFi Auto-Invest Bot
Made with โค๏ธ for the crypto community.