Skip to content

0xdivi-code/web3-casino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Haiv.Fun Casino

Casino

Aapanel/Cpanel/Plesk Casino Server Configuration Guide

Haiv Casino

DEMO 1 ย  | ย  DEMO 2 ย  | ย  DEMO 3 ย  | ย  TELEGRAM GROUP

BEWARE OF ANY FORK/LINK THAT IMPERSONATES OUR OFFICIAL ACCOUNT

๐ŸŽฐ DubCAsino - Fullstack Casino Platform

Welcome to DubCasino, a realistic and simulation-based casino backend architecture built for scale, game simulation, and API-first integration.

This project features:

  • ๐Ÿ”’ Secure JWT-based backend
  • ๐ŸŽฎ 200+ comprehensive game + admin API endpoints
  • โš™๏ธ Modular game engine (Slots, Blackjack, Roulette, Baccarat, Crash, etc.)
  • ๐Ÿ”ง Admin dashboard configuration
  • ๐ŸŽ› API-controlled everything

๐Ÿ“ Project Structure

dubcasino/
โ”œโ”€โ”€ backend/       # Node.js/Express API for game logic
โ”œโ”€โ”€ admin/         # Admin panel (React/Next.js)
โ”œโ”€โ”€ dubcasino/     # Static frontend served with http-server
โ””โ”€โ”€ README.md   

๐Ÿ“ฆ Dependencies

  • Node.js >= 16
  • MongoDB
  • Redis (optional, for sessions/queues)
  • http-server (npm install -g http-server)
  • Docker (optional)

๐Ÿš€ Getting Started

โ–ถ๏ธ Run Backend

cd backend
npm install
npm run dev

๐Ÿ”Œ Backend URL: http://localhost:4000


โ–ถ๏ธ Run Admin Panel

Contact the team directly for access to the admin panel:
Telegram: https://t.me/vicckr


โ–ถ๏ธ Run Frontend

Use http-server:

cd dubcasino
http-server -p 5000

๐Ÿ”— Access the app at: http://localhost:5000
Be sure backend is running at: http://localhost:4000


โ— CORS Setup for Backend

Modify backend/app.js:

const cors = require('cors');
app.use(cors({ origin: 'http://localhost:5000' }));
// Or, to allow all:
app.use(cors());

Restart backend after making changes.


๐Ÿ“ Frontend Directory Structure

dubcasino/
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ assets/
โ”œโ”€โ”€ src/
โ”œโ”€โ”€ static/
โ”œโ”€โ”€ wallet/
โ”œโ”€โ”€ webpack/
โ””โ”€โ”€ profile/

๐Ÿ“‚ js/auth.js (Login Example)

async function login() {
  const res = await fetch('http://localhost:4000/api/auth/login', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      email: '[email protected]',
      password: '123456'
    })
  });

  const data = await res.json();
  localStorage.setItem('token', data.token);
}

๐Ÿ“‚ js/slots.js (Spin Example)

function spinSlots() {
  const bet = parseInt(document.getElementById('betAmount').value);
  fetch('http://localhost:4000/api/game/slots/spin', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${localStorage.getItem('token')}`
    },
    body: JSON.stringify({ bet })
  })
  .then(res => res.json())
  .then(data => {
    document.getElementById('result').innerText = JSON.stringify(data, null, 2);
  });
}

๐ŸŒ Port Mapping

Service Port Description
Frontend (UI) 5000 Served by http-server
Backend (API) 4000 Node.js Express API
Admin Panel 3000 React/Next admin dashboard

โœ… Testing Checklist

  • Check browser DevTools > Network tab
  • Use console.log() to debug fetch requests
  • Test using Postman / Insomnia with full URLs
  • Use complete URLs like http://localhost:4000/api/...
  • Attach JWT session token in headers for protected routes

โš ๏ธ Common Gotchas

Problem Fix
CORS errors Enable CORS middleware in backend
401 Unauthorized login Double-check test creds and JWT
API not responding Use full backend URL from frontend
http-server shows 404 Must be run inside /dubcasino/
Game routes broken Ensure token is sent with each request

๐Ÿ”„ Optional: Auto Reload with live-server

npm install -g live-server
cd dubcasino
live-server --port=5000

Supports hot reload while developing frontend.


๐Ÿงฉ Token & Headers Helper

// utils.js

function getToken() {
  return `Bearer ${localStorage.getItem('token')}`;
}

function apiHeaders() {
  return {
    'Content-Type': 'application/json',
    'Authorization': getToken()
  };
}

๐Ÿ” Auth API

Endpoint Method Description
/api/auth/register POST Register account
/api/auth/login POST Login, get JWT
/api/auth/logout POST Logout user
/api/auth/refresh POST Refresh access token

๐Ÿ‘ค User API

Endpoint Method Description
/api/user/profile GET Get player profile
/api/user/balance GET Get current balance
/api/user/history GET Fetch game history
/api/user/deposit POST Simulate deposit
/api/user/withdraw POST Request withdrawal

๐Ÿ’ณ Wallet API

Endpoint Method Description
/api/wallet/transactions GET Transaction logs
/api/wallet/deposit POST Wallet deposit
/api/wallet/withdraw POST Wallet withdraw
/api/wallet/transfer POST User-to-user transfer

๐ŸŽฐ Game APIs (Core Casino Engine)

๐Ÿงฟ Slots

Endpoint Method Description
/api/game/slots/spin POST Spins the slot
/api/game/slots/history GET Spin history
/api/game/slots/config GET Reel setup
/api/game/slots/leaderboard GET Top winners

๐Ÿƒ Blackjack

Endpoint Method Description
/api/game/blackjack/start POST New hand
/api/game/blackjack/hit POST Request card
/api/game/blackjack/stand POST Player stands
/api/game/blackjack/double POST Double down
/api/game/blackjack/split POST Split hand

๐ŸŽฒ Baccarat

| /api/game/baccarat/start | POST | Start round | | /api/game/baccarat/history | GET | Match history |

๐Ÿ’ฅ Crash

Endpoint Method Description
/api/game/crash/bet POST Enter crash game
/api/game/crash/cashout POST Manual cashout
/api/game/crash/status GET Show current round

๐ŸŽฒ Dice

| /api/game/dice/roll | POST | Roll the dice | | /api/game/dice/history | GET | History of rolls |

๐ŸŽก Roulette

| /api/game/roulette/bet | POST | Place bet on table | | /api/game/roulette/spin | POST | Spin the wheel | | /api/game/roulette/result | GET | Last round result |

๐Ÿƒ Poker

Endpoint Method Description
/api/game/poker/join POST Join table
/api/game/poker/bet POST Place poker bet
/api/game/poker/fold POST Fold hand
/api/game/poker/action POST Perform action

โš™๏ธ Admin API

Login

| /api/admin/login | POST | Admin login | | /api/admin/logout | POST | End admin session |

๐Ÿ‘ฅ User Management

Endpoint Method Description
/api/admin/users/list GET View all users
/api/admin/users/ban POST Ban player
/api/admin/users/unban POST Unban player
/api/admin/users/adjust-balance POST Modify balance

๐ŸŽฎ Game Control

| /api/admin/games/stats | GET | Overview stats | | /api/admin/games/configure | POST | Adjust settings | | /api/admin/games/disable | POST | Disable game |

๐Ÿ’ฐ Finance

| /api/admin/finance/deposits | GET | List user deposits | | /api/admin/finance/withdrawals | GET | View withdrawals | | /api/admin/finance/payouts | POST| Manual payout trigger |


๐Ÿ“„ .env Template

PORT=4000
JWT_SECRET=supersecuretoken
DATABASE_URL=mongodb://localhost:27017/casino
TOKEN_EXPIRY=2h
ENABLE_MOCK_PAYMENTS=true

๐Ÿณ Docker Deploy (Optional)

docker-compose up --build

๐ŸŸข App ports:

Service URL
Frontend http://localhost:5000
Backend http://localhost:4000
Admin http://localhost:3000

๐Ÿ“Œ Roadmap

  • โœ… Complete JWT Auth + Game Flow
  • โœ… Slots, Blackjack, Crash, Roulette
  • โœ… Admin Dashboard
  • โœ… Bonus + Leaderboard
  • ๐Ÿ”œ WebSocket Multiplayer
  • ๐Ÿ”œ 3rd-party Game Integration

๐Ÿ’ฌ Support / Contact


Built for scale. Powered by Web3. ๐Ÿ’ฐ

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •