Skip to main content

Environment Files

Each package has its own .env file: Copy from examples:

Server Environment

Required

Optional

Solana Configuration

Keypair Setup: The SOLANA_DEPLOYER_PRIVATE_KEY is automatically decoded and written to:
  • ~/.config/solana/id.json (Solana CLI default location)
  • deployer-keypair.json (legacy location)
This happens during deployment via scripts/decode-key.ts.

Client Environment

Required

PUBLIC_PRIVY_APP_ID must match between client and server.

Production

AI Agent Environment

PM2 Production Deployment

The production duel stack uses PM2 for process management with automatic restarts:

PM2 Configuration

PM2 Commands

Stream Key Management

Stream keys must be explicitly unset and re-exported before PM2 start to avoid stale environment variables:
This ensures PM2 picks up the correct stream keys from the .env file, not stale values from the shell environment. Why This Matters:
  • Vast.ai servers can have stale stream keys in their environment from previous deployments
  • These stale values override the .env file values
  • Explicitly unsetting ensures clean environment before sourcing .env
  • Prevents streams from going to wrong channels/accounts

Maintenance Mode

The server provides a maintenance mode API for graceful deployments without data loss.

Environment Variables

API Endpoints

Enter Maintenance Mode:
Exit Maintenance Mode:
Check Status:

What Maintenance Mode Does

When maintenance mode is entered:
  1. Pauses new duel cycles - Current cycle completes, no new cycles start
  2. Locks betting markets - No new bets accepted
  3. Waits for resolution - Current market resolves before reporting safe to deploy
  4. Reports status - API returns safeToDeploy: true when ready
Safe to Deploy Conditions:
  • Not in active duel phase (FIGHTING, COUNTDOWN, ANNOUNCEMENT)
  • No pending betting markets (or all markets resolved)
  • Maintenance mode active

Helper Scripts

CI/CD Integration

The Vast.ai deployment workflow automatically uses maintenance mode:
Benefits:
  • Prevents data loss during deployments
  • Avoids market inconsistency
  • Ensures clean duel cycle boundaries
  • No interrupted streams or broken markets

AssetForge Environment

Website Environment

Port Allocation

All services have unique default ports:

Zero-Config Development

Default values work out of the box for local development:
Only configure .env files when:
  • Using Privy authentication
  • Connecting to external database
  • Deploying to production
  • Running AI agents

Debug Controls

FPS Debug Panel

Toggle the FPS debug panel with:
  • F5 (matches Minecraft’s debug screen)
  • Backslash (\) (alternative keybind)
The debug panel shows:
  • FPS (frames per second)
  • Frame time (ms)
  • Memory usage
  • Entity count
  • Network stats
The F5 keybind was added to match Minecraft’s familiar debug screen shortcut.

Privy Configuration

  1. Create account at dashboard.privy.io
  2. Create a new app
  3. Copy App ID and App Secret
  4. Set in both client and server .env files
Without Privy, the game runs in anonymous mode with temporary identities.

Security Updates

Dependency Vulnerability Fixes (commit a390b79)

Resolved 14 of 16 npm audit vulnerabilities in February 2026: Playwright (high severity):
Vite (multiple vulnerabilities):
ajv (schema validation):
Root Overrides (transitive dependencies):
Remaining Vulnerabilities:
  • bigint-buffer: No patched version available upstream
  • elliptic: No patched version available upstream
Audit Threshold:

ESLint ajv Compatibility (commit b344d9e)

Fixed ESLint crash caused by forcing ajv@8 on @eslint/eslintrc: Problem:
  • Forcing ajv>=8.18.0 override caused TypeError crash
  • @eslint/eslintrc requires ajv@6 for JSON Schema Draft-04 support
  • ajv@8 removed Draft-04 support, breaking ESLint initialization
Solution:
Impact:
  • ESLint now works correctly
  • Security fix for ajv (GHSA-2g4f-4pwh-qvx6) still applied where compatible
  • @eslint/eslintrc uses ajv@6 as required

Content Security Policy

CSP Headers

The client includes Content Security Policy headers to mitigate XSS attacks:
Security Notes:
  • 'unsafe-inline' is required for Privy SDK (injects inline styles for modals)
  • 'unsafe-eval' is required for Privy SDK (uses eval for authentication flows)
  • report-uri sends CSP violations to the server for monitoring
  • Consider migrating to CSP nonces when Privy SDK adds support
CSP violations are throttled and reported to /api/csp-report for security monitoring.

Dependency Versions

Recent dependency updates (February 2026):

TypeScript Ecosystem

Three.js and Graphics

ElizaOS

Development Tools

UI Libraries

Validation and Utilities

Blockchain

All dependency updates were merged via automated Dependabot PRs in commits 7a60135e through 55c57ed5.

GitHub Actions

The repository includes automated workflows for code quality and documentation:

Claude Code Review

Automatically reviews pull requests for bugs and code quality issues:
Features:
  • Automated code review on every PR
  • Checks for bugs and CLAUDE.md compliance
  • Posts review comments directly on PRs

Claude PR Assistant

Responds to @claude mentions in issues and PRs:
Usage:
  • Comment @claude in any issue or PR
  • Claude will respond with code suggestions
  • Can read CI results and provide context-aware help

Documentation Updates

Automatically updates documentation when manifests change:
Features:
  • Triggers on pushes to main branch
  • Analyzes recent commits for manifest changes
  • Creates PRs with documentation updates

Required Secrets

Configure these in your repository settings: