Brady Bot is a Slack/Discord bot that monitors live NBA and NFL games and alerts a channel when the 4th quarter begins if a pre-game underdog is leading and still priced at plus-money. It uses live play-by-play and odds from api-sports.io and The Odds API, and computes True Shooting % (NBA) and Success Rate (NFL) to flag when the underdog has at least a +2.0% efficiency edge over the favorite. The system is built to track 10–15 concurrent games and deliver alerts within about 15–20 seconds after the 3rd quarter ends.
- Backend: NestJS (TypeScript), TypeORM (PostgreSQL), ioredis (Redis)
- Admin UI: Next.js app under
admin-frontend/ - Integrations: Slack and Discord adapters; external API clients are isolated under
src/external/
bradybot/
├── .cursor/
│ └── rules/
│ └── rules-and-instructions.mdc # Architecture & coding conventions
├── admin-frontend/ # Next.js admin dashboard
│ ├── public/ # Static assets
│ └── src/
│ ├── app/ # App router: home, games, alerts, settings
│ ├── components/ # Shared UI (e.g. sidebar)
│ └── lib/ # Client helpers (e.g. API)
├── src/ # NestJS application
│ ├── admin/ # HTTP admin API (controller, service)
│ ├── alerts/ # Alert logic & stat utilities
│ ├── config/ # Database and shared config
│ ├── entities/ # TypeORM entities (games, odds, alerts, …)
│ ├── external/
│ │ ├── api-sports/ # api-sports.io client & module
│ │ └── odds-api/ # The Odds API client & module
│ ├── game-state/ # In-memory / domain game state
│ ├── integrations/
│ │ ├── discord/ # Discord adapter
│ │ └── slack/ # Slack adapter
│ ├── redis/ # Redis module & service
│ ├── scheduler/ # Cron jobs: preload, live polling, …
│ ├── app.module.ts
│ └── main.ts
├── package.json
├── tsconfig.json
└── README.md
From the repo root:
| Command | Purpose |
|---|---|
npm run start:dev |
Run NestJS in watch mode |
npm run build |
Compile to dist/ |
npm start |
Run compiled dist/main.js |
npm run lint |
ESLint on src/**/*.ts |
npm run test:preload |
Daily preload test script (see package.json) |
npm run test:live-games |
Live games polling test |
npm run test:get-stats-scoring |
Stats/scoring test |
npm run test:efficiency-edge-alerts |
Efficiency edge alert test |
Secrets and connection settings belong in environment variables (loaded via @nestjs/config). Database-related keys include DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_SYNCHRONIZE, and DB_LOGGING (see src/config/database.config.ts). Add API keys and Redis/Slack/Discord settings as required by your deployment; do not commit secrets.
See admin-frontend/README.md for Next.js-specific setup. Typically: cd admin-frontend && npm install && npm run dev.