Environment Server Configuration
utilcn/env-serverFreeUtility
Environment variable validation schema using Zod for server configuration
Install it
npx shadcn@latest add https://utilcn.dev/r/env-server.jsonSource
1import { z } from 'zod';23const serverSchema = z.object({4 DATABASE_URL: z.string(),5 PORT: z.coerce.number(),6});78const parsedEnv = serverSchema.safeParse(process.env);9if (!parsedEnv.success) {10 const errors = parsedEnv.error.issues;11 for (const error of errors) {12 console.error(JSON.stringify(error, null, 2));13 }1415 process.exit(1);16}1718export const serverEnv = parsedEnv.data;
What it pulls in
npm packages
Files it writes
More from utilcn
All 17 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Capitalizecapitalize | utilcn | Utilities | Free | no deps | |
| Capitalize Allcapitalize-all | utilcn | Utilities | Free | no deps | |
| Generate Presigned Download URLgenerate-presigned-download-url | utilcn | Utilities | Free | 2 deps · 2 files | |
| Generate Presigned Upload URLgenerate-presigned-upload-url | utilcn | Utilities | Free | 2 deps · 2 files | |
| Repeat Padrepeat-pad | utilcn | Utilities | Free | no deps | |
| Reverse Stringreverse-string | utilcn | Utilities | Free | no deps | |
| To Camel Caseto-camel-case | utilcn | Utilities | Free | no deps | |
| To Kebab Caseto-kebab-case | utilcn | Utilities | Free | no deps |
