Surqo’s backend configuration is managed entirely through environment variables loaded by Pydantic Settings (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ricardomb-tech/surqo/llms.txt
Use this file to discover all available pages before exploring further.
pydantic-settings). On startup, app/config.py reads every variable from the process environment (or a .env file at the project root) and validates them with strict types — a missing required variable raises an error immediately rather than failing silently at runtime. Copy backend/.env.example to backend/.env and fill in the sections below.
- Backend
- Frontend
LLM Provider
SetLLM_PROVIDER to choose the active AI backend. Groq is the recommended default — it is free up to 14,400 requests per day and delivers sub-second latency with Llama 3.3 70B.llm_service.py multi-provider router selects the correct client at startup based on LLM_PROVIDER.Supabase (Database + Auth)
Surqo uses Supabase for both PostgreSQL (viaasyncpg) and JWT authentication (ES256, validated against the project’s JWKS endpoint). The SUPABASE_KEY must be the Service Role key, not the anon key.SUPABASE_JWK_* variables are used to reconstruct the ES256 public key in memory at startup (@lru_cache) so JWT verification never makes a network round-trip.Upstash Redis
Redis serves two purposes: caching Open-Meteo climate responses (TTL 1 h) to avoid redundant API calls, and enforcing the 30-minute alert cooldown between repeated threshold violations per farm.rediss:// scheme (with double s) enables TLS — required by Upstash. The cache service degrades gracefully: if Redis is unreachable the backend continues to work, just without caching.HiveMQ Cloud (MQTT)
The MQTT consumer subscribes tosurqo/farms/+/sensors on startup and processes incoming sensor payloads from ESP32 nodes and the IoT simulator. Leave HIVEMQ_HOST empty to disable the consumer in development.8883 is TLS-encrypted MQTT — the same port used by the ESP32 firmware and the IoT simulator.Resend (Email)
Alert emails are sent through the Resend API when sensor readings cross configured thresholds. TheFROM_EMAIL address must be a verified sender domain in your Resend account.Application
APP_ENV=production disables the Swagger UI (/docs) and ReDoc (/redoc) endpoints. CORS_ORIGINS accepts a JSON array of allowed origins.Where to Obtain Each Credential
| Variable | Source |
|---|---|
GROQ_API_KEY | console.groq.com → API Keys |
ANTHROPIC_API_KEY | console.anthropic.com → API Keys |
SUPABASE_URL + SUPABASE_KEY | Supabase Dashboard → Settings → API |
SUPABASE_JWK_X / SUPABASE_JWK_Y / SUPABASE_JWK_KID | Supabase → Settings → API → JWT Settings → JWKS |
DATABASE_URL | Supabase → Settings → Database → Session Pooler (IPv4) |
REDIS_URL | console.upstash.com → Redis → Connect |
HIVEMQ_HOST / HIVEMQ_USERNAME / HIVEMQ_PASSWORD | console.hivemq.cloud → Cluster Settings |
RESEND_API_KEY | resend.com → API Keys |