CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-t3-oss--env-nextjs

Typesafe environment variable validation and management for Next.js applications with runtime compatibility enforcement.

Pending
Overview
Eval results
Files

presets-arktype.mddocs/

Arktype Presets

Pre-configured environment variable schemas for popular hosting platforms and services using Arktype validators. These presets provide ready-to-use environment variable configurations for common deployment platforms, using Arktype's powerful type system for validation.

Import

import { 
  vercel, 
  railway, 
  render, 
  netlify,
  fly,
  neonVercel,
  supabaseVercel,
  uploadthing,
  uploadthingV6,
  upstashRedis,
  coolify,
  vite,
  wxt
} from "@t3-oss/env-nextjs/presets-arktype";

Capabilities

Vercel System Environment Variables

Vercel system environment variables for deployment information, Git metadata, and build context using Arktype validation.

/**
 * 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 Environment Variables

Railway platform environment variables for deployment, project, and service information using Arktype validation.

/**
 * 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 System Environment Variables

Render platform environment variables for service information, Git metadata, and deployment context using Arktype validation.

/**
 * 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 Environment Variables

Netlify platform environment variables for build context, deployment information, and site metadata using Arktype validation.

/**
 * 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 Environment Variables

Fly.io platform environment variables for application, machine, and deployment information using Arktype validation.

/**
 * 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 for Vercel Environment Variables

Neon database environment variables when integrated with Vercel using Arktype validation.

/**
 * 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 for Vercel Environment Variables

Supabase database and authentication environment variables when integrated with Vercel using Arktype validation.

/**
 * 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 Environment Variables

UploadThing file upload service environment variables (current version) using Arktype validation.

/**
 * UploadThing Environment Variables
 * @see https://docs.uploadthing.com/getting-started/appdir#add-env-variables
 */
function uploadthing(): Readonly<UploadThingEnv>;

interface UploadThingEnv {
  UPLOADTHING_TOKEN: string;
}

UploadThing V6 Environment Variables

UploadThing file upload service environment variables (version 6) using Arktype validation.

/**
 * 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 Environment Variables

Upstash Redis database environment variables for REST API access using Arktype validation.

/**
 * 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 Environment Variables

Coolify self-hosting platform environment variables for deployment and application information using Arktype validation.

/**
 * 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 Environment Variables

Vite build tool environment variables for development and build information using Arktype validation.

/**
 * 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 Environment Variables

WXT web extension framework environment variables for browser extension development using Arktype validation.

/**
 * 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;
}

Usage Examples

Using Arktype with Vercel Preset

import { createEnv } from "@t3-oss/env-nextjs";
import { vercel } from "@t3-oss/env-nextjs/presets-arktype";
import { type } from "arktype";

const vercelEnv = vercel();

const env = createEnv({
  server: {
    DATABASE_URL: type("string"),
    JWT_SECRET: type("string"),
  },
  client: {
    NEXT_PUBLIC_APP_URL: type("string"),
  },
  extends: [vercelEnv],
  runtimeEnv: {
    DATABASE_URL: process.env.DATABASE_URL,
    JWT_SECRET: process.env.JWT_SECRET,
    NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
    // Vercel variables are automatically available
  },
});

// Access Vercel-specific variables with Arktype validation
console.log(env.VERCEL_ENV); // "development" | "preview" | "production" | undefined
console.log(env.VERCEL_URL); // string | undefined

Combining Multiple Arktype Presets

import { createEnv } from "@t3-oss/env-nextjs";
import { vercel, neonVercel } from "@t3-oss/env-nextjs/presets-arktype";
import { type } from "arktype";

const vercelEnv = vercel();
const neonEnv = neonVercel();

const env = createEnv({
  server: {
    JWT_SECRET: type("string>=32"),
    API_KEY: type("string"),
  },
  client: {
    NEXT_PUBLIC_APP_URL: type("string"),
  },
  extends: [vercelEnv, neonEnv],
  runtimeEnv: {
    JWT_SECRET: process.env.JWT_SECRET,
    API_KEY: process.env.API_KEY,
    NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
    // Both Vercel and Neon variables are available
  },
});

// Access variables from both presets with Arktype validation
console.log(env.VERCEL_ENV); // From Vercel preset
console.log(env.DATABASE_URL); // From Neon preset

Using Advanced Arktype Validation

import { createEnv } from "@t3-oss/env-nextjs";
import { railway } from "@t3-oss/env-nextjs/presets-arktype";
import { type } from "arktype";

const railwayEnv = railway();

const env = createEnv({
  server: {
    PORT: type("string").pipe(type("number")),
    DEBUG: type("'true' | 'false'").pipe(type("boolean")),
  },
  client: {
    NEXT_PUBLIC_API_URL: type("string"),
  },
  extends: [railwayEnv],
  runtimeEnv: {
    PORT: process.env.PORT,
    DEBUG: process.env.DEBUG,
    NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
    // Railway variables are automatically available
  },
});

// Access Railway-specific variables
console.log(env.RAILWAY_ENVIRONMENT_NAME); // string | undefined
console.log(env.RAILWAY_PROJECT_NAME); // string | undefined

Install with Tessl CLI

npx tessl i tessl/npm-t3-oss--env-nextjs

docs

core.md

index.md

presets-arktype.md

presets-valibot.md

presets-zod.md

tile.json