← Back to notes

Safely Read Env Variables

javascriptvalibot
import { object, parse, string } from 'valibot'
export const env = parse(
object({
NODE_ENV: string(),
DATABASE_URL: string(),
RESEND_API_KEY: string(),
}),
process.env,
)