shlogg · Early preview
Ramu Narasinga @karthik-m22

Understanding EnvOptions In T3 Env Source Code

T3 Env's EnvOptions type provides validation for environment variables using zod, ensuring type safety and error handling.

In this article, we are going to examine the EnvOptions type in T3 Env source code. In case you are wondering what’s T3 Env or EnvOptions,
T3 Env provides validation for type-safe environment variables using zod. you use createEnv function and provide zod validation for your server and client env variables as shown in below example.

// src/env.mjs
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";
export const env = createEnv({
 /*
 * Serverside Environment variables, not available on the client.
 * Will throw if you access these variables on the client.
 */
 server: {...