https://github.com/jongan69/potion-leaderboard
Start of Entry for potion leaderboard contest
https://github.com/jongan69/potion-leaderboard
data-analysis leaderboard potion trading
Last synced: 8 days ago
JSON representation
Start of Entry for potion leaderboard contest
- Host: GitHub
- URL: https://github.com/jongan69/potion-leaderboard
- Owner: jongan69
- Created: 2025-02-13T02:41:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-16T16:59:26.000Z (over 1 year ago)
- Last Synced: 2025-02-22T22:29:40.378Z (over 1 year ago)
- Topics: data-analysis, leaderboard, potion, trading
- Language: TypeScript
- Homepage: https://potionleaderboard.xyz
- Size: 1.5 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Potion Trader Leaderboard
[Live Demo](https://potionleaderboard.xyz/)
A Next.js application that displays the leaderboard for Potion Traders on Solana, built for the Potion Competition.
## Tech Stack
- Frontend: Next.js, TailwindCSS, Tanstack Table, Radix UI, Shadcn UI
- Backend: MongoDB, Upstash, Pusher
- Integrations: Helius, Twitter API
- Wallet: Custom-styled Solana Wallet Adapter
## Features
### Leaderboard (`/`)
- Displays trader rankings with filterable columns
- Live trading feed powered by Helius webhooks and Pusher
- Twitter follower count integration
- Simplified PnL calculations
- Actions per trader:
- Copy wallet address
- View profile
### Trader Profiles (`/users/[walletAddress]`)
- Displays trader statistics and trade history
- PnL visualization with sharing capabilities
- Twitter account linking
- Wallet connection support
### Additional Pages
- `/learn` - Educational resources
- `/prizes` - Competition rewards information
## API Routes
### `/api/traders/getLeaderboard`
- Returns trader data with enhanced information:
- Live Twitter follower counts (via Raspberry Pi hosted service)
- Simplified PnL calculations
### `/api/traders/getProfile`
- Fetches single trader data using wallet address
- Handles two scenarios:
1. Existing trader: Displays stats and trade history
2. New user: Guides through wallet and Twitter connection
### `/api/twitterAuth/*`
Twitter authentication flow:
1. User initiates auth via connect button
2. Redirects to Twitter for approval
3. Callback saves user profile and wallet address to MongoDB
4. Completes authentication flow
### `/api/webhook`
Handles live trading feed data:
- Receives Helius webhook data
- Forwards to Pusher
- Updates frontend via LiveTrader component
## Setup Instructions
1. Clone the repository
2. Set up environment variables:
```bash
cp .env.example .env
# Fill in required variables
```
3. Install dependencies:
```bash
npm install
```
4. Start development server:
```bash
npm run dev
```
## Environment Variables
Required variables (add to `.env`):
### Public Environment Variables (Frontend)
- `NEXT_PUBLIC_API_URL`: http://localhost:3000
- `NEXT_PUBLIC_SOLANA_RPC_URL`:
- `NEXT_PUBLIC_PUSHER_KEY`:
- `NEXT_PUBLIC_PUSHER_CLUSTER`:
- `NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID`:
### Helius Dashboard
- `HELIUS_KEY`:
### Twitter Dashboard
- `TWITTER_API_KEY`:
- `TWITTER_API_SECRET`:
- `TWITTER_CLIENT_ID`:
- `TWITTER_CLIENT_SECRET`:
### MongoDB Dashboard
- `MONGODB_URI`:
### Upstash Dashboard
- `UPSTASH_REDIS_REST_URL`:
- `UPSTASH_REDIS_REST_TOKEN`:
### Pusher Dashboard
- `PUSHER_APP_ID`:
- `PUSHER_KEY`:
- `PUSHER_SECRET`:
- `PUSHER_CLUSTER`:
## Deployment
The demo is deployed on Vercel and can be accessed at https://potionleaderboard.xyz/