All Projects

DeshiLeague

Multi-sport tournament platform (Cricket, Football, Badminton, Carrom, Free Fire) with live ball-by-ball scoring, real-time Socket.IO, bracket engine, and Expo push notifications.

Node.jsTypeScriptExpressPostgreSQLPrismaSocket.IOCloudinaryExpo
S Situation

DeshiLeague needed a tournament management and live-scoring platform covering five sports — Cricket, Football, Badminton, Carrom, and Free Fire esports — with real-time scoring, bracket generation, player stat tracking, and a mobile app on top.

T Task

I built the entire backend API: 32 modules, a complex relational data model, real-time WebSocket infrastructure, and the scoring engines for each sport — all serving a Next.js web app, Expo mobile app (iOS/Android), and a Vite admin dashboard from a single API.

A Actions
  • Designed and built a modular Node.js/TypeScript/Express API across 32 route modules, with Zod schemas on every DTO for runtime validation and a consistent sendResponse wrapper across all endpoints.
  • Modelled the entire domain in PostgreSQL via 16 separate Prisma schema files — 30+ entities covering the full tournament lifecycle: Users (5 roles), Organizers, Teams, Players, Tournaments, Fixtures, Matches, and sport-specific models.
  • Built a ball-by-ball cricket scoring engine tracking innings, over/ball number, batsman, non-striker, and bowler — with dismissal types (BOWLED, CAUGHT, LBW, RUN_OUT, STUMPED, HIT_WICKET, OBSTRUCTING_FIELD), extra types (WIDE, NO_BALL, BYE, LEG_BYE), boundary detection, and auto-aggregated batting/bowling stats per player.
  • Implemented a tournament bracket engine supporting both KNOCKOUT and LEAGUE formats, with fixture dependency resolution via dependsOnMatchId — so bracket slots advance automatically as match results are submitted.
  • Built a Free Fire esports module with placement + kill-point scoring configs per tournament, screenshot proof submission, and a verification workflow (PENDING → VERIFIED → DISPUTED) for result integrity.
  • Implemented Socket.IO with JWT auth middleware — real-time handlers for cricket ball-by-ball updates, football match state (timer, half tracking, live goals), and online user presence tracking with a per-userId socket room.
  • Designed a 5-role authorization system (Admin, Organizer, Manager, Player, Sponsor) with an approval workflow for organizers, role-gated route middleware, and 15-minute JWT access tokens + 30-day refresh tokens.
  • Integrated Cloudinary behind an abstract IStorageProvider interface (with a local storage fallback) for team logos, profile pictures, and tournament banners — multer handles buffering before upload.
  • Built an Expo push notification service with 3-attempt exponential backoff, batch chunking to respect Expo API limits, delivery receipt tracking, and automatic removal of DeviceNotRegistered tokens.
  • Scheduled a monthly leaderboard snapshot job with node-cron (runs at 00:01 on the 1st) that captures per-sport rankings — cricketBatsman, cricketBowler, footballGoals, and more — with period-keyed snapshots for historical leaderboards.
  • Added OTP-based phone verification (4-digit, 5-minute expiry via SMS) for registration and account recovery, with a dev mode that returns the OTP in the response for testing.
R Results
  • Single API serving Next.js web, Expo iOS/Android, and Vite admin dashboard simultaneously — live at deshileague.com with the app published on Google Play.
  • Ball-by-ball cricket scoring runs in real-time across all active matches, with stats automatically aggregated per player after each delivery.
  • Free Fire esports tournaments fully self-managed by organizers — result submission, screenshot verification, and leaderboard ranking without admin intervention.