Install

Environment Variables

Open Astra reads all configuration from environment variables. In development, these are loaded from a .env file in the project root. In production, set them directly in your deployment environment.

The gateway will refuse to start if any required variable is missing. Run npx astra doctor to diagnose configuration issues.

Required variables

These variables are required in server mode (Docker Compose or direct npm start). The npx astra wizard generates them automatically.

VariableDescriptionExample
JWT_SECRETSecret used to sign and verify JWT tokens. Must be at least 32 characters.a-very-long-random-string
TYPESENSE_API_KEYAdmin API key for Typesense. Set the same value in Typesense startup config.change-me
INTERNAL_API_KEYSecret key for internal service-to-service calls (scheduler, heartbeat).another-random-string
PG_HOSTPostgreSQL hostnamelocalhost
PG_PORTPostgreSQL port5432
PG_DATABASEPostgreSQL database nameastra
PG_USERPostgreSQL usernameastra
PG_PASSWORDPostgreSQL passwordastra

Inference provider keys

At least one provider key must be set. The gateway will not start if zero provider keys are found.

VariableProviderPrompt caching
OPENAI_API_KEYOpenAI (GPT-4o, o1, o3)50–90%
ANTHROPIC_API_KEYAnthropic (Claude)90%
GEMINI_API_KEYGoogle Gemini90%
GROK_API_KEYxAI Grok75%
GROQ_API_KEYGroq (fast inference)None
MISTRAL_API_KEYMistral AINone
OPENROUTER_API_KEYOpenRouter (multi-provider proxy)Varies
OLLAMA_BASE_URLOllama (local models)None
VLLM_API_KEYvLLM (self-hosted) — optional; also requires endpoint in the agent configNone
AWS_REGIONAWS Bedrock (also needs AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)None

Optional variables

VariableDefaultDescription
PORT3000HTTP port for Docker Compose / production deployments
GATEWAY_PORT8080HTTP port used by npx astra (dev mode)
NODE_ENVdevelopmentSet to production for production logging
LOG_LEVELinfodebug | info | warn | error
TYPESENSE_HOSTlocalhostTypesense hostname
TYPESENSE_PORT8108Typesense port
TYPESENSE_PROTOCOLhttphttp or https
TYPESENSE_NODESComma-separated host:port list for Typesense multi-node clusters (e.g. ts1:8108,ts2:8108)
TELEGRAM_BOT_TOKENEnable Telegram channel integration
DISCORD_BOT_TOKENEnable Discord channel integration
SLACK_BOT_TOKENEnable Slack channel integration
SLACK_SIGNING_SECRETRequired with SLACK_BOT_TOKEN
WHATSAPP_PHONE_NUMBER_IDEnable WhatsApp channel integration
WHATSAPP_ACCESS_TOKENRequired with WHATSAPP_PHONE_NUMBER_ID
SIGNAL_API_URLEnable Signal channel integration
SIGNAL_PHONE_NUMBERRequired with SIGNAL_API_URL
BLUEBUBBLES_URLEnable iMessage via BlueBubbles
BLUEBUBBLES_PASSWORDRequired with BLUEBUBBLES_URL
GOOGLE_CHAT_SERVICE_ACCOUNT_KEYEnable Google Chat integration (JSON string)
WEBHOOK_URLDefault outbound webhook for agent events
WEBHOOK_SECRETHMAC secret for webhook signature verification

Secrets backend

VariableDefaultDescription
SECRET_BACKENDenvenv | vault | aws-asm — see Secrets Management
VAULT_ADDRhttp://vault:8200HashiCorp Vault base URL (Vault backend only)
VAULT_TOKENVault authentication token (Vault backend only)
SECRET_TTL_SECONDS300TTL for in-process secret cache

Auth hardening

VariableDefaultDescription
JWT_SECRET_PREVPrevious JWT secret; tokens signed with either current or previous secret are accepted during rotation
BIND_JWT_TO_DEVICEfalseBind tokens to a device fingerprint (User-Agent + IP subnet) to prevent replay attacks

gRPC mTLS

VariableDefaultDescription
GRPC_TLS_CERTPath to the server TLS certificate (PEM). If unset, gRPC starts in insecure mode.
GRPC_TLS_KEYPath to the server TLS private key (PEM)
GRPC_TLS_CAPath to the CA certificate for client cert verification (mutual TLS)

Memory and caching

VariableDefaultDescription
MEMORY_TTL_DAYS90Default TTL for daily_memory and session entries before cold-store archival
SEMANTIC_CACHE_ENABLEDfalseEnable pgvector semantic response cache — reuses responses for queries with cosine similarity ≥ 0.97
MEMORY_BACKEND_TIMEOUT_MS500Per-backend timeout for tiered memory search (Typesense + pgvector)
SPLADE_ENDPOINTURL of a SPLADE sparse embedding server for hybrid sparse+dense retrieval

Cold store

VariableDefaultDescription
COLD_STORE_BACKENDs3 | gcs | local — see Cold Store
COLD_STORE_BUCKETS3 bucket name or GCS bucket name
COLD_STORE_REGIONAWS region (S3 only)
COLD_STORE_PREFIXKey prefix for all snapshot objects (e.g. astra/memory/)

Complete example .env

bash
# Core
JWT_SECRET=replace-with-64-char-random-string
TYPESENSE_API_KEY=replace-with-secure-key
INTERNAL_API_KEY=replace-with-secure-key

# PostgreSQL
PG_HOST=localhost
PG_PORT=5432
PG_DATABASE=astra
PG_USER=astra
PG_PASSWORD=astra

# Providers (add at least one)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=AIza...

# Server
PORT=3000
NODE_ENV=development
LOG_LEVEL=info

# Optional: Channels
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...