Env configuration

From latitude-dev/latitude-llm · View interactive version

Env configuration is an AI agent skill from the GitHub repository latitude-dev/latitude-llm. Adding or reading env vars, updating .env.example, or validating config at startup with parseEnv / parseEnvOptional.

How to use this skill

Skill file

Environment configuration

When to use: Adding or reading env vars, updating .env.example, or validating config at startup with parseEnv / parseEnvOptional.

`LAT_` prefix convention

All application environment variables must be prefixed with LAT_ so they do not collide with third-party services, Docker, or common names.

Use LAT_ for:

Do not use LAT_ for:

Reference: .env.example lists Docker “Services” vs “Latitude Application” (LAT_*) variables.

`.env.example` maintenance

Every new variable must appear in .env.example:

Keep the self-host surfaces in sync

Self-hosters configure Latitude through these env vars, so adding, renaming, or removing one means updating more than .env.example. Whenever you touch a LAT_* var, also reflect it in:

  1. The configuration reference docs/deployment/configuration.mdx — so operators know what the var does — unless it is specific to Latitude's own cloud deployment, which stays out of the self-host docs: payments/Stripe, marketing/lifecycle email (Loops), support chat (Intercom), and internal analytics/observability vendors (PostHog, Datadog/OTEL export, GTM, Framer, ipinfo). General app/infra/auth/AI/email-transport vars all belong in the reference.
  2. The Helm chart charts/latitude/ — decide where the var belongs:

docker-stack.yml needs no per-var change (it consumes the whole .env.production), but a new required var must land in .env.example's production guidance. The Railway template is dashboard-authored — no repo change. See CODE3 for the tier/contract overview.

Parsing in code

Always use parseEnv or parseEnvOptional from @platform/env — never process.env.FOO ad hoc or unprefixed names for app config.

// ❌ Bad - unprefixed or direct access
const port = Number(process.env.PORT)

// ✅ Good - pass the variable name string (parseEnv reads process.env internally)
import { parseEnv, parseEnvOptional } from "@platform/env"
import { Effect } from "effect"

const port = Effect.runSync(parseEnv("LAT_API_PORT", "number", 3001))
const dbUrl = Effect.runSync(parseEnv("LAT_DATABASE_URL", "string"))

For where configuration is wired in apps (clients, routes), see architecture-boundaries.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.