Files
LightningLotto/back_end/env.example
Michilis d3bf8080b6 Initial commit: Lightning Lottery - Bitcoin Lightning Network powered lottery
Features:
- Lightning Network payments via LNbits integration
- Provably fair draws using CSPRNG
- Random ticket number generation
- Automatic payouts with retry/redraw logic
- Nostr authentication (NIP-07)
- Multiple draw cycles (hourly, daily, weekly, monthly)
- PostgreSQL and SQLite database support
- Real-time countdown and payment animations
- Swagger API documentation
- Docker support

Stack:
- Backend: Node.js, TypeScript, Express
- Frontend: Next.js, React, TailwindCSS, Redux
- Payments: LNbits
2025-11-27 22:13:37 +00:00

85 lines
2.6 KiB
Plaintext

# Lightning Lottery Backend - Environment Configuration
# Copy this file to .env and fill in your values
# ======================
# Server Configuration
# ======================
PORT=3000
APP_BASE_URL=http://localhost:3000
FRONTEND_BASE_URL=http://localhost:3001
# Optional: comma-separated list to override allowed origins
# CORS_ALLOWED_ORIGINS=http://localhost:3001,https://app.yourdomain.com
NODE_ENV=development
# ======================
# Database Configuration
# ======================
# Database type: "postgres" or "sqlite"
DATABASE_TYPE=sqlite
# Database connection
# For PostgreSQL: postgresql://username:password@host:port/database
# For SQLite: ./data/lightning_lotto.db (relative path)
DATABASE_URL=./data/lightning_lotto.db
# PostgreSQL example:
# DATABASE_TYPE=postgres
# DATABASE_URL=postgresql://user:password@localhost:5432/lightning_lotto
# ======================
# LNbits Configuration
# ======================
# Your LNbits instance URL
LNBITS_API_BASE_URL=https://legend.lnbits.com
# LNbits admin/invoice key (required for creating invoices and payouts)
# Get this from your LNbits wallet settings
LNBITS_ADMIN_KEY=your_lnbits_admin_key_here
# Webhook secret for validating LNbits payment notifications
# Choose a random secret string
LNBITS_WEBHOOK_SECRET=your_webhook_secret_here
# ======================
# Security Configuration
# ======================
# Secret for signing JWT tokens (use a strong random string)
# Generate with: openssl rand -hex 32
JWT_SECRET=your_jwt_secret_here_change_in_production
# Admin API key for admin endpoints
# Generate with: openssl rand -hex 32
ADMIN_API_KEY=your_admin_api_key_here_change_in_production
# ======================
# Scheduler Configuration
# ======================
# How often to check for draws that need to be executed (in seconds)
DRAW_SCHEDULER_INTERVAL_SECONDS=60
# How often to generate future cycles (in seconds)
CYCLE_GENERATOR_INTERVAL_SECONDS=300
# ======================
# Lottery Configuration
# ======================
# Default ticket price in satoshis
DEFAULT_TICKET_PRICE_SATS=1000
# House fee percentage (0-100)
# Example: 5 means 5% fee, winner gets 95% of pot
DEFAULT_HOUSE_FEE_PERCENT=5
# Maximum Lightning payout attempts before drawing a new winner
PAYOUT_MAX_ATTEMPTS=2
# ======================
# Notes
# ======================
# - SQLite is perfect for development and testing (no setup required!)
# - Use PostgreSQL for production deployments
# - Never commit the actual .env file to version control
# - Use strong, unique secrets in production
# - Keep your LNbits keys secure
# - Test with small amounts first