Files
FullStackTemplate/.env.example
Christian Schindler 4a6b4a0ae8 feat: Enhance security and validation in backend
- Added helmet for security headers and configured content security policy
- Implemented CORS with a whitelist for allowed origins
- Introduced express-validator for input validation in API endpoints
- Set request size limits to prevent DoS attacks
- Added global error handling and 404 response
- Updated TypeScript configuration to use node16 module resolution
- Improved Docker Compose configuration for security and resource limits
- Created a comprehensive .env.example for environment configuration
- Implemented automated security scans in CI/CD with Trivy
- Added cleanup script for debugging ports
- Established a detailed security policy document
2025-12-01 08:37:35 +01:00

119 lines
4.3 KiB
Plaintext

# =============================================================================
# Full Stack TypeScript Template - Environment Configuration
# =============================================================================
#
# SICHERHEITSHINWEISE:
# 1. Kopiere diese Datei zu '.env' und fülle die Werte aus
# 2. NIEMALS .env in Git committen! (bereits in .gitignore)
# 3. Verwende STARKE, ZUFÄLLIGE Passwörter und Secrets!
# 4. Unterschiedliche Werte für Development, Staging und Production!
#
# Generiere sichere Secrets mit:
# openssl rand -base64 32
# oder: node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
# =============================================================================
# -----------------------------------------------------------------------------
# Application Settings
# -----------------------------------------------------------------------------
NODE_ENV=production
APP_PORT=8080
# Docker Container Namen (optional)
APP_CONTAINER_NAME=fullstack-app
POSTGRES_CONTAINER_NAME=postgres-db
# Docker Image (für CI/CD)
APP_IMAGE=fullstack-app:latest
# -----------------------------------------------------------------------------
# Database Configuration (OPTIONAL)
# -----------------------------------------------------------------------------
# Dieses Template kann mit verschiedenen Datenbanken verwendet werden:
# - SQLite (Standard für einfache Projekte, keine Konfiguration nötig)
# - PostgreSQL (für Production, siehe unten)
# - MySQL, MongoDB, etc. (eigene Konfiguration)
#
# Für SQLite: Keine weiteren Einstellungen nötig!
# Die Datenbank wird automatisch im /data Volume erstellt.
# -----------------------------------------------------------------------------
# === PostgreSQL Configuration (Optional) ===
# Nur notwendig wenn PostgreSQL statt SQLite verwendet wird.
# Aktivierung:
# 1. Entkommentiere den postgres-Service in docker-compose.yml
# 2. Setze die Werte unten
# 3. Aktiviere DATABASE_URL
# POSTGRES_DB=appdb
# POSTGRES_USER=postgres
# ⚠️ KRITISCH: MUSS geändert werden! Niemals Default-Passwort verwenden!
# Beispiel für sicheres Passwort generieren:
# openssl rand -base64 32
# POSTGRES_PASSWORD=
# Optional: Für lokales Debugging (default: Port nicht exponiert)
# POSTGRES_PORT=5432
# Vollständige Database URL (nur für PostgreSQL)
# Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASE
# DATABASE_URL=postgresql://postgres:YOUR_PASSWORD@postgres:5432/appdb
# -----------------------------------------------------------------------------
# Security & Authentication
# -----------------------------------------------------------------------------
# ⚠️ KRITISCH: JWT Secret für Token-Signierung
# MUSS ein starker, zufälliger String sein (min. 32 Zeichen)
# Beispiel generieren:
# openssl rand -base64 32
JWT_SECRET=
# Optional: JWT Token Gültigkeit
JWT_EXPIRY=7d
# Optional: Session Secret (falls Sessions verwendet werden)
# SESSION_SECRET=
# -----------------------------------------------------------------------------
# Application Secrets & API Keys
# -----------------------------------------------------------------------------
# Füge hier weitere Secrets hinzu, z.B.:
# STRIPE_API_KEY=
# SENDGRID_API_KEY=
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=
# REDIS_URL=
# -----------------------------------------------------------------------------
# Development Settings (nur für lokale Entwicklung)
# -----------------------------------------------------------------------------
# Für Development-Modus setze NODE_ENV=development
# NODE_ENV=development
# APP_PORT=3000
# -----------------------------------------------------------------------------
# Beispiel für verschiedene Umgebungen:
# -----------------------------------------------------------------------------
# === DEVELOPMENT (mit SQLite) ===
# NODE_ENV=development
# APP_PORT=3000
# JWT_SECRET=dev_jwt_secret_12345 # NUR für lokales Development!
# # Keine DB-Config nötig für SQLite!
# === STAGING (mit PostgreSQL) ===
# NODE_ENV=staging
# APP_PORT=8080
# JWT_SECRET=[SICHERES_RANDOM_SECRET]
# DATABASE_URL=postgresql://postgres:[PASSWORD]@postgres:5432/appdb
# === PRODUCTION (mit PostgreSQL) ===
# NODE_ENV=production
# APP_PORT=8080
# JWT_SECRET=[SEHR_SICHERES_RANDOM_SECRET]
# DATABASE_URL=postgresql://postgres:[PASSWORD]@postgres:5432/appdb