Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ E-Fantasy

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.

Expo React Native TypeScript Supabase Reanimated Platforms

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.


๐Ÿ“ธ Screenshots

Matches Team Builder Live Leaderboard
Matches screen Team builder screen Live leaderboard screen

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).


โœจ Features

Player experience

  • 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.

Fantasy gameplay

  • 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.

Design system โ€” "Turf v1.0"

  • Hand-built dual light / dark theming engine (useTheme() + per-palette makeStyles), 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.

๐Ÿ› ๏ธ Tech Stack

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

๐Ÿงฑ Architecture Highlights

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.


๐ŸŽฏ How Scoring Works

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.


๐Ÿ“ Project Structure

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

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (LTS)
  • The Expo Go app on your phone (must match the project's SDK โ€” currently SDK 54)
  • A free Supabase project

1. Clone & install

git clone https://github.com/itz-puneet/e-fantasy-app.git
cd e-fantasy-app
npm install

2. Configure environment

Create 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-KEY

Use the base project URL (no /rest/v1/ suffix). Both values are in your Supabase dashboard โ†’ Project Settings โ†’ API.

3. Set up the database

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).

4. Run

npx expo start --clear

Scan the QR code with Expo Go, or press w to open the web build.


๐Ÿ—บ๏ธ Status & Roadmap

  • โœ… 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

โš–๏ธ Disclaimer

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.


๐Ÿ‘ค Author

Built by @itz-puneet. Repository: github.com/itz-puneet/e-fantasy-app

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages