This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
gitgram-ai/gitgram/backend/.env.example
caelum0x 0fc4f141c9 feat(talent-graphrag): wire a real LLM client (Relay-first, OpenRouter fallback)
explainTalentMatch's /explain endpoints 503'd because defaultRagAsk had no
real LLM client behind it. talentGraphLlmClient.ts tries Railyard Relay
(OpenAI-compatible, same tensorzero::model_name::anthropic:: pattern
bidstage-tenders already uses) first, falling back to a direct OpenRouter
call on any Relay failure or when Relay isn't configured.

Verified against real endpoints, not mocks: a real call through Relay
(claude-haiku-4-5-20251001) returned a grounded answer citing all 3 real
subgraph edges with zero hallucinated citations; a deliberately broken
Relay key correctly triggered the OpenRouter fallback path (confirmed via
a real 401 -> real fallback attempt -> real OpenRouter 402, no credits).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-27 19:04:59 +03:00

172 lines
8.7 KiB
Plaintext

# =============================================================================
# Gitgram Backend - 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 the Express server listens on
PORT=4000
# ── Database [REQUIRED] ─────────────────────────────────────────────────────
# PostgreSQL connection string
DATABASE_URL="postgresql://gitgram:gitgram_dev@localhost:5432/gitgram"
# ── Redis (optional, falls back to in-memory cache) ─────────────────────────
REDIS_URL=redis://localhost:6379
# ── JWT [REQUIRED] ──────────────────────────────────────────────────────────
# Access token signing secret (min 32 chars in production)
JWT_SECRET=replace-with-a-strong-random-string-at-least-32-chars
# Refresh token signing secret [PROD]
JWT_REFRESH_SECRET=replace-with-another-strong-random-string-32-chars
# Token TTLs (optional)
JWT_EXPIRES_IN=15m
REFRESH_TOKEN_EXPIRES_IN=7d
# bcrypt cost factor (optional, default 12)
BCRYPT_ROUNDS=12
# ── Frontend / CORS [PROD] ──────────────────────────────────────────────────
# Base URL of the Next.js frontend (used in emails, CORS, OAuth redirects)
FRONTEND_URL=http://localhost:3000
# Comma-separated list of allowed CORS origins
CORS_ORIGIN=http://localhost:3000,http://localhost:3001,http://localhost:8081
# ── GitHub OAuth ─────────────────────────────────────────────────────────────
# Create an OAuth App at https://github.com/settings/developers
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
# Personal access token for GitHub API calls (optional)
GITHUB_TOKEN=
# Secret for verifying incoming GitHub webhook payloads (optional)
GITHUB_WEBHOOK_SECRET=
# ── Google OAuth ─────────────────────────────────────────────────────────────
# Create credentials at https://console.cloud.google.com/apis/credentials
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Redirect URI (defaults to {FRONTEND_URL}/auth/google/callback)
# GOOGLE_REDIRECT_URI=
# ── Google Maps ──────────────────────────────────────────────────────────────
# Geocoding API key (optional)
# GOOGLE_MAPS_API_KEY=
# ── AWS S3 (media uploads) ──────────────────────────────────────────────────
# Leave blank to use local file storage
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_S3_BUCKET=gitgram-uploads
AWS_REGION=us-east-1
# Storage backend: "local" for filesystem, "s3" for AWS S3
STORAGE_TYPE=local
# CDN base URL for media assets (optional)
# CDN_URL=
# Image optimization (optional, default true)
# ENABLE_IMAGE_OPTIMIZATION=true
# ENABLE_WEBP=true
# ── Polar.sh (payments) ─────────────────────────────────────────────────────
# Get access token from https://polar.sh (Organization Settings > Access Tokens)
POLAR_ACCESS_TOKEN=polar_oat_...
POLAR_WEBHOOK_SECRET=...
POLAR_PREMIUM_PRODUCT_ID=...
POLAR_CREATOR_PRODUCT_ID=...
# sandbox or production
POLAR_MODE=sandbox
# ── DodoPay (alternative payments, optional) ────────────────────────────────
# DODO_PAYMENTS_API_KEY=
# DODO_PAYMENTS_SECRET_KEY=
# DODO_WEBHOOK_SECRET=
# ── Email (Resend) ──────────────────────────────────────────────────────────
# Get API key from https://resend.com/api-keys
RESEND_API_KEY=re_...
# Sender address (optional)
EMAIL_FROM=Gitgram <noreply@gitgram.app>
# ── Monitoring ───────────────────────────────────────────────────────────────
# Sentry DSN for error tracking (optional)
SENTRY_DSN=
# Logging level: debug | info | warn | error (default: info)
# LOG_LEVEL=info
# LaunchDarkly SDK key for feature flags (optional)
# LAUNCHDARKLY_SDK_KEY=
# ── Analytics (optional) ────────────────────────────────────────────────────
# MIXPANEL_TOKEN=
# MIXPANEL_HOST=
# AMPLITUDE_API_KEY=
# AMPLITUDE_SERVER_URL=
# ── Third-party APIs ────────────────────────────────────────────────────────
# Giphy API key for GIF search (optional)
GIPHY_API_KEY=
# Jamendo API client ID for music search (optional)
# JAMENDO_CLIENT_ID=
# ── Media Processing ────────────────────────────────────────────────────────
# Temp directory for video transcoding (optional)
# VIDEO_TEMP_DIR=
# MEDIA_TEMP_DIR=
# Days before orphan media is purged (default 30)
MEDIA_RETENTION_DAYS=30
# Hours before unlinked uploads are cleaned up (default 24)
ORPHAN_MEDIA_HOURS=24
# Rate limits
MAX_DAILY_IMAGE_UPLOADS=50
MAX_DAILY_VIDEO_UPLOADS=10
# Per-user storage quota in MB (default 5120 = 5GB)
MAX_STORAGE_PER_USER_MB=5120
# NSFW detection threshold 0.0-1.0 (default 0.6)
NSFW_THRESHOLD=0.6
# ── Admin Settings ──────────────────────────────────────────────────────────
# REGISTRATION_ENABLED=true
# EMAIL_VERIFICATION_REQUIRED=true
# TWO_FACTOR_ENABLED=true
# MAINTENANCE_MODE=false
# MAX_POST_LENGTH=2000
# MAX_MEDIA_PER_POST=10
# MAX_FILE_SIZE=10485760
# RATE_LIMIT=100
# ── URLs ─────────────────────────────────────────────────────────────────────
# Public API base URL (used for webhook registration)
API_URL=http://localhost:4000
# Public app URL (used for payment return URLs)
APP_URL=http://localhost:3000
# ── AITM Integration ────────────────────────────────────────────────────────
# Gitgram TimeMachine API URL for change stories (optional)
# AITM_API_URL=
# Encryption secret for AITM data bridge (optional)
# AITM_ENCRYPTION_SECRET=
# ── Security ─────────────────────────────────────────────────────────────────
# Salt for IP hashing in bot prevention (default: gitgram)
# IP_HASH_SALT=gitgram
# Database backup directory
# BACKUP_DIR=
# Comma-separated local feature flags
# FEATURE_FLAGS=
# ── Talent GraphRAG (explainMine / explainPublic) ───────────────────────────
# Railyard Relay (OpenAI-compatible LLM gateway), tried first when both are set.
# RELAY_URL=
# RELAY_API_KEY=
# Direct fallback when Relay isn't configured or a Relay call fails.
# OPENROUTER_API_KEY=
# Model overrides (optional; sane defaults are used otherwise).
# GITGRAM_RAG_RELAY_MODEL=claude-haiku-4-5-20251001
# GITGRAM_RAG_DIRECT_MODEL=anthropic/claude-haiku-4.5