A React-based orderbook visualization tool for displaying cryptocurrency trading pairs across multiple blockchain networks. Built with React, TypeScript, and Vite.
- 📊 Real-time Orderbook Display - View live orderbook data with asks and bids
- 📈 Depth Chart Visualization - Interactive depth chart showing cumulative orderbook levels
- 🔗 Multi-Chain Support - Supports Ethereum, BSC, Arbitrum, and Base networks
- 🔒 Secure API Proxy - Vercel serverless function to hide API keys and add delays
- 🎨 Modern UI - Clean, responsive interface with merged orderbook view
- 📱 Responsive Design - Works on desktop and mobile devices
- React 19 - UI framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- Vercel - Deployment and serverless functions
- Node.js 18+ and npm
- A Native API key (get one from Native.org)
- Clone the repository:
git clone <repository-url>
cd native-orderbook-util- Install dependencies:
npm install- Create a
.envfile in the root directory:
VITE_API_KEY=your_api_key_here- Start the development server:
npm run dev- Open http://localhost:5173 in your browser
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
├── api/
│ └── orderbook.ts # Vercel serverless function (proxy)
├── src/
│ ├── components/
│ │ ├── Orderbook.tsx # Main orderbook component
│ │ └── Orderbook.css # Orderbook styles
│ ├── App.tsx
│ └── main.tsx
├── vercel.json # Vercel configuration
└── vite.config.ts # Vite configuration
This project is configured to deploy on Vercel with a serverless API proxy. See VERCEL_SETUP.md for detailed setup instructions.
Quick Setup:
- Push your code to GitHub/GitLab/Bitbucket
- Import project in Vercel Dashboard
- Set environment variable
NATIVE_API_KEYin Vercel dashboard - Deploy!
The Vercel proxy provides:
- ✅ API key security (hidden from client-side)
- ✅ 2-second delay to prevent real-time data exposure
- ✅ CORS handling
For Local Development:
VITE_API_KEY- Your Native API key (stored in.env)
For Vercel Production:
NATIVE_API_KEY- Your Native API key (set in Vercel dashboard)
- Select Chain - Choose from Ethereum, BSC, Arbitrum, or Base
- Select Trading Pair - Pick a trading pair from the dropdown
- View Orderbook - See asks (red) and bids (green) with prices, amounts, and totals
- Explore Depth Chart - Hover over the chart to see cumulative amounts and prices
- Monitor Mid Price & Spread - View real-time mid price and spread information
- Displays asks and bids in a single merged list
- Asks sorted descending (highest price first)
- Bids sorted descending (highest price first)
- Mid price and spread displayed in the middle
- Visual representation of orderbook depth
- Green area for bids (buy orders)
- Red area for asks (sell orders)
- Interactive tooltips on hover
- Cumulative amount visualization
- Automatically refreshes every 2 seconds
- Can be paused/resumed manually
- Manual update button available when paused
The project uses a Vercel serverless function (api/orderbook.ts) that:
- Proxies requests to the Native API
- Hides the API key from client-side code
- Adds a 2-second delay to prevent real-time data exposure
- Handles CORS automatically
In development, the app uses direct API calls. In production (Vercel), it uses the proxy endpoint.
This project is private and proprietary.
For issues or questions, please contact the development team.