diff --git a/env.ts b/env.ts new file mode 100644 index 0000000..6ce96e2 --- /dev/null +++ b/env.ts @@ -0,0 +1,15 @@ +import { z } from "zod"; +const envVariables = z.object({ + DATABASE_URL: z.string(), + JWT_SECRET: z.string(), + WS_PORT: z.string(), + WS_HOST: z.string() +}); +envVariables.parse(process.env); + +declare global { + namespace NodeJS { + interface ProcessEnv extends z.infer {} + } +} + diff --git a/package.json b/package.json index 8d4ee92..b175069 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "0.0.1", "private": true, "scripts": { - "dev": "next dev", + "check-env": "bun run ./env.ts", + "dev": "bun run check-env && next dev", "build": "next build", "start": "next start", "lint": "next lint",