Skip to main content

Configuration & Environment Variables

This guide describes how to configure the Tower Defense project for different environments.

1. Environment Variables (.env)

The project uses a .env file for local development configuration. For staging and production, use the platform's environment variable settings (e.g., GitHub Secrets, Vercel Env Vars).

Database Configuration

  • DATABASE_URL: mysql://user:password@localhost:3306/tower_defense
  • DB_HOST: Database host.
  • DB_PORT: Database port.
  • DB_USER: Database username.
  • DB_PASSWORD: Database password.
  • DB_NAME: Database name.

Authentication Configuration

  • AUTH_SECRET: A long, random string for JWT signing and session management.
  • BETTER_AUTH_URL: The URL where your backend is hosted (e.g., http://localhost:3000).

Email Configuration

  • SMTP_HOST: Host for outgoing emails (e.g., localhost for smtp4dev).
  • SMTP_PORT: Port for outgoing emails (e.g., 25 or 587).
  • SMTP_USER: SMTP username (if required).
  • SMTP_PASS: SMTP password (if required).
  • EMAIL_FROM: The default "From" address for transactional emails.

2. Nx Project Configuration

Global Nx settings are defined in nx.json. Project-specific settings are in their respective project.json files.

  • nx.json: Cache settings, project graph, and task runners.
  • apps/game/project.json: Angular build and serve targets.
  • apps/api/project.json: NestJS build and serve targets.

3. Docusaurus Configuration

Documentation-specific settings are found in apps/docs/docusaurus.config.ts.

warning

Never commit sensitive information like database passwords or API secrets to the repository. Always use environment variables.