Loterias - Real-time betting management System
Web application designed to digitize and manage lottery simulations. It orchestrates a multi-tier user hierarchy to coordinate betting flows, manage distributed credits, and process payouts. It replaces manual bookkeeping with a secure, automated digital ledger, ensuring transparency and efficiency.

The Problem
The Solution
My Role
Tech Stack
Key Decisions
- 1
Server actions for mutation: Leveraged Next.js Server Actions to handle bets and transfers directly from the UI components. This reduced API boilerplate and ensured end-to-end type safety between the client forms and backend logic.
- 2
Atomic transactions: Used prisma.$transaction for all financial operations (e.g., placing a bet requires checking balance, deducting funds, and creating the ticket record simultaneously) to prevent race conditions and double-spending.
- 3
Timezone enforcement: Instead of relying on UTC or server time, the system explicitly casts all deadlines to America/Bogota. This prevents issues where a server in a different region might allow a bet after the local lottery has played.
- 4
Optimistic UI updates: Implemented revalidatePath strategies to ensure that when a seller places a bet or an admin transfers credits, the dashboards update instantly without a full page reload.
Screenshot Gallery

