Docs/Key Mapping

Key Mapping & Aliases

Separate your application constants from the messy environment variable keys.

// Real world: NEXT_PUBLIC_SECRET_KEY -> env.SECRET_KEY
const env = defineEnv({
  SECRET_KEY: {
    type: "string",
    key: "NEXT_PUBLIC_SECRET_KEY"
  }
});

console.log(env.SECRET_KEY); // Reads from NEXT_PUBLIC_...