Env Package (packages/env)
Environment variables can be a major source of runtime crashes if not managed properly. CommitT uses the @t3-oss/env-core pattern to strictly validate all environment variables at boot time.
Architecture
Thepackages/env directory exports a centralized env.ts file that uses Zod to define the exact shape of our environment variables.
Key Features
- Type Safety: Generates TypeScript types for
process.env. - Client vs Server: Strictly separates variables that are safe to expose to the client (e.g.,
EXPO_PUBLIC_CONVEX_URL) from private server secrets (e.g.,OPENCODE_BASE_URL). - Fail-Fast Boot: If a required environment variable is missing or malformed, the application (whether it’s the mobile bundler or the backend dev server) will immediately crash with a detailed error message, rather than failing silently in production.