一键导入
env-configuration
Adding or reading env vars, updating .env.example, or validating config at startup with parseEnv / parseEnvOptional.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Adding or reading env vars, updating .env.example, or validating config at startup with parseEnv / parseEnvOptional.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Adding or changing routes in `apps/api`. One source of truth (`defineApiEndpoint` + a Zod schema) becomes an HTTP endpoint, an OpenAPI operation, an MCP tool, and a TS SDK method — descriptions and contracts must be written with all four readers in mind.
Layering and boundaries, web vs public API, app layout (clients, routes, logging), ports/adapters, runtime-portable domain/shared/utils code, multi-tenancy, DDD layout, or anti-patterns.
Preparing a production release, pushing a vX.Y.Z release tag, running scripts/release.sh, or updating CHANGELOG.md with the changes that are about to be deployed to production.
Enables or disables Latitude production maintenance mode by redirecting all publicly exposed production services to the Better Stack status page. Use when asked to start, stop, toggle, verify, or prepare a maintenance window.
ClickHouse queries, Goose migrations, chdb test schema, or telemetry storage paths.
Biome formatting, import style, strict TypeScript, naming (including React file names), or generated files.
| name | env-configuration |
| description | Adding or reading env vars, updating .env.example, or validating config at startup with parseEnv / parseEnvOptional. |
When to use: Adding or reading env vars, updating .env.example, or validating config at startup with parseEnv / parseEnvOptional.
LAT_ prefix conventionAll application environment variables must be prefixed with LAT_ so they do not collide with third-party services, Docker, or common names.
Use LAT_ for:
LAT_DATABASE_URL, LAT_PG_POOL_MAX, …)LAT_CLICKHOUSE_URL, LAT_REDIS_HOST, …)LAT_API_PORT, LAT_WEB_PORT, LAT_INGEST_PORT)LAT_BETTER_AUTH_SECRET, LAT_MAILPIT_HOST, …)Do not use LAT_ for:
NODE_ENVPOSTGRES_USER, CLICKHOUSE_USER, …)VITE_LAT_* (Vite requires the VITE_ prefix)Reference: .env.example lists Docker “Services” vs “Latitude Application” (LAT_*) variables.
.env.example maintenanceEvery new variable must appear in .env.example:
LAT_API_PORT=3001)# LAT_STRIPE_SECRET_KEY=sk_test_xxx)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:
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.charts/latitude/ — decide where the var belongs:
templates/configmap.yaml (and a values.yaml knob if it's a first-class setting);templates/secret.yaml and the chart README's existingSecret key list;config.extraEnv / secrets.extra pass-through already covers it.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 dev-docs/self-hosting.md for the tier/contract overview.
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.