0
# Zod Presets
1
2
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.
3
4
## Import
5
6
```typescript
7
import {
8
vercel,
9
railway,
10
render,
11
netlify,
12
fly,
13
neonVercel,
14
supabaseVercel,
15
uploadthing,
16
uploadthingV6,
17
upstashRedis,
18
coolify,
19
vite,
20
wxt
21
} from "@t3-oss/env-nextjs/presets-zod";
22
```
23
24
## Capabilities
25
26
### Vercel System Environment Variables
27
28
Vercel system environment variables for deployment information, Git metadata, and build context.
29
30
```typescript { .api }
31
/**
32
* Vercel System Environment Variables
33
* @see https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables
34
*/
35
function vercel(): Readonly<VercelEnv>;
36
37
interface VercelEnv {
38
VERCEL?: string;
39
CI?: string;
40
VERCEL_ENV?: "development" | "preview" | "production";
41
VERCEL_URL?: string;
42
VERCEL_PROJECT_PRODUCTION_URL?: string;
43
VERCEL_BRANCH_URL?: string;
44
VERCEL_REGION?: string;
45
VERCEL_DEPLOYMENT_ID?: string;
46
VERCEL_SKEW_PROTECTION_ENABLED?: string;
47
VERCEL_AUTOMATION_BYPASS_SECRET?: string;
48
VERCEL_GIT_PROVIDER?: string;
49
VERCEL_GIT_REPO_SLUG?: string;
50
VERCEL_GIT_REPO_OWNER?: string;
51
VERCEL_GIT_REPO_ID?: string;
52
VERCEL_GIT_COMMIT_REF?: string;
53
VERCEL_GIT_COMMIT_SHA?: string;
54
VERCEL_GIT_COMMIT_MESSAGE?: string;
55
VERCEL_GIT_COMMIT_AUTHOR_LOGIN?: string;
56
VERCEL_GIT_COMMIT_AUTHOR_NAME?: string;
57
VERCEL_GIT_PREVIOUS_SHA?: string;
58
VERCEL_GIT_PULL_REQUEST_ID?: string;
59
}
60
```
61
62
### Railway Environment Variables
63
64
Railway platform environment variables for deployment, project, and service information.
65
66
```typescript { .api }
67
/**
68
* Railway Environment Variables
69
* @see https://docs.railway.app/reference/variables#railway-provided-variables
70
*/
71
function railway(): Readonly<RailwayEnv>;
72
73
interface RailwayEnv {
74
RAILWAY_PUBLIC_DOMAIN?: string;
75
RAILWAY_PRIVATE_DOMAIN?: string;
76
RAILWAY_TCP_PROXY_DOMAIN?: string;
77
RAILWAY_TCP_PROXY_PORT?: string;
78
RAILWAY_TCP_APPLICATION_PORT?: string;
79
RAILWAY_PROJECT_NAME?: string;
80
RAILWAY_PROJECT_ID?: string;
81
RAILWAY_ENVIRONMENT_NAME?: string;
82
RAILWAY_ENVIRONMENT_ID?: string;
83
RAILWAY_SERVICE_NAME?: string;
84
RAILWAY_SERVICE_ID?: string;
85
RAILWAY_REPLICA_ID?: string;
86
RAILWAY_DEPLOYMENT_ID?: string;
87
RAILWAY_SNAPSHOT_ID?: string;
88
RAILWAY_VOLUME_NAME?: string;
89
RAILWAY_VOLUME_MOUNT_PATH?: string;
90
RAILWAY_RUN_UID?: string;
91
RAILWAY_GIT_COMMIT_SHA?: string;
92
RAILWAY_GIT_AUTHOR_EMAIL?: string;
93
RAILWAY_GIT_BRANCH?: string;
94
RAILWAY_GIT_REPO_NAME?: string;
95
RAILWAY_GIT_REPO_OWNER?: string;
96
RAILWAY_GIT_COMMIT_MESSAGE?: string;
97
}
98
```
99
100
### Render System Environment Variables
101
102
Render platform environment variables for service information, Git metadata, and deployment context.
103
104
```typescript { .api }
105
/**
106
* Render System Environment Variables
107
* @see https://docs.render.com/environment-variables#all-runtimes
108
*/
109
function render(): Readonly<RenderEnv>;
110
111
interface RenderEnv {
112
IS_PULL_REQUEST?: string;
113
RENDER_DISCOVERY_SERVICE?: string;
114
RENDER_EXTERNAL_HOSTNAME?: string;
115
RENDER_EXTERNAL_URL?: string;
116
RENDER_GIT_BRANCH?: string;
117
RENDER_GIT_COMMIT?: string;
118
RENDER_GIT_REPO_SLUG?: string;
119
RENDER_INSTANCE_ID?: string;
120
RENDER_SERVICE_ID?: string;
121
RENDER_SERVICE_NAME?: string;
122
RENDER_SERVICE_TYPE?: "web" | "pserv" | "cron" | "worker" | "static";
123
RENDER?: string;
124
}
125
```
126
127
### Netlify Environment Variables
128
129
Netlify platform environment variables for build context, deployment information, and site metadata.
130
131
```typescript { .api }
132
/**
133
* Netlify Environment Variables
134
* @see https://docs.netlify.com/configure-builds/environment-variables
135
*/
136
function netlify(): Readonly<NetlifyEnv>;
137
138
interface NetlifyEnv {
139
NETLIFY?: string;
140
BUILD_ID?: string;
141
CONTEXT?: "production" | "deploy-preview" | "branch-deploy" | "dev";
142
REPOSITORY_URL?: string;
143
BRANCH?: string;
144
URL?: string;
145
DEPLOY_URL?: string;
146
DEPLOY_PRIME_URL?: string;
147
DEPLOY_ID?: string;
148
SITE_NAME?: string;
149
SITE_ID?: string;
150
}
151
```
152
153
### Fly.io Environment Variables
154
155
Fly.io platform environment variables for application, machine, and deployment information.
156
157
```typescript { .api }
158
/**
159
* Fly.io Environment Variables
160
* @see https://fly.io/docs/machines/runtime-environment/#environment-variables
161
*/
162
function fly(): Readonly<FlyEnv>;
163
164
interface FlyEnv {
165
FLY_APP_NAME?: string;
166
FLY_MACHINE_ID?: string;
167
FLY_ALLOC_ID?: string;
168
FLY_REGION?: string;
169
FLY_PUBLIC_IP?: string;
170
FLY_IMAGE_REF?: string;
171
FLY_MACHINE_VERSION?: string;
172
FLY_PRIVATE_IP?: string;
173
FLY_PROCESS_GROUP?: string;
174
FLY_VM_MEMORY_MB?: string;
175
PRIMARY_REGION?: string;
176
}
177
```
178
179
### Neon for Vercel Environment Variables
180
181
Neon database environment variables when integrated with Vercel.
182
183
```typescript { .api }
184
/**
185
* Neon for Vercel Environment Variables
186
* @see https://neon.tech/docs/guides/vercel-native-integration#environment-variables-set-by-the-integration
187
*/
188
function neonVercel(): Readonly<NeonVercelEnv>;
189
190
interface NeonVercelEnv {
191
DATABASE_URL: string;
192
DATABASE_URL_UNPOOLED?: string;
193
PGHOST?: string;
194
PGHOST_UNPOOLED?: string;
195
PGUSER?: string;
196
PGDATABASE?: string;
197
PGPASSWORD?: string;
198
POSTGRES_URL?: string;
199
POSTGRES_URL_NON_POOLING?: string;
200
POSTGRES_USER?: string;
201
POSTGRES_HOST?: string;
202
POSTGRES_PASSWORD?: string;
203
POSTGRES_DATABASE?: string;
204
POSTGRES_URL_NO_SSL?: string;
205
POSTGRES_PRISMA_URL?: string;
206
}
207
```
208
209
### Supabase for Vercel Environment Variables
210
211
Supabase database and authentication environment variables when integrated with Vercel.
212
213
```typescript { .api }
214
/**
215
* Supabase for Vercel Environment Variables
216
* @see https://vercel.com/marketplace/supabase
217
*/
218
function supabaseVercel(): Readonly<SupabaseVercelEnv>;
219
220
interface SupabaseVercelEnv {
221
POSTGRES_URL: string;
222
POSTGRES_PRISMA_URL?: string;
223
POSTGRES_URL_NON_POOLING?: string;
224
POSTGRES_USER?: string;
225
POSTGRES_HOST?: string;
226
POSTGRES_PASSWORD?: string;
227
POSTGRES_DATABASE?: string;
228
SUPABASE_SERVICE_ROLE_KEY?: string;
229
SUPABASE_ANON_KEY?: string;
230
SUPABASE_URL?: string;
231
SUPABASE_JWT_SECRET?: string;
232
NEXT_PUBLIC_SUPABASE_ANON_KEY?: string;
233
NEXT_PUBLIC_SUPABASE_URL?: string;
234
}
235
```
236
237
### UploadThing Environment Variables
238
239
UploadThing file upload service environment variables (current version).
240
241
```typescript { .api }
242
/**
243
* UploadThing Environment Variables
244
* @see https://docs.uploadthing.com/getting-started/appdir#add-env-variables
245
*/
246
function uploadthing(): Readonly<UploadThingEnv>;
247
248
interface UploadThingEnv {
249
UPLOADTHING_TOKEN: string;
250
}
251
```
252
253
### UploadThing V6 Environment Variables
254
255
UploadThing file upload service environment variables (version 6).
256
257
```typescript { .api }
258
/**
259
* UploadThing V6 Environment Variables
260
* @see https://v6.docs.uploadthing.com/getting-started/nuxt#add-env-variables
261
*/
262
function uploadthingV6(): Readonly<UploadThingV6Env>;
263
264
interface UploadThingV6Env {
265
UPLOADTHING_TOKEN: string;
266
}
267
```
268
269
### Upstash Redis Environment Variables
270
271
Upstash Redis database environment variables for REST API access.
272
273
```typescript { .api }
274
/**
275
* Upstash Redis Environment Variables
276
* @see https://upstash.com/docs/redis/howto/connectwithupstashredis
277
*/
278
function upstashRedis(): Readonly<UpstashRedisEnv>;
279
280
interface UpstashRedisEnv {
281
UPSTASH_REDIS_REST_URL: string;
282
UPSTASH_REDIS_REST_TOKEN: string;
283
}
284
```
285
286
### Coolify Environment Variables
287
288
Coolify self-hosting platform environment variables for deployment and application information.
289
290
```typescript { .api }
291
/**
292
* Coolify Environment Variables
293
* @see https://coolify.io/docs/knowledge-base/environment-variables#predefined-variables
294
*/
295
function coolify(): Readonly<CoolifyEnv>;
296
297
interface CoolifyEnv {
298
COOLIFY_FQDN?: string;
299
COOLIFY_URL?: string;
300
COOLIFY_BRANCH?: string;
301
COOLIFY_RESOURCE_UUID?: string;
302
COOLIFY_CONTAINER_NAME?: string;
303
SOURCE_COMMIT?: string;
304
PORT?: string;
305
HOST?: string;
306
}
307
```
308
309
### Vite Environment Variables
310
311
Vite build tool environment variables for development and build information.
312
313
```typescript { .api }
314
/**
315
* Vite Environment Variables
316
* @see https://vite.dev/guide/env-and-mode
317
*/
318
function vite(): Readonly<ViteEnv>;
319
320
interface ViteEnv {
321
BASE_URL: string;
322
MODE: string;
323
DEV: boolean;
324
PROD: boolean;
325
SSR: boolean;
326
}
327
```
328
329
### WXT Environment Variables
330
331
WXT web extension framework environment variables for browser extension development.
332
333
```typescript { .api }
334
/**
335
* WXT Environment Variables
336
* @see https://wxt.dev/guide/essentials/config/environment-variables.html#built-in-environment-variables
337
*/
338
function wxt(): Readonly<WxtEnv>;
339
340
interface WxtEnv {
341
MANIFEST_VERSION?: 2 | 3;
342
BROWSER?: "chrome" | "firefox" | "safari" | "edge" | "opera";
343
CHROME?: boolean;
344
FIREFOX?: boolean;
345
SAFARI?: boolean;
346
EDGE?: boolean;
347
OPERA?: boolean;
348
}
349
```
350
351
## Usage Examples
352
353
### Using Vercel Preset
354
355
```typescript
356
import { createEnv } from "@t3-oss/env-nextjs";
357
import { vercel } from "@t3-oss/env-nextjs/presets-zod";
358
import { z } from "zod";
359
360
const vercelEnv = vercel();
361
362
const env = createEnv({
363
server: {
364
DATABASE_URL: z.string().url(),
365
},
366
client: {
367
NEXT_PUBLIC_APP_URL: z.string().url(),
368
},
369
extends: [vercelEnv],
370
runtimeEnv: {
371
DATABASE_URL: process.env.DATABASE_URL,
372
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
373
// Vercel variables are automatically available
374
},
375
});
376
377
// Access Vercel-specific variables
378
console.log(env.VERCEL_ENV); // "development" | "preview" | "production" | undefined
379
console.log(env.VERCEL_URL); // string | undefined
380
```
381
382
### Combining Multiple Presets
383
384
```typescript
385
import { createEnv } from "@t3-oss/env-nextjs";
386
import { vercel, neonVercel } from "@t3-oss/env-nextjs/presets-zod";
387
import { z } from "zod";
388
389
const vercelEnv = vercel();
390
const neonEnv = neonVercel();
391
392
const env = createEnv({
393
server: {
394
JWT_SECRET: z.string().min(32),
395
},
396
client: {
397
NEXT_PUBLIC_APP_URL: z.string().url(),
398
},
399
extends: [vercelEnv, neonEnv],
400
runtimeEnv: {
401
JWT_SECRET: process.env.JWT_SECRET,
402
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
403
// Both Vercel and Neon variables are available
404
},
405
});
406
407
// Access variables from both presets
408
console.log(env.VERCEL_ENV); // From Vercel preset
409
console.log(env.DATABASE_URL); // From Neon preset
410
```