src/env.js

dy-comps · src/env.js · javascript · MIT
infra, tag:knn-classified

Utility for validating and accessing environment variables in a Next.js app, ensuring correct runtime configuration.

// Source: https://github.com/programming-with-ia/dy-comps | License: MIT | Copyright 2025 immi
// Provided via justclaw.it.com; keep this notice with the code.
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";

export const env = createEnv({
  /**
   * Specify your server-side environment variables schema here. This way you can ensure the app
   * isn't built with invalid env vars.
   */
  server: {
    NODE_ENV: z.enum(["development", "test", "production"]),
  },

  /**
   * Specify your client-side environment variables schema here. This way you can ensure the app
   * isn't built with invalid env vars. To expose them to the client, prefix them with
   * `NEXT_PUBLIC_`.
   */
  client: {
    // NEXT_PUBLIC_CLIENTVAR: z.string(),
  },

  /**
   * You can't destruct

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key