utilcn
fileenv-serversource: ok · hit
Environment Server Configuration
Environment variable validation schema using Zod for server configuration
npx shadcn add "https://utilcn.dev/r/env-server.json"free
No selection tags yet — empty means no evidence, not lack of support.
Dependencies
Bundle weight · lightformszod
Files1 · source cached 10/15/2026, 8:11:55 AM
registry/default/secrets/env-server.ts
import { z } from 'zod';
const serverSchema = z.object({
DATABASE_URL: z.string(),
PORT: z.coerce.number(),
});
const parsedEnv = serverSchema.safeParse(process.env);
if (!parsedEnv.success) {
const errors = parsedEnv.error.issues;
for (const error of errors) {
console.error(JSON.stringify(error, null, 2));
}
process.exit(1);
}
export const serverEnv = parsedEnv.data;