A modern web application that aggregates prediction market data from multiple platforms using the PolyRouter API.
- 📊 Real-time Markets: View markets across 7 platforms (Polymarket, Kalshi, Manifold, Limitless, ProphetX, Novig, SX.bet)
- 🏈 Sports Betting: NFL game markets with odds from multiple platforms
- 🔍 Global Search: Search markets across all platforms
- 🎨 Modern UI: Clean design with dark mode support
- 📝 API Logging: In-app request logger for debugging
- 💱 Trade Placeholder: UI for Polymarket trading (backend implementation coming soon)
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Custom shadcn/ui components
- Icons: Lucide React
- API: PolyRouter
- Node.js 18+
- npm or yarn
- Clone the repository:
git clone <your-repo-url>
cd polyrouter-markets- Install dependencies:
npm install- Create a
.env.localfile in the root directory:
POLYROUTER_API_KEY=your_api_key_here- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
POLYROUTER_API_KEY: Your PolyRouter API key (required)
Important: Never commit your .env.local file or expose your API key in client-side code. The API key is only used in server-side API routes.
├── app/
│ ├── api/
│ │ ├── polyrouter/ # Proxy routes for PolyRouter API
│ │ │ ├── markets/
│ │ │ ├── search/
│ │ │ ├── platforms/
│ │ │ └── sports/
│ │ └── trade/ # Trading endpoint (placeholder)
│ ├── layout.tsx # Root layout with theme provider
│ ├── page.tsx # Main page with tabs
│ └── globals.css # Global styles
├── components/
│ ├── ui/ # shadcn/ui components
│ ├── sports/ # Sports-specific components
│ ├── trade/ # Trading dialog component
│ ├── Header.tsx
│ ├── SearchBar.tsx
│ ├── Filters.tsx
│ ├── MarketCard.tsx
│ ├── MarketsGrid.tsx
│ └── LogDrawer.tsx
├── lib/
│ ├── polyrouter.ts # Server-side API wrapper
│ ├── clientFetch.ts # Client-side fetch with logging
│ └── utils.ts # Utility functions
└── types/
├── market.ts
├── sports.ts
├── platform.ts
└── trade.ts
All PolyRouter API calls are proxied through Next.js API routes to keep the API key secure:
GET /api/polyrouter/markets- Fetch marketsGET /api/polyrouter/search- Search marketsGET /api/polyrouter/platforms- Get platform infoGET /api/polyrouter/sports/leagues- Get league informationGET /api/polyrouter/sports/games- List available gamesGET /api/polyrouter/sports/game-markets- Get markets for a specific gamePOST /api/trade/polymarket- Place order (not implemented, returns 501)
- Install Vercel CLI:
npm i -g vercel- Deploy:
vercel- Set environment variable:
vercel env add POLYROUTER_API_KEY- Push your code to GitHub
- Go to vercel.com
- Click "New Project"
- Import your GitHub repository
- Add environment variable:
- Key:
POLYROUTER_API_KEY - Value: Your PolyRouter API key
- Key:
- Click "Deploy"
- Go to vercel.com
- Click "Add New..." → "Project"
- Import your Git repository
- Configure:
- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
.next
- Add environment variables under "Environment Variables"
- Deploy
To enable actual trading on Polymarket:
- Install wallet libraries:
npm install wagmi viem @wagmi/core- Integrate wallet connection (MetaMask, WalletConnect, etc.)
- Implement Polymarket CLOB authentication
- Complete the
lib/trading/polymarket.tsimplementation - Update the trade API route to handle real orders
- Price history charts
- Market detail pages
- User watchlists
- Email/push notifications
- More sports leagues (NBA, MLB, NHL)
- Advanced filters and sorting
- Portfolio tracking
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
For issues or questions, please open an issue on GitHub or contact the PolyRouter team.