A mobile & web game where players vote on which of two animal squads would win a hypothetical battle.
- Players vote on animal squads in hypothetical battles
- Different tiers of fights (normal, hourly, daily, weekly)
- XP rewards for voting (+25 XP if correct, +5 XP if wrong)
- Underdog bonus for backing the less popular side
- Progressive level-up system
- Real-time updates with WebSockets
- Redis caching for performance
- Backend: Node.js with Express (TypeScript)
- Database: PostgreSQL with Prisma ORM
- Caching: Redis
- Real-time: Socket.IO for WebSockets
- Testing: Jest
- Client calls GET /fights/:tier/next to fetch an open fight (tier = normal | hourly | daily | weekly).
- UI shows two sides (name, pack size, biome, AI poster) and a countdown if scheduled.
- Player taps a side → POST /vote.
- Server records the vote, awards XP immediately:
- +25 XP if correct (after fight resolves)
- +5 XP if wrong
- Underdog bonus: if ≤35% of players picked that side, award +50% XP.
- Level-up curve:
xp_needed = 100 * level^1.4.
- Normal fights: no odds shown.
- Hourly / Daily / Weekly: show public "community pick split" (updated each minute).
- All tiers reveal exact split after resolution.
- Hourly: 4 fights / day at 00, 06, 12, 18 UTC
- Daily: 2 fights / day at 03, 15 UTC
- Weekly: 1 fight / Friday 20 UTC
- Normal: unlimited, always open
- GET /fights/:tier/next - Get next available fight by tier
- POST /vote - Cast a vote on a fight
- GET /profile - Get user profile with XP progress
- GET /leaderboard/global - Get global leaderboard
- GET /leaderboard/friends - Get friends leaderboard
- POST /admin/fights/upload - Upload batch of fights (admin only)
- Node.js 14+
- PostgreSQL 12+
- Redis 6+
-
Clone the repository
git clone https://github.com/yourusername/who_will_win?.git cd who_will_win? -
Install dependencies
npm install -
Create a
.envfile based on.env.examplecp .env.example .env -
Set up the database
npm run migrate -
Generate Prisma client
npm run generate -
Start the development server
npm run dev
Run unit tests:
npm test
communityPicksUpdate- Real-time updates on community pick percentagesfightResolved- Notification when a fight resolveslevelUp- Notification when a user levels upnewFight- Announcement when a new fight becomes available
The application can be deployed as a standard Node.js application with dependencies:
- PostgreSQL database
- Redis cache
This project is proprietary software.