Skip to content

Feature deep dives

Per-feature, formula-first walkthroughs of the high-stakes business mechanics. Each doc states the business rule, the exact formula as it lives in source, a worked numerical example, the code locations (file:line), the edge cases, and the admin-override paths. The voice models Dropbet's rakeback-guide.html template called out in ../audits/DROPBET-COMPARISON.md — formulas with worked numbers, not engineering prose.

Use these when you need the answer to "what number does the system actually pay?" rather than "how is the system implemented?".

Document form — when to use which

Three narrative shapes describe the same subsystems from different angles:

  • Feature (this folder) — business-rule / formula reference.
  • Flow (../flows/) — trace-anchored sequence walk-through (Mermaid + spans + failure modes).
  • Recipe (../recipes/) — how-to imperative ("add a thing" with numbered steps).

A given subsystem (e.g. bet placement) may appear in all three — but the flow doc owns the sequence diagram, this folder owns the formulas, the recipe owns the imperative steps. Don't duplicate across shapes; cross-link.

Files

Doc Feature Source-of-truth root
rakeback.md Volume-based cashback split into instant/daily/weekly/monthly buckets apps/api/src/rakeback/
vip-program.md Loyalty XP ladder, level-up bonuses, rakeback tier mapping, VIP application apps/api/src/user/loyalty/, apps/api/src/vip-program/
leaderboard.md USD-wager-weighted ranking, scheduled rotations, prize-pool settlement apps/api/src/leaderboard/
bonuses-and-promos.md INSTANT and DEPOSIT promo codes, wagering requirements, withdrawal locks apps/api/src/promo/
kyc-tiers.md Sumsub-backed KYC levels (LEVEL_0 → LEVEL_4), withdrawal & feature gating apps/api/src/kyc/
affiliate-program.md Five-tier revenue share with active-referral gating apps/api/src/affiliate/
bet-settlement.md Place → settle → side-effect lifecycle, RNG, BullMQ fan-out, refunds apps/api/src/bet/, libs/games/src/rng/
wallet-and-balance.md Balance + vault accounting, multi-currency, USD conversion, locks apps/api/src/accounting/

Reading conventions

  • Code citations use repo-relative-path:line_number. Paths are rooted at ebit-api/, ebit-fe/, or ebit-admin-fe/ per ../STYLE.md §3.
  • Formulas are quoted as they appear in source (TypeScript / Decimal.js). When a formula is restated in plain math, the in-source variant is also shown.
  • Worked examples use round numbers and DBC for rakeback / loyalty examples (the platform's accounting unit). USD is used wherever the source code stores USD-equivalents (leaderboards, promo wagering targets, affiliate stats).
  • {{TBD: ...}} markers flag values that are tunable from the admin panel or whose business meaning isn't captured in code; they're tracked by Doc CI per ../STYLE.md §7.
  • Player-facing flows for the same features live in ../flows/ — sequence diagrams, request bodies, websocket events.
  • Operational runbooks (how to fix a stuck rakeback claim, a leaderboard prize-payout failure) live in ../runbooks/.
  • Admin-panel UI walk-throughs live in ../admin/ (sibling agent's output).
  • The full Prisma data model behind these features is in ../data-model/.
  • Provably-fair RNG details cited from bet-settlement.md link into ../engineering/.