Skip to content

Latest commit

 

History

History
81 lines (65 loc) · 3.77 KB

File metadata and controls

81 lines (65 loc) · 3.77 KB

Environment Variables — Finchippay-Solution

This document describes every environment variable used by the backend and frontend.

Copy the .env.example files and fill in the values:

cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env.local

Backend (backend/.env)

Variable Required Default Description
STELLAR_NETWORK testnet or mainnet
HORIZON_URL Stellar Horizon base URL
JWT_SECRET Secret for SEP-0010 JWT signing (min 32 chars)
ALLOWED_ORIGINS Comma-separated list of CORS-allowed origins
PORT 4000 HTTP port to listen on
NODE_ENV development development, test, or production
SENTRY_DSN Sentry DSN for error tracking (disabled if unset)
FEDERATION_DOMAIN Domain used in SEP-0002 TOML discovery
FEDERATION_SERVER_URL Override federation server URL
TURRETS_PORT 4100 Port for the Turrets side-server
TURRETS_EVALUATION_INTERVAL_MS 30000 Interval (ms) between txFunction evaluation runs
SERVER_PRIVATE_KEY Stellar secret key for SEP-0010 challenge signing (generated on startup if unset)
ANTHROPIC_API_KEY Anthropic API key for the AI payment parsing feature (/api/parse-payment). Returns 501 if unset.
OTEL_EXPORTER_OTLP_ENDPOINT OTLP collector endpoint for OpenTelemetry traces (e.g. http://jaeger:4318). Tracing is disabled when unset or in NODE_ENV=test.
OTEL_SERVICE_NAME finchippay-backend Service name reported in trace spans.

Example backend/.env

STELLAR_NETWORK=testnet
HORIZON_URL=https://horizon-testnet.stellar.org
JWT_SECRET=change-me-to-a-long-random-secret
ALLOWED_ORIGINS=http://localhost:3000,https://finchippay.vercel.app
PORT=4000
NODE_ENV=development

Frontend (frontend/.env.local)

Variable Required Default Description
NEXT_PUBLIC_STELLAR_NETWORK testnet or mainnet
NEXT_PUBLIC_HORIZON_URL Stellar Horizon base URL
NEXT_PUBLIC_API_URL Backend API base URL
NEXT_PUBLIC_CONTRACT_ID Deployed FinchippayContract contract ID (v2 with pause/upgrade/bounds)
NEXT_PUBLIC_SOROBAN_RPC_URL Soroban RPC endpoint
NEXT_PUBLIC_SENTRY_DSN Sentry DSN for client-side error tracking
NEXT_PUBLIC_SOROBAN_NETWORK_PASSPHRASE Soroban network passphrase (auto-set from network)

Example frontend/.env.local

NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org
NEXT_PUBLIC_API_URL=http://localhost:4000
NEXT_PUBLIC_CONTRACT_ID=CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org

Production Notes

  • JWT_SECRET must be at least 32 random characters. Generate one with:
    openssl rand -hex 32
  • ALLOWED_ORIGINS should list only your actual frontend domain(s). Wildcards are not supported.
  • Never commit real .env files to git. They are listed in .gitignore.
  • In Docker / CI, inject secrets via environment variables or a secrets manager — not via files.
  • For production deployments, configure ANTHROPIC_API_KEY as a GitHub repository secret and reference it in your deployment workflow as ${{ secrets.ANTHROPIC_API_KEY }}.
  • Similarly, configure JWT_SECRET, SERVER_PRIVATE_KEY, SENTRY_DSN, and NEXT_PUBLIC_SENTRY_DSN as repository secrets for production CI/CD. Never hardcode secrets in workflow files.