A cross-platform, free-to-play fantasy esports app for BGMI โ draft a roster of pro players, pick a Captain & Vice-Captain, join contests, and climb live leaderboards. 100% virtual currency โ no real money, no payments, no gambling.
E-Fantasy is a full-stack mobile app built with Expo / React Native on the front end and Supabase (PostgreSQL) on the back end. Every piece of game and economy logic โ roster validation, contest entry, prize payouts, refunds, and fantasy scoring โ runs server-side inside secured Postgres functions, protected by Row-Level Security, so the client can never tamper with balances or results.
| Matches | Team Builder | Live Leaderboard |
|---|---|---|
Design previews of the live app (dark theme shown โ a light theme ships too). To showcase real device captures, replace the files in docs/screenshots/ with your own PNGs (see that folder's README).
- Email + password auth with a session guard that routes users in/out of the app automatically.
- Virtual wallet โ every new player receives 1,000 E-Tokens on sign-up, with a full transaction history (entry fees, winnings, refunds).
- Match hub with live status pills (Upcoming ยท LIVE ยท Completed) and a game toggle (BGMI live, Valorant "coming soon").
- "My Contests" and tournament leaderboards with your best-team summary and live rank.
- Team builder โ pick 12 players + 1 esports team, then assign a Captain (2ร) and Vice-Captain (1.5ร).
- Multi-team & multi-entry โ build multiple rosters and enter the same contest with more than one team.
- Contests with configurable entry fees; the prize pool is the sum of all entry fees, paid out to winners when a match is finalized.
- Guardrails: you can't build teams for live/completed matches, and you can't join a contest after its match has started.
Admin console (hidden, role-gated)
- Tap-to-score dashboard โ quickly log kills / knocks / self-knocks per player; fantasy points recompute instantly.
- Finish & Pay Winners โ one action finalizes a match and atomically distributes the prize pool.
- In-app content management โ create matches, players, teams, and contests without touching the database.
- Set matches live, and delete a tournament with full entry-fee refunds.
- Optional cron job auto-deletes matches 5 days after completion.
- Hand-built dual light / dark theming engine (
useTheme()+ per-palettemakeStyles), with a System / Light / Dark toggle persisted across launches. - Manrope typography applied app-wide, plus Reanimated 4 micro-animations: button press feedback, a pulsing LIVE dot, staggered list entrances, and animated leaderboard rank changes.
| Layer | Technology |
|---|---|
| Language | TypeScript |
| Mobile framework | Expo (SDK 54) ยท React Native 0.81 ยท React 19 |
| Navigation | Expo Router (file-based) |
| Animation | React Native Reanimated 4 + Worklets |
| Typography | Manrope (@expo-google-fonts) |
| Backend | Supabase โ PostgreSQL, Auth, Row-Level Security |
| Business logic | PL/pgSQL SECURITY DEFINER functions (RPCs) |
| State/Storage | React Context ยท AsyncStorage |
| Targets | iOS ยท Android ยท Web |
Secure-by-design backend. Row-Level Security is enabled on all 12 tables, with 15 policies: 12 are read-only, and the only direct writes a client can make are to its own profile and its own rosters. Wallets, the transaction ledger, and contest entries have no INSERT/UPDATE policies at all โ those mutations flow through 15 SECURITY DEFINER PL/pgSQL functions (e.g. join_tournament, save_roster, finalize_match, admin_delete_tournament). The client calls typed RPCs; the database enforces the rules. A user physically cannot mint tokens, alter someone else's roster, or read another player's private wallet.
Atomic virtual economy. Wallet debits (entry fees), credits (prize payouts), and refunds run inside single database transactions, so balances can never drift or double-pay โ even under concurrent contest joins.
Deterministic fantasy scoring. Points are derived from a configurable scoring_rules table and computed entirely in SQL, applying Captain/Vice-Captain multipliers before ranking.
A theming engine that solves a real RN constraint. Because RN 0.81 + React 19 render Text as a plain function component (so the classic Text.render font override silently no-ops), the global Manrope default is applied by wrapping the JSX runtime (jsx / jsxs / jsxDEV) to inject the correct weight-mapped font family โ while short-circuiting on explicit fontFamily so icon glyphs stay intact.
Each player's base points come from their in-game stats:
| Event | Points |
|---|---|
| Kill | +5 |
| Knock (down) | +5 |
| Self-knock | โ5 |
A roster's total is the sum of its players' base points, with role multipliers applied:
roster points = ฮฃ ( player_base_points ร role_multiplier )
role_multiplier = 2.0ร if Captain
1.5ร if Vice-Captain
1.0ร otherwise
All values live in the scoring_rules table and can be tuned without a code change.
E-fantasy-app/
โโโ app/ # Screens (Expo Router, file-based routing)
โ โโโ _layout.tsx # Root: fonts, theming, auth session guard
โ โโโ (auth)/ # Login / Register
โ โโโ (tabs)/ # Matches ยท My Contests ยท Wallet ยท Profile
โ โโโ match/[id].tsx # Match details + contests
โ โโโ tournament/[id].tsx # Contest details + Join
โ โโโ team/[matchId].tsx # Team builder (12 players + 1 team, C/VC)
โ โโโ leaderboard/[id].tsx # Live ranked leaderboard
โ โโโ admin/ # Role-gated scoring & content management
โโโ components/ # Reusable UI (cards, buttons, animations)
โโโ constants/theme.tsx # Dual-theme engine + design tokens
โโโ lib/ # Supabase client, auth context, fonts, formatters
โโโ supabase/ # Backend as ordered SQL migrations
โ โโโ 01_schema.sql # Tables, RLS, 1,000-token signup bonus
โ โโโ 02_functions.sql # Game + admin logic (scoring, join, payoutโฆ)
โ โโโ 03_seed.sql # Sample data + admin bootstrap
โ โโโ 04_cleanup_cron.sql # Optional auto-cleanup job
โโโ docs/design-systems/ # Design-system research & the "Turf v1.0" spec
- Node.js (LTS)
- The Expo Go app on your phone (must match the project's SDK โ currently SDK 54)
- A free Supabase project
git clone https://github.com/itz-puneet/e-fantasy-app.git
cd e-fantasy-app
npm installCreate a .env file in the project root (it is gitignored โ never commit real keys):
EXPO_PUBLIC_SUPABASE_URL=https://YOUR-PROJECT.supabase.co
EXPO_PUBLIC_SUPABASE_ANON_KEY=YOUR-ANON-KEYUse the base project URL (no
/rest/v1/suffix). Both values are in your Supabase dashboard โ Project Settings โ API.
In the Supabase dashboard โ SQL Editor, run the files in supabase/ in order:
01_schema.sql โ 02_functions.sql โ 03_seed.sql โ 04_cleanup_cron.sql (optional)
Then, in Authentication โ Providers โ Email, disable "Confirm email" so sign-up logs users in immediately. To grant yourself admin, set your email in 03_seed.sql before running it (or update profiles.is_admin afterwards).
npx expo start --clearScan the QR code with Expo Go, or press w to open the web build.
- โ Auth, wallet, matches, team builder, contests, live leaderboards
- โ Admin scoring dashboard, payouts, refunds, in-app content management
- โ "Turf v1.0" dual-theme design system + Manrope typography + Reanimated motion
- ๐ Valorant support ยท push notifications ยท real-time leaderboard subscriptions
E-Fantasy is a free-to-play game for entertainment only. All "E-Tokens" are virtual, have no cash value, and cannot be purchased, redeemed, or exchanged. There is no gambling and no real-money transaction of any kind.
Built by @itz-puneet. Repository: github.com/itz-puneet/e-fantasy-app