HypeTerminal is a web-based trading terminal for Hyperliquid, a decentralized perpetual exchange. It provides professional-grade trading features including real-time order books, TradingView charts, multi-wallet support, and advanced order types.
| Category | Technologies |
|---|---|
| Framework | React 19, TanStack Start, TypeScript 5.7, Vite 7 |
| Routing | TanStack Router (file-based) |
| State | Zustand (persisted), TanStack Query |
| Styling | Tailwind CSS 4, Radix UI, shadcn/ui |
| Web3 | Wagmi 3, Viem, @nktkas/hyperliquid SDK |
| Charts | TradingView Charting Library |
| Forms | React Hook Form, Zod |
| i18n | Lingui (6 languages) |
| Testing | Vitest |
| Linting | Biome |
src/
├── components/ # React components
│ ├── trade/ # Trading UI (chart, orderbook, positions, order-entry)
│ ├── ui/ # Reusable primitives (button, dialog, input, etc.)
│ └── pages/ # Page-level components
├── config/ # App configuration and constants
├── domain/ # Business logic (calculations, derivations)
├── hooks/ # React hooks (trade/, ui/)
├── lib/ # Utilities
│ ├── hyperliquid/ # Exchange integration (clients, hooks, signing)
│ ├── trade/ # Trading calculations (numbers, orders, orderbook)
│ ├── chart/ # TradingView datafeed
│ └── performance/ # Monitoring utilities
├── providers/ # React context providers
├── routes/ # File-based routing
├── stores/ # Zustand state stores
├── types/ # TypeScript definitions
└── locales/ # i18n translations
- One component per file
- No index.ts barrel files - import directly
- Props interface always named
Props - Use function declarations over arrows
- Use
cn()from@/lib/cnfor class composition - No comments - code should be self-documenting
- No console.log in production
useEffect- Only for side effects (subscriptions, DOM, external APIs)useMemo- Only for expensive calculations or referential equalityuseState- Prefer primitives over complex objectsuseCallback- Only when passing to memoized children
useInfo*hooks - One-time data fetchesuseSub*hooks - Real-time WebSocket subscriptionsuseAction*hooks - Mutations (orders, transfers)- Process data in
lib/, not components
Zustand stores in src/stores/:
useMarketStore- Selected market, favoritesuseOrderEntryStore- Order form stateuseGlobalSettingsStore- User preferences
- Tailwind CSS with custom color tokens in
src/styles.css - Radix UI for accessible primitives
- CVA for component variants
- Mobile breakpoint: 768px
| File | Purpose |
|---|---|
src/routes/__root.tsx |
Root layout |
src/providers/root.tsx |
Provider composition |
src/config/constants.ts |
Global constants |
src/lib/trade/numbers.ts |
Precise arithmetic (Big.js) |
src/lib/hyperliquid/clients.ts |
API client singletons |
src/lib/format.ts |
Number/currency formatting |
User Input → React Component → Zustand Store / React Hook Form
↓
TanStack Query + Hyperliquid Hooks
↓
HTTP/WebSocket → Hyperliquid API
pnpm dev # Start dev server (port 3000)
pnpm build # Production build
pnpm lint # Run Biome linter
pnpm format # Format code
pnpm check # Full checks (lint + format)
pnpm test # Run tests- Create file in appropriate directory (
components/trade/,components/ui/) - Export with
interface Propsfor props - Use
cn()for conditional classes - Move complex logic to
lib/utilities
- Data fetching: Add to
src/lib/hyperliquid/hooks/info/ - Subscriptions: Add to
src/lib/hyperliquid/hooks/subscription/ - Mutations: Add to
src/lib/hyperliquid/hooks/exchange/ - UI utilities: Add to
src/hooks/ui/
- Create store in
src/stores/use-{name}-store.ts - Use Zustand with persist middleware if needed
- Add Zod schema for validation
Always use Big.js for financial calculations:
import Big from "big.js";
const result = Big(price).times(quantity).toFixed(2);- TypeScript strict mode enabled
- Biome for linting and formatting
- Pre-commit hooks via Lefthook:
biome- Auto-fixes imports and formatting on staged fileslingui-extract- Extracts i18n stringscommitlint- Validates commit message format
- Conventional commits enforced
- Hyperliquid API - Exchange data and order execution
- TradingView - Professional charting
- Wallet Providers - MetaMask, WalletConnect, Coinbase, Rabby
- Arbitrum - Token deposits via bridge
- Code splitting via TanStack Router lazy loading
- Virtual scrolling for large lists (TanStack Virtual)
- WebSocket batch updates for real-time data
- Bundle splitting: vendor-radix, vendor-tanstack, vendor-charts, vendor-web3