# ============================================================================= # Prediqo — variables d'environnement (NE PAS committer le fichier .env réel) # # DÉVELOPPEMENT LOCAL avec Docker (stack identique au VPS, Postgres sur l'hôte) : # • cp .env.docker.example .env.docker # • npm run docker:local:up && npm run docker:local:migrate # • http://localhost:9080 # # DÉVELOPPEMENT LOCAL sans Docker : # • backend/.env ← copier depuis backend/.env.example (localhost:5432, port 4000) # • prediqo_web/.env ← copier depuis prediqo_web/.env.example (VITE → localhost:4000) # • Pas besoin de .env à la racine pour coder au quotidien. # • Lancer : cd backend && npm run dev | cd prediqo_web && npm run dev # # VPS (Docker Compose) : # • .env à la RACINE uniquement (copier ce fichier → .env, valeurs production) # • 1er déploiement : npm run phase-b:init (HTTP :9080) # • ou HTTPS : npm run phase-b:init:https (après certificat DNS) # • ensuite : npm run phase-b:up # • après git pull + schema.sql : npm run db:migrate # • Le .env du VPS reste sur le serveur — jamais écrasé par git pull. # ============================================================================= # Docker Compose + Phase B — copy to .env in repo root (VPS) # Migrations manuelles (base vide ou après changement de schéma) : npm run db:migrate # Frontend: cd prediqo_web && npm run dev # PostgreSQL (host — les conteneurs Docker utilisent host.docker.internal, PAS localhost) POSTGRES_USER=postgres POSTGRES_PASSWORD=your_postgres_password POSTGRES_DB=games_platform_db POSTGRES_PORT=5432 PGBOUNCER_PORT=6432 # URL pour Docker (backend dans les conteneurs) — obligatoire sur VPS : DATABASE_URL=postgresql://postgres:your_postgres_password@host.docker.internal:5432/games_platform_db # URL pour psql / outils sur l'hôte uniquement : # DATABASE_URL=postgresql://postgres:your_postgres_password@localhost:5432/games_platform_db DATABASE_PASSWORD=your_postgres_password # 1 = run schema.sql on every backend start (slow). 0 = run npm run db:migrate on deploy only (recommended). RUN_MIGRATE_ON_START=0 # Phase B ports BACKEND_PORT=4000 WS_PORT=4001 REDIS_PORT=6379 WORKER_ID=worker-1 # Backend secrets JWT_SECRET=your-super-secret-jwt-key-min-32-chars JWT_ACCESS_EXPIRY=15m JWT_REFRESH_EXPIRY=7d ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef # Optional during key rotation: previous key so decrypt() can read legacy ciphertext ENCRYPTION_KEY_PREVIOUS= # Comma-separated web origins allowed in production (e.g. https://app.prediqo.com) CORS_ORIGINS=http://localhost:5173 # Optional Cloudflare Turnstile (captcha after failed logins) TURNSTILE_SITE_KEY= TURNSTILE_SECRET_KEY= PLATFORM_MNEMONIC=word1 word2 ... word24 # Blockchain (testnet example for TRON; BSC mainnet for dual-chain USDT) TRON_NODE_URL=https://api.shasta.trongrid.io TRON_CONFIRMATIONS=3 USDT_TRC20_CONTRACT= # BSC (USDT BEP20) — use a reliable mainnet RPC in production BSC_RPC_URL=https://bsc-dataseed.binance.org BSC_CONFIRMATIONS=15 # Leave empty to use official USDT BEP20 from DB (0x55d3…7955) USDT_BEP20_CONTRACT= BSC_GETLOGS_BLOCK_RANGE=2000 # Optional: Etherscan V2 key helps auto-credit if public BSC eth_getLogs is empty # BSCSCAN_API_KEY= POLYGON_RPC_URL=https://rpc-amoy.polygon.technology POLYGON_CONFIRMATIONS=8 USDC_POLYGON_CONTRACT= ALLOW_WITHDRAWALS=false # Treasury sweeps (deposit HD → cold). Also wire these in docker-compose (recreate backend after change). SWEEP_ENABLED=false # Min on-chain raw units to enqueue (TRC20: 1e6 = 1 USDT; BEP20 uses 18-dec chain amount so 1e6 is tiny) SWEEP_MIN_AMOUNT_RAW=1000000 # SWEEP_BSC_GAS_TOPUP_WEI=1000000000000000 # SWEEP_TRON_GAS_TOPUP_SUN=15000000 RATE_LIMIT_MAX=2000 # Ports dédiés Prediqo (n'utilise pas 80/443 du VPS) PREDIQO_HTTP_PORT=9080 PREDIQO_HTTPS_PORT=9443 CERTBOT_EMAIL=your-email@example.com CERTBOT_DOMAIN1=prediqo.redirectme.net APP_PUBLIC_URL=http://prediqo.redirectme.net:9080 INITIAL_SETUP_TOKEN=your-random-setup-token-min-32-chars # Emergency Super Admin 2FA reset (CLI / Docker only — not an HTTP API). Min 32 chars; distinct from JWT/setup tokens. # Generate: node -e "console.log(require('crypto').randomBytes(48).toString('hex'))" # Leave empty to disable break-glass until you need it. BREAK_GLASS_TOKEN= # Figées au build Docker (prediqo-web) — mode HTTP VPS : VITE_API_BASE_URL=http://prediqo.redirectme.net:9080 VITE_WS_ENABLED=true VITE_WS_URL=ws://prediqo.redirectme.net:9080/ws/v1/games/candle-predict # Mode HTTPS VPS (décommenter après certificat) : # APP_PUBLIC_URL=https://prediqo.redirectme.net:9443 # VITE_API_BASE_URL=https://prediqo.redirectme.net:9443 # VITE_WS_URL=wss://prediqo.redirectme.net:9443/ws/v1/games/candle-predict # Phase B feature flags (used by Docker services) REDIS_ENABLED=true REDIS_ROUND_CACHE=true # BET_ASYNC=true enables async bet queue for WebSocket place_bet only. # HTTP single bets are always synchronous (same as multi-candle). BET_ASYNC=true WS_ENABLED=true WS_PATH=/ws/v1/games/candle-predict # Observability & upload security (optional — see deploy/PRODUCTION_SENTRY_CLAMAV.md) # SENTRY_DSN=https://...@sentry.io/... # SENTRY_TRACES_SAMPLE_RATE=0.1 # SENTRY_RELEASE=prediqo@1.0.0 # VITE_SENTRY_DSN=https://...@sentry.io/... # VITE_SENTRY_TRACES_SAMPLE_RATE=0.1 # CLAMAV_ENABLED=true # CLAMAV_HOST=clamav # CLAMAV_PORT=3310 # Optional: containerized PostgreSQL instead of host # docker compose --profile docker-db up -d