Professional betting platform built with Next.js and Django.
- Frontend: Next.js 14+, TypeScript, Tailwind CSS, Zustand, shadcn-style components
- Backend: Django 5.x, Django REST Framework, JWT (Simple JWT), PostgreSQL
- Auth: Email/password, JWT, 2FA (TOTP)
picks/
├── frontend/ # Next.js App Router
├── backend/ # Django REST API
└── README.md
- Node.js >= 20.9.0 (for Next.js 16)
- Python 3.10+
- PostgreSQL (optional; SQLite used if
DATABASE_URLnot set)
-
Create and activate a virtual environment:
cd backend python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Copy
.env.exampleto.envand configure:cp .env.example .env
-
Run migrations (uses SQLite by default if
DATABASE_URLis not set):python manage.py migrate
-
Start the server:
python manage.py runserver
Backend runs at http://localhost:8000.
API documentation (Swagger):
- Swagger UI:
http://localhost:8000/api/docs/ - ReDoc:
http://localhost:8000/api/redoc/ - OpenAPI schema:
http://localhost:8000/api/schema/
Use the Authorize button in Swagger UI to add your JWT token for testing protected endpoints.
-
Install dependencies:
cd frontend npm install -
Copy
.env.local.exampleto.env.local:cp .env.local.example .env.local
-
Start the dev server:
npm run dev
Frontend runs at http://localhost:3000.
- Custom user model (email, KYC status, VIP level, 2FA)
- JWT authentication (login, register, token refresh)
- Email verification
- Two-Factor Authentication (TOTP)
- Swagger API documentation
- Dark-themed responsive UI
- Casino games: Dice, Mines, Plinko, Crash
- Live sports: Sportsbook with The Odds API (NFL, NBA, NHL, MLB, soccer, etc.)
- Bet flow: Debit wallet on bet, credit on win; BET/WIN transactions
- Dice: Over/under target, instant resolution
- Mines: 5x5 grid, reveal tiles, cash out anytime
- Plinko: Risk levels (low/medium/high), instant resolution
- Crash: Provably fair, real-time multiplier via WebSocket (Django Channels)
- Bet history: Paginated list of user bets
- WebSocket:
ws://host/ws/crash/{round_id}/?token=<jwt>for live Crash multiplier
# Terminal 1: Start backend with daphne (WebSocket support)
cd backend && daphne -b 0.0.0.0 -p 8000 config.asgi:application
# Terminal 2: Run Crash round scheduler (broadcasts multiplier)
cd backend && python manage.py run_crash_roundsFor Redis in production, set USE_REDIS=true and REDIS_URL.
- Multi-currency wallets (BTC, ETH, USDT, USD)
- Atomic balance operations with transaction.atomic()
- Crypto deposits via NowPayments
- Fiat deposits via Stripe
- Withdrawal flow with configurable auto-approval limit
- Admin approval queue for large withdrawals
- Paginated transaction history
- Webhook handlers for payment confirmation
| Variable | Description |
|---|---|
SECRET_KEY |
Django secret key |
DATABASE_URL |
PostgreSQL URL (or omit for SQLite) |
ALLOWED_HOSTS |
Comma-separated hosts |
CORS_ALLOWED_ORIGINS |
Frontend origin (e.g. http://localhost:3000) |
FRONTEND_URL |
Frontend URL for email links |
EMAIL_BACKEND |
Email backend (console for dev) |
WITHDRAWAL_AUTO_APPROVE_LIMIT_USD |
Auto-approve withdrawals below this (default 500) |
WITHDRAWAL_MIN_AMOUNT_USD |
Minimum withdrawal (default 10) |
NOWPAYMENTS_API_KEY |
NowPayments API key (crypto) |
NOWPAYMENTS_IPN_SECRET |
NowPayments webhook secret |
STRIPE_SECRET_KEY |
Stripe secret key (fiat) |
STRIPE_WEBHOOK_SECRET |
Stripe webhook secret |
BACKEND_URL |
Backend URL for webhooks (e.g. http://localhost:8000) |
| Variable | Description |
|---|---|
NEXT_PUBLIC_API_URL |
Backend API URL (e.g. http://localhost:8000/api) |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY |
Stripe publishable key for card form |