Skip to content
Zap Studio
env
Esc
navigateopen⌘Jpreview
On this page

Presets

Ready-made EnvironmentSchema objects for env vars that hosting platforms set automatically.

Presets cover env vars that a hosting platform sets on its own — deployment IDs, git metadata, region, and so on. Compose one into createEnvironment (or generateEnvironmentExample) via extends to type and validate a platform’s vars alongside your app’s own:

import { createEnvironment } from "@zap-studio/env";
import { vercel } from "@zap-studio/env/presets";
import { z } from "zod";

export const env = createEnvironment({
  extends: [vercel],
  server: { DATABASE_URL: z.string().url() },
  runtimeEnv: process.env,
});

env.VERCEL_GIT_COMMIT_SHA; // string | undefined

Every Key Is Optional

Every preset key is typed string | undefined. These vars are only present when the app is actually running on that platform, and this package never reads or parses files, so it can’t detect the platform itself — you decide which presets apply, usually by knowing where the app deploys.

Available Presets

Preset Platform Docs
vercel Vercel System environment variables
netlify Netlify Read-only build variables
render Render Environment variables
railway Railway Variables reference
fly Fly.io Machines Runtime environment
coolify Coolify Predefined variables
cloudflare Cloudflare Pages Build configuration
denoDeploy Deno Deploy Env vars and contexts

All eight are available from @zap-studio/env/presets and can be imported individually — only the ones you import end up in your bundle.

import { cloudflare, denoDeploy, netlify, vercel } from "@zap-studio/env/presets";

Composing Multiple Presets

Presets compose like any other EnvironmentSchema — pass more than one to extends if your app can run on more than one platform:

createEnvironment({
  extends: [vercel, cloudflare],
  runtimeEnv: process.env,
});

Presets never share keys with each other, so there’s no conflict risk between them — see extends for how conflicts are detected in general.

See Also

  • extends — how schema composition and conflict detection work
  • Getting Started — your first schema, without presets

Last updated on September 21, 2026

Was this page helpful?