A full-stack, real-time Fantasy Cricket Application designed exclusively for family and friends. Host a live IPL auction, build your 11-man squads, and watch your total points dynamically update via a proprietary Dream11 points calculation engine!
- Live Auction Room: A fully functional admin-controlled auction interface to sell players and cleanly manage franchise budgets (₹100 Cr starting).
- Dream11 Points Engine: A strict T20 ruleset engine that parses live runs, wickets, strike-rates, and API bonus thresholds into accurate Fantasy Points.
- Top Performers Tracker: An elegant UI tracking the League Leaders across your franchises (Orange Cap, Purple Cap, Firepower, and Control stats).
- True 11-Man Aggregate Scoring: Unlike traditional summed scoring, the system algorithmically identifies and aggregates only the Top 11 highest-performing players per team across the season.
- Live API Match Sync: Built-in endpoints to securely hook into automated cricket APIs (like CricAPI/SportMonks) to automatically sync and distribute match payload statistics instantly.
- Next-Auth Franchise Login: Create and secure your custom franchise safely using encrypted credentials.
- Frontend: Next.js (App Router), React, Tailwind CSS v4, Lucide Icons
- Backend & Database: Next.js API Routes, SQLite, Prisma ORM
- Authentication: Next-Auth (Credentials Provider, bcrypt hashing)
- Styling: Modern Glassmorphism & High-Contrast Dark Mode
- Clone this repository to your local machine:
git clone https://github.com/YourUsername/fantasy-ipl.git
cd fantasy-ipl- Set your secret environment variables in a
.envfile. For Docker, keep the app base path pointed at/ipl:
DATABASE_URL="file:./dev.db"
NEXTAUTH_SECRET="anything_you_like"
NEXTAUTH_URL="http://localhost:3000/ipl"
NEXT_PUBLIC_BASE_PATH="/ipl"
INTERNAL_APP_URL="http://app:3000"
IPL_SCHEDULE_TIME_ZONE="America/New_York"
AUTO_SYNC_WORKER_WEEKDAY_TRIGGER_TIMES="12:30,14:30"
AUTO_SYNC_WORKER_WEEKEND_TRIGGER_TIMES="08:30,09:55,12:30,14:30"
AUTO_SYNC_WORKER_MAX_REQUESTS_PER_DAY="80"
CRICKET_API_KEY="your_cricketdata_or_cricapi_key" # Preferred for live sync and scorecards
RAPIDAPI_CRICBUZZ_KEY="your_rapidapi_key"
RAPIDAPI_CRICBUZZ_HOST="cricbuzz-cricket.p.rapidapi.com"- Build and run the production container with Docker:
npm run docker:start- Open the app at:
http://localhost:3000/ipl
The container uses npm start after the build completes, so PM2 is no longer part of the app runtime. The launcher will use docker compose if your Docker install supports it, and fall back to docker-compose otherwise.
Docker Compose also runs a dedicated sync-worker service so live match sync does not depend on frontend traffic.
The worker now sleeps between fixed trigger times instead of polling all day. By default it wakes at 12:30 and 14:30 on weekdays in America/New_York, and at 08:30, 09:55, 12:30, and 14:30 on weekends. It also stops after 80 worker hits in the current East Coast day.
If you deploy behind a different host or reverse proxy, change NEXTAUTH_URL in docker-compose.yml to match that public URL and keep the /ipl base path.
If you want the hot-reload dev server instead of Docker, use:
npm install
npx prisma db push
npm run devThe app prefers Cricket Data / CricAPI when CRICKET_API_KEY is configured, and falls back to Cricbuzz via RapidAPI when needed.
- Configure
CRICKET_API_KEYwith your Cricket Data / CricAPI key for primary scorecard and match detection. - Configure
RAPIDAPI_CRICBUZZ_KEYas the fallback provider. - Keep
RAPIDAPI_CRICBUZZ_HOST="cricbuzz-cricket.p.rapidapi.com". - Auto-sync waits until 10 overs are completed before syncing a detected live match.
- If live over data is unavailable, the manual fallback delay defaults to 60 minutes.