Typesafe environment variable validation and management for Next.js applications with runtime compatibility enforcement.
—
Pre-configured environment variable schemas for popular hosting platforms and services using Zod validators. These presets provide ready-to-use environment variable configurations for common deployment platforms, eliminating the need to manually define platform-specific environment variables.
import {
vercel,
railway,
render,
netlify,
fly,
neonVercel,
supabaseVercel,
uploadthing,
uploadthingV6,
upstashRedis,
coolify,
vite,
wxt
} from "@t3-oss/env-nextjs/presets-zod";Vercel system environment variables for deployment information, Git metadata, and build context.
/**
* Vercel System Environment Variables
* @see https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables
*/
function vercel(): Readonly<VercelEnv>;
interface VercelEnv {
VERCEL?: string;
CI?: string;
VERCEL_ENV?: "development" | "preview" | "production";
VERCEL_URL?: string;
VERCEL_PROJECT_PRODUCTION_URL?: string;
VERCEL_BRANCH_URL?: string;
VERCEL_REGION?: string;
VERCEL_DEPLOYMENT_ID?: string;
VERCEL_SKEW_PROTECTION_ENABLED?: string;
VERCEL_AUTOMATION_BYPASS_SECRET?: string;
VERCEL_GIT_PROVIDER?: string;
VERCEL_GIT_REPO_SLUG?: string;
VERCEL_GIT_REPO_OWNER?: string;
VERCEL_GIT_REPO_ID?: string;
VERCEL_GIT_COMMIT_REF?: string;
VERCEL_GIT_COMMIT_SHA?: string;
VERCEL_GIT_COMMIT_MESSAGE?: string;
VERCEL_GIT_COMMIT_AUTHOR_LOGIN?: string;
VERCEL_GIT_COMMIT_AUTHOR_NAME?: string;
VERCEL_GIT_PREVIOUS_SHA?: string;
VERCEL_GIT_PULL_REQUEST_ID?: string;
}Railway platform environment variables for deployment, project, and service information.
/**
* Railway Environment Variables
* @see https://docs.railway.app/reference/variables#railway-provided-variables
*/
function railway(): Readonly<RailwayEnv>;
interface RailwayEnv {
RAILWAY_PUBLIC_DOMAIN?: string;
RAILWAY_PRIVATE_DOMAIN?: string;
RAILWAY_TCP_PROXY_DOMAIN?: string;
RAILWAY_TCP_PROXY_PORT?: string;
RAILWAY_TCP_APPLICATION_PORT?: string;
RAILWAY_PROJECT_NAME?: string;
RAILWAY_PROJECT_ID?: string;
RAILWAY_ENVIRONMENT_NAME?: string;
RAILWAY_ENVIRONMENT_ID?: string;
RAILWAY_SERVICE_NAME?: string;
RAILWAY_SERVICE_ID?: string;
RAILWAY_REPLICA_ID?: string;
RAILWAY_DEPLOYMENT_ID?: string;
RAILWAY_SNAPSHOT_ID?: string;
RAILWAY_VOLUME_NAME?: string;
RAILWAY_VOLUME_MOUNT_PATH?: string;
RAILWAY_RUN_UID?: string;
RAILWAY_GIT_COMMIT_SHA?: string;
RAILWAY_GIT_AUTHOR_EMAIL?: string;
RAILWAY_GIT_BRANCH?: string;
RAILWAY_GIT_REPO_NAME?: string;
RAILWAY_GIT_REPO_OWNER?: string;
RAILWAY_GIT_COMMIT_MESSAGE?: string;
}Render platform environment variables for service information, Git metadata, and deployment context.
/**
* Render System Environment Variables
* @see https://docs.render.com/environment-variables#all-runtimes
*/
function render(): Readonly<RenderEnv>;
interface RenderEnv {
IS_PULL_REQUEST?: string;
RENDER_DISCOVERY_SERVICE?: string;
RENDER_EXTERNAL_HOSTNAME?: string;
RENDER_EXTERNAL_URL?: string;
RENDER_GIT_BRANCH?: string;
RENDER_GIT_COMMIT?: string;
RENDER_GIT_REPO_SLUG?: string;
RENDER_INSTANCE_ID?: string;
RENDER_SERVICE_ID?: string;
RENDER_SERVICE_NAME?: string;
RENDER_SERVICE_TYPE?: "web" | "pserv" | "cron" | "worker" | "static";
RENDER?: string;
}Netlify platform environment variables for build context, deployment information, and site metadata.
/**
* Netlify Environment Variables
* @see https://docs.netlify.com/configure-builds/environment-variables
*/
function netlify(): Readonly<NetlifyEnv>;
interface NetlifyEnv {
NETLIFY?: string;
BUILD_ID?: string;
CONTEXT?: "production" | "deploy-preview" | "branch-deploy" | "dev";
REPOSITORY_URL?: string;
BRANCH?: string;
URL?: string;
DEPLOY_URL?: string;
DEPLOY_PRIME_URL?: string;
DEPLOY_ID?: string;
SITE_NAME?: string;
SITE_ID?: string;
}Fly.io platform environment variables for application, machine, and deployment information.
/**
* Fly.io Environment Variables
* @see https://fly.io/docs/machines/runtime-environment/#environment-variables
*/
function fly(): Readonly<FlyEnv>;
interface FlyEnv {
FLY_APP_NAME?: string;
FLY_MACHINE_ID?: string;
FLY_ALLOC_ID?: string;
FLY_REGION?: string;
FLY_PUBLIC_IP?: string;
FLY_IMAGE_REF?: string;
FLY_MACHINE_VERSION?: string;
FLY_PRIVATE_IP?: string;
FLY_PROCESS_GROUP?: string;
FLY_VM_MEMORY_MB?: string;
PRIMARY_REGION?: string;
}Neon database environment variables when integrated with Vercel.
/**
* Neon for Vercel Environment Variables
* @see https://neon.tech/docs/guides/vercel-native-integration#environment-variables-set-by-the-integration
*/
function neonVercel(): Readonly<NeonVercelEnv>;
interface NeonVercelEnv {
DATABASE_URL: string;
DATABASE_URL_UNPOOLED?: string;
PGHOST?: string;
PGHOST_UNPOOLED?: string;
PGUSER?: string;
PGDATABASE?: string;
PGPASSWORD?: string;
POSTGRES_URL?: string;
POSTGRES_URL_NON_POOLING?: string;
POSTGRES_USER?: string;
POSTGRES_HOST?: string;
POSTGRES_PASSWORD?: string;
POSTGRES_DATABASE?: string;
POSTGRES_URL_NO_SSL?: string;
POSTGRES_PRISMA_URL?: string;
}Supabase database and authentication environment variables when integrated with Vercel.
/**
* Supabase for Vercel Environment Variables
* @see https://vercel.com/marketplace/supabase
*/
function supabaseVercel(): Readonly<SupabaseVercelEnv>;
interface SupabaseVercelEnv {
POSTGRES_URL: string;
POSTGRES_PRISMA_URL?: string;
POSTGRES_URL_NON_POOLING?: string;
POSTGRES_USER?: string;
POSTGRES_HOST?: string;
POSTGRES_PASSWORD?: string;
POSTGRES_DATABASE?: string;
SUPABASE_SERVICE_ROLE_KEY?: string;
SUPABASE_ANON_KEY?: string;
SUPABASE_URL?: string;
SUPABASE_JWT_SECRET?: string;
NEXT_PUBLIC_SUPABASE_ANON_KEY?: string;
NEXT_PUBLIC_SUPABASE_URL?: string;
}UploadThing file upload service environment variables (current version).
/**
* UploadThing Environment Variables
* @see https://docs.uploadthing.com/getting-started/appdir#add-env-variables
*/
function uploadthing(): Readonly<UploadThingEnv>;
interface UploadThingEnv {
UPLOADTHING_TOKEN: string;
}UploadThing file upload service environment variables (version 6).
/**
* UploadThing V6 Environment Variables
* @see https://v6.docs.uploadthing.com/getting-started/nuxt#add-env-variables
*/
function uploadthingV6(): Readonly<UploadThingV6Env>;
interface UploadThingV6Env {
UPLOADTHING_TOKEN: string;
}Upstash Redis database environment variables for REST API access.
/**
* Upstash Redis Environment Variables
* @see https://upstash.com/docs/redis/howto/connectwithupstashredis
*/
function upstashRedis(): Readonly<UpstashRedisEnv>;
interface UpstashRedisEnv {
UPSTASH_REDIS_REST_URL: string;
UPSTASH_REDIS_REST_TOKEN: string;
}Coolify self-hosting platform environment variables for deployment and application information.
/**
* Coolify Environment Variables
* @see https://coolify.io/docs/knowledge-base/environment-variables#predefined-variables
*/
function coolify(): Readonly<CoolifyEnv>;
interface CoolifyEnv {
COOLIFY_FQDN?: string;
COOLIFY_URL?: string;
COOLIFY_BRANCH?: string;
COOLIFY_RESOURCE_UUID?: string;
COOLIFY_CONTAINER_NAME?: string;
SOURCE_COMMIT?: string;
PORT?: string;
HOST?: string;
}Vite build tool environment variables for development and build information.
/**
* Vite Environment Variables
* @see https://vite.dev/guide/env-and-mode
*/
function vite(): Readonly<ViteEnv>;
interface ViteEnv {
BASE_URL: string;
MODE: string;
DEV: boolean;
PROD: boolean;
SSR: boolean;
}WXT web extension framework environment variables for browser extension development.
/**
* WXT Environment Variables
* @see https://wxt.dev/guide/essentials/config/environment-variables.html#built-in-environment-variables
*/
function wxt(): Readonly<WxtEnv>;
interface WxtEnv {
MANIFEST_VERSION?: 2 | 3;
BROWSER?: "chrome" | "firefox" | "safari" | "edge" | "opera";
CHROME?: boolean;
FIREFOX?: boolean;
SAFARI?: boolean;
EDGE?: boolean;
OPERA?: boolean;
}import { createEnv } from "@t3-oss/env-nextjs";
import { vercel } from "@t3-oss/env-nextjs/presets-zod";
import { z } from "zod";
const vercelEnv = vercel();
const env = createEnv({
server: {
DATABASE_URL: z.string().url(),
},
client: {
NEXT_PUBLIC_APP_URL: z.string().url(),
},
extends: [vercelEnv],
runtimeEnv: {
DATABASE_URL: process.env.DATABASE_URL,
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
// Vercel variables are automatically available
},
});
// Access Vercel-specific variables
console.log(env.VERCEL_ENV); // "development" | "preview" | "production" | undefined
console.log(env.VERCEL_URL); // string | undefinedimport { createEnv } from "@t3-oss/env-nextjs";
import { vercel, neonVercel } from "@t3-oss/env-nextjs/presets-zod";
import { z } from "zod";
const vercelEnv = vercel();
const neonEnv = neonVercel();
const env = createEnv({
server: {
JWT_SECRET: z.string().min(32),
},
client: {
NEXT_PUBLIC_APP_URL: z.string().url(),
},
extends: [vercelEnv, neonEnv],
runtimeEnv: {
JWT_SECRET: process.env.JWT_SECRET,
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
// Both Vercel and Neon variables are available
},
});
// Access variables from both presets
console.log(env.VERCEL_ENV); // From Vercel preset
console.log(env.DATABASE_URL); // From Neon presetInstall with Tessl CLI
npx tessl i tessl/npm-t3-oss--env-nextjs