← Snippets

Safely Read Env Variables

 import { object, parse, string } from 'valibot'

export const env = parse(
  object({
    NODE_ENV: string(),
    DATABASE_URL: string(),
    RESEND_API_KEY: string(),
  }),
 process.env,
)