First Whale tracks pseudonymous Polymarket wallets whose first observed public trade is at least $10,000 notional.
- Node.js + TypeScript monorepo (Turbo + workspaces)
- API: Express + BullMQ + Redis + Prisma
- DB: PostgreSQL
- Frontend: Next.js + Tailwind CSS
- Provider abstraction: mock and live Polymarket providers (config flag)
- First-time bet is wallet-level and based only on public data.
- No identity/deanonymization features.
- Read-only analytics only (no trading, no private keys).
- Notional formula:
size * price. - Alert when first observed trade notional >= threshold.
apps/api: backend API + ingestion workerapps/web: dashboard UIpackages/db: Prisma schema/clientpackages/polymarket: provider abstraction (mock/live)packages/shared: shared types/env/decimal helpers
From the repo root (requires Docker):
pnpm dev:infra(same asdocker compose up -d— starts Postgres and Redis on5432and6379)
If Docker is not running, the API still starts, but the database and ingestion queue stay unavailable until Postgres/Redis are up.
After infra is up, run migrations: pnpm db:migrate, then pnpm dev.
- Copy env:
cp .env.example .env
- Start Postgres + Redis (Docker Compose, or your own). Match
DATABASE_URLandREDIS_URLin.env. - Install dependencies using your package manager (pnpm recommended by
package.json). - Generate Prisma client:
pnpm db:generate
- Run migrations:
pnpm db:migrate
- Run apps:
- API:
pnpm --filter @first-whale/api dev - Web:
pnpm --filter @first-whale/web dev
- API:
GET /api/alertswith pagination and filters:minNotional,market,side,fromDate,toDateGET /api/wallets/:addressGET /api/healthPOST /api/admin/ingestPOST /api/admin/backfillGET /api/admin/runs
- Realtime mode uses current ingestion windows.
- Backfill mode paginates deeper history and recalculates first-seen trades.
- If an older trade is found later, previous active alerts are invalidated and recomputed.
USE_MOCK_POLYMARKET=truefor MVP/demo mode.- Set
USE_MOCK_POLYMARKET=falseto use live Polymarket public APIs.
apps/api/src/detector.test.tsvalidates threshold behavior for first-time whale detection.
- Keep API and worker in separate process groups/tasks.
- Swap local Postgres/Redis with RDS + ElastiCache.
- Add CloudWatch log export from structured pino logs.
- Place API behind ALB/API Gateway and restrict admin routes.
-
Install the GitHub CLI (
gh) if needed, or use the web UI to create an empty repository (no README). -
Log in:
gh auth login -
From the repo root, create the remote and push the existing
mainbranch:gh repo create first-whale --public --source=. --remote=origin --push
If the name
first-whaleis taken, pick another (for examplefirstwhaleorfirst-whale-app).Without
gh: add the empty repo asoriginandgit push -u origin main.