A professional, real-time Next.js 14 dashboard for monitoring and controlling your cryptocurrency trading bot.
- Real-time Trading Positions - Live table showing open positions with P&L calculations
- Account Balance Chart - Interactive line chart displaying balance history over time
- Trade History Table - Paginated list of all executed trades with comprehensive details
- Bot Controls - Start, pause, and stop the trading bot with RPC functions
- Live Market Data - Real-time price feeds for BTC, ARB, and SOL
- Bot Status Indicator - Current status (RUNNING/PAUSED/STOPPED) with uptime tracking
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Shadcn/ui
- Database: Supabase (PostgreSQL with real-time subscriptions)
- Charts: Recharts
- Icons: Lucide React
- Node.js 18+ installed
- Supabase account and project set up
- Environment variables configured
- Install dependencies:
npm install- Create a
.env.localfile in the root directory:
cp .env.local.example .env.local- Update the
.env.localfile with your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=https://uwcjhctzwvsfmknsrooy.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_actual_anon_key_hereRun the development server:
npm run devOpen http://localhost:3000 in your browser to see the dashboard.
Build for production:
npm run build
npm startThe dashboard expects the following Supabase tables:
id: uuid (primary key)created_at: timestampsymbol: textside: text (buy/sell)type: text (market/limit)quantity: numericprice: numerictotal: numericfee: numericprofit_loss: numeric (nullable)status: text (pending/filled/cancelled)
id: uuid (primary key)symbol: textside: text (long/short)entry_price: numericcurrent_price: numericquantity: numericunrealized_pnl: numericrealized_pnl: numericpercentage_pnl: numericopened_at: timestampupdated_at: timestamp
id: uuid (primary key)timestamp: timestampbalance: numericequity: numericunrealized_pnl: numerictotal_trades: integer
id: uuid (primary key)status: text (RUNNING/PAUSED/STOPPED)uptime_seconds: integerlast_heartbeat: timestampconfig: jsonberror_message: text (nullable)
symbol: text (primary key)price: numericchange_24h: numericvolume_24h: numerichigh_24h: numericlow_24h: numericlast_updated: timestamp
The following Supabase RPC functions should be created:
start_bot()- Starts the trading botpause_bot()- Pauses the trading botstop_bot()- Stops the trading bot
The dashboard subscribes to real-time changes on:
tradestablepositionstableaccount_snapshotstablebot_statustablemarket_datatable
Enable real-time in your Supabase project for these tables.
Edit the color scheme in tailwind.config.ts:
colors: {
profit: {
DEFAULT: "hsl(142, 76%, 36%)", // Green for profits
foreground: "hsl(142, 76%, 96%)",
},
loss: {
DEFAULT: "hsl(0, 84%, 60%)", // Red for losses
foreground: "hsl(0, 0%, 100%)",
},
}Balance chart supports 24h, 7d, and 30d timeframes. Modify in components/BalanceChart.tsx.
Default shows 20 trades with "Load More" button. Adjust in components/TradeHistory.tsx.
trading-dashboard/
├── app/
│ ├── globals.css # Global styles and theme
│ ├── layout.tsx # Root layout with providers
│ └── page.tsx # Main dashboard page
├── components/
│ ├── ui/ # Shadcn/ui base components
│ │ ├── button.tsx
│ │ ├── card.tsx
│ │ ├── table.tsx
│ │ └── badge.tsx
│ ├── BalanceChart.tsx # Account balance chart
│ ├── BotControls.tsx # Bot control panel
│ ├── MarketData.tsx # Live market data cards
│ ├── PositionsTable.tsx # Open positions table
│ └── TradeHistory.tsx # Trade history table
├── lib/
│ ├── supabase.ts # Supabase client and types
│ └── utils.ts # Utility functions
├── package.json
├── next.config.js
├── tailwind.config.ts
├── tsconfig.json
└── .env.local.example
All components automatically update when data changes in Supabase without requiring page refresh.
Comprehensive error handling with user-friendly error messages displayed inline.
Skeleton loaders and spinners during data fetching for better UX.
Fully responsive layout that works on mobile, tablet, and desktop devices.
- Green for profits and long positions
- Red for losses and short positions
- Visual indicators for trends and changes
For issues or questions, please check the documentation or contact support.
MIT License - feel free to use this dashboard for your trading bot projects.