.env file at the root of the project.
Quick Start
Copy the example environment file:.env with your configuration values.
Required Variables
Hasura Authentication
Admin secret for authenticating with the Hasura GraphQL engine.This secret is used by the code generation script to introspect the GraphQL schema and generate type-safe client code.
Public Runtime Configuration
These variables are prefixed withNUXT_PUBLIC_ and are available in both server and client contexts. They configure the domains for various 5Stack services.
The main web application domain.Used for:
- Public-facing web interface
- OAuth callbacks
- SEO and meta tags
The Hasura GraphQL API domain.The GraphQL endpoint will be available at:
WebSocket server domain for real-time features.Used for:
- GraphQL subscriptions
- Real-time match updates
- Live server status
WebRTC relay server domain for peer-to-peer connections.Used for:
- WebRTC signaling
- Peer connection establishment
- Voice/video features
Demo file storage and retrieval domain.Used for:
- CS2 demo file downloads
- Demo playback
- Match recordings
Typesense search server host.Used for:
- Full-text search
- Player/team search
- Match history search
Search Configuration
API key for authenticating with the Typesense search server.
This should be a search-only API key with read permissions. Never use the admin API key in the frontend.
Nuxt Runtime Config
These environment variables are automatically mapped to Nuxt’s runtime config. You can access them in your application code:nuxt.config.ts:125-132:
Environment-Specific Configuration
Development
For local development, you can use localhost or local network addresses:Staging
For staging environments, use staging subdomains:Production
For production, use the main domain and production subdomains:Docker Configuration
When using Docker, environment variables can be passed via:Docker Run
Docker Compose
Environment File
Security Best Practices
-
Never commit
.envfiles to version control Ensure.envis in your.gitignore: -
Use different secrets for each environment
Don’t reuse the same
HASURA_GRAPHQL_ADMIN_SECRETacross environments. - Rotate secrets regularly Update API keys and secrets periodically, especially after team member changes.
- Use environment-specific API keys Use read-only or limited-scope keys for the frontend when possible.
- Validate domain configuration Ensure domain variables match your actual infrastructure to prevent CORS issues.
Troubleshooting
GraphQL connection errors
GraphQL connection errors
Verify that:
NUXT_PUBLIC_API_DOMAINpoints to your Hasura instance- The endpoint
https://{NUXT_PUBLIC_API_DOMAIN}/v1/graphqlis accessible - CORS is configured correctly on Hasura
HASURA_GRAPHQL_ADMIN_SECRETis correct (for codegen)
WebSocket connection fails
WebSocket connection fails
Check that:
NUXT_PUBLIC_WS_DOMAINuses the correct protocol (ws:// or wss://)- WebSocket connections are not blocked by firewalls
- The WebSocket server is running and accessible
Environment variables not loading
Environment variables not loading
Try:
- Restart the development server after changing
.env - Verify the
.envfile is in the project root - Check for syntax errors in the
.envfile - Ensure variable names are exactly as specified (case-sensitive)
Codegen fails
Codegen fails
The
yarn codegen command requires:- Valid
NUXT_PUBLIC_API_DOMAIN - Correct
HASURA_GRAPHQL_ADMIN_SECRET - Network access to the Hasura instance
- The
.envfile must be sourced (command uses. ./.env)
Next Steps
Local Setup
Set up your development environment
Docker Deployment
Deploy using Docker
GraphQL API
Explore the GraphQL API schema
Tech Stack
Learn about the technology stack