# ============================================================================= # Gitgram TimeMachine - Environment Variables # ============================================================================= # Copy this file to .env and fill in the values. # Validated at startup by src/config/env-contract.ts # # Tier legend: # [REQUIRED] -- server will NOT start without this in any environment # [PROD] -- required in production only; optional in dev/test # (no marker) -- optional with sensible default or feature disabled when absent # ============================================================================= # ── Core ───────────────────────────────────────────────────────────────────── # Runtime environment: development | staging | production | test NODE_ENV=development # HTTP port for the API server PORT=3001 # ── Database [REQUIRED] ───────────────────────────────────────────────────── # Neon PostgreSQL connection string (include ?sslmode=require for Neon) DATABASE_URL=postgresql://user:password@host/database?sslmode=require # ── Networking ─────────────────────────────────────────────────────────────── # Allowed CORS origin(s); restrict in production CORS_ORIGIN=* # AITM website URL (for redirects, billing success pages, emails) WEBSITE_URL=http://localhost:3000 # ── Auth ───────────────────────────────────────────────────────────────────── # Shared secret for website-to-API internal calls [PROD] # INTERNAL_SECRET=your-internal-secret-here # Dedicated adoption collector credential [PROD], at least 32 random characters. # ADOPTION_INGESTION_SECRET= # ADOPTION_INGESTION_SECRET_PREVIOUS= OSS_COVERAGE_MAX_AGE_HOURS=168 # JWT signing secret for session tokens (auto-generated if not set) # AITM_JWT_SECRET= # Clerk webhook secret (for user sync) # CLERK_WEBHOOK_SECRET= # ── AWS / S3 ───────────────────────────────────────────────────────────────── AWS_REGION=us-east-1 # AWS IAM credentials (leave blank for SDK default chain) # AWS_ACCESS_KEY_ID= # AWS_SECRET_ACCESS_KEY= # S3 bucket for knowledge base blobs # KB_S3_BUCKET= KB_S3_PREFIX=knowledge-base # Content size thresholds (bytes) KB_MAX_CONTENT_BYTES=500000 KB_MAX_FILE_BYTES=1048576 KB_S3_THRESHOLD_BYTES=102400 # Embeddings KB_EMBEDDINGS_ENABLED=true KB_EMBEDDING_MAX_BYTES=100000 # ── Polar.sh Billing ──────────────────────────────────────────────────────── # Get from https://polar.sh/dashboard # POLAR_ACCESS_TOKEN=polar_at_xxx # POLAR_MODE=sandbox # POLAR_WEBHOOK_SECRET=whsec_xxx # POLAR_PRO_PRODUCT_ID=prod_xxx # POLAR_TEAM_PRODUCT_ID=prod_xxx # ── Email (Resend) ────────────────────────────────────────────────────────── # Get API key from https://resend.com/api-keys # Falls back to console logging when not set # RESEND_API_KEY=re_... # ── Monitoring ─────────────────────────────────────────────────────────────── # Sentry DSN for error tracking (optional) # SENTRY_DSN= # Logging level: debug | info | warn | error # LOG_LEVEL= # API version string reported in health endpoint API_VERSION=1.0.0 # ── LLM / AI ──────────────────────────────────────────────────────────────── # At least one LLM key is recommended for AI features (oracle, research) # OPENAI_API_KEY=sk-... # ANTHROPIC_API_KEY=sk-ant-... # Voyage AI for embeddings (alternative to OpenAI) # VOYAGE_API_KEY= # ── Web Search ─────────────────────────────────────────────────────────────── # At least one search provider key enables web search # BRAVE_SEARCH_API_KEY= # SERPAPI_KEY= # SERPER_API_KEY= # FIRECRAWL_API_KEY= # ── Data Privacy ───────────────────────────────────────────────────────────── REQUIRE_EXPLICIT_CONSENT=false # ── Redis (optional) ──────────────────────────────────────────────────────── # Used for distributed rate limiting. Falls back to in-memory when not set. # REDIS_URL=redis://localhost:6379 # ── Background Workers ────────────────────────────────────────────────────── # Enable managed cron scheduler in API server (recommended for production) ENABLE_WORKERS=false DELETE_WORKER_ENABLED=false DELETE_WORKER_LIMIT=50 DELETE_WORKER_DRY_RUN=false # DELETE_WORKER_USER_ID= DELETE_CRON="*/5 * * * *" RETENTION_WORKER_ENABLED=false RETENTION_WORKER_LIMIT=100 RETENTION_WORKER_DRY_RUN=false # RETENTION_WORKER_PROJECT_ID= # RETENTION_WORKER_USER_ID= # RETENTION_WORKER_DATA_CLASS= RETENTION_CRON="0 3 * * *" GC_WORKER_ENABLED=false GC_WORKER_LIMIT=200 GC_WORKER_DRY_RUN=false GC_WORKER_OLDER_THAN_DAYS=30 # GC_WORKER_USER_ID= GC_CRON="0 4 * * 0" # ── CLI / MCP ──────────────────────────────────────────────────────────────── # API server URL for CLI/MCP connections # AITM_API_URL=http://localhost:3001 # API key for authenticating CLI/MCP requests # AITM_API_KEY= # Enable cloud sync from CLI # AITM_CLOUD_SYNC=false # Website URL for CLI auth redirects # AITM_WEBSITE_URL=https://timemachine.gitgram.app # Custom audit log directory # AITM_AUDIT_DIR= # Override AITM home directory # AITM_HOME= # Remote metrics endpoint # AITM_METRICS_ENDPOINT= # Enable experimental MCP tools (0/1) # AITM_MCP_EXPERIMENTAL=0 # Run daemon in foreground (0/1) # AITM_DAEMON=0 # Auto-start daemon (0/1) # AITM_AUTO_DAEMON=0 # Debug stack traces (0/1) # AITM_DEBUG=0 # Disable auto-listen on import (for testing) (0/1) # AITM_DISABLE_AUTOLISTEN=0 # v3 store data directory # TM_DATA_DIR=