Provides a validated environment variable schema for Next.js applications, ensuring correct config at build time.
// Source: https://github.com/velobase/velobase-harness | License: MIT | Copyright 2026 Velobase
// Provided via justclaw.it.com; keep this notice with the code.
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";
import {
createAuthSecretSchema,
normalizeAuthEnvironment,
serviceModeSchema,
} from "./env-normalization.js";
// Auth.js v5 prefers AUTH_* and keeps NEXTAUTH_* as backwards-compatible
// aliases. AUTH_* wins only when non-empty so an empty canonical variable does
// not mask a configured legacy fallback.
const { authSecret, authUrl, appUrl } = normalizeAuthEnvironment(process.env);
const port = z
.string()
.regex(/^\d+$/)
.transform((value) => Number.parseInt(value, 10))
.refine((value) => value >= 1 && value <= 65535, "Must be a valid port")
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key