{"_id":"@021.is/spine-env","_rev":"2-56a221dcda6aff60787e6742e070ee45","name":"@021.is/spine-env","dist-tags":{"latest":"0.4.3"},"versions":{"0.4.0":{"name":"@021.is/spine-env","version":"0.4.0","license":"MIT","_id":"@021.is/spine-env@0.4.0","maintainers":[{"name":"edvone","email":"edvard@edvone.dev"}],"homepage":"https://github.com/021is/spine-ts#readme","bugs":{"url":"https://github.com/021is/spine-ts/issues"},"dist":{"shasum":"f1c9fda726edd31c7ebee9719a820dce35e10d62","tarball":"https://registry.npmjs.org/@021.is/spine-env/-/spine-env-0.4.0.tgz","fileCount":4,"integrity":"sha512-EwVncRFJIdIcbtmrK94vgF6DlbT1B5OoupZUj5WRhTrNmBwbistlDEqEYFOBbPk25H9MYUJSNO3zY4dWCJki7A==","signatures":[{"sig":"MEUCIQCXrk63LhLcYCPAzVb0JKXTucz9DkV+MC3du+HfEl5djAIgFK2pshRr42Hx3hU48y0njyig3yWIl3VRu3M1BPOAadE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6950},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e4434c6f59db8f586e0f05ffdb3b88a96e68e67b","scripts":{"build":"tsup src/index.ts --format esm --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edvone","email":"edvard@edvone.dev"},"repository":{"url":"git+https://github.com/021is/spine-ts.git","type":"git","directory":"packages/env"},"_npmVersion":"10.9.4","description":"Type-safe zod-validated environment loader. Fails at startup with a clear message instead of failing at runtime with a NaN somewhere.","directories":{},"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.23.8"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/spine-env_0.4.0_1779981944477_0.8961303861830947","host":"s3://npm-registry-packages-npm-production"}},"0.4.3":{"name":"@021.is/spine-env","version":"0.4.3","license":"MIT","description":"Type-safe zod-validated environment loader. Fails at startup with a clear message instead of failing at runtime with a NaN somewhere.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format esm --dts --clean","typecheck":"tsc --noEmit"},"dependencies":{"zod":"^3.23.8"},"repository":{"type":"git","url":"git+https://github.com/021is/spine-ts.git","directory":"packages/env"},"publishConfig":{"access":"public"},"_id":"@021.is/spine-env@0.4.3","gitHead":"b9f9333776fa55686cc2feb05f851aa6000b0e05","bugs":{"url":"https://github.com/021is/spine-ts/issues"},"homepage":"https://github.com/021is/spine-ts#readme","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-Rzes1+T9niZyln2isJjfO/mKUyQ6GRcpGfk4+qbG9hBcnUTIoRu131ZAU95mZxZrm2ISYfl7OJAwflef0tH+gA==","shasum":"198011d81615be5ad68205f16ddac9701bf6bea7","tarball":"https://registry.npmjs.org/@021.is/spine-env/-/spine-env-0.4.3.tgz","fileCount":5,"unpackedSize":8394,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDhm17adj24/ieofF+wKBkpbrL+TEnFEl2q10/eOv5QJgIhAKl5xNc8ZoNngBX7zwqCK86BqEGv3xEuQSPXx65jZZdV"}]},"_npmUser":{"name":"edvone","email":"edvard@edvone.dev"},"directories":{},"maintainers":[{"name":"edvone","email":"edvard@edvone.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/spine-env_0.4.3_1779995235280_0.26726636793569103"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-28T15:25:44.286Z","modified":"2026-05-28T19:07:15.576Z","0.4.0":"2026-05-28T15:25:44.621Z","0.4.3":"2026-05-28T19:07:15.409Z"},"bugs":{"url":"https://github.com/021is/spine-ts/issues"},"license":"MIT","homepage":"https://github.com/021is/spine-ts#readme","repository":{"type":"git","url":"git+https://github.com/021is/spine-ts.git","directory":"packages/env"},"description":"Type-safe zod-validated environment loader. Fails at startup with a clear message instead of failing at runtime with a NaN somewhere.","maintainers":[{"name":"edvone","email":"edvard@edvone.dev"}],"readme":"# @021.is/spine-env\n\nType-safe, zod-validated environment loader. Fails LOUDLY at module-load time when a variable is missing or invalid.\n\n## Use\n\n```ts\n// lib/env.ts\nimport { defineEnv, common } from \"@021.is/spine-env\";\nimport { z } from \"zod\";\n\nexport const env = defineEnv({\n  schema: {\n    NODE_ENV: common.nodeEnv(),\n    DATABASE_URL: common.pgUrl(),\n    APP_URL: common.httpsUrl(),\n    RESEND_API_KEY: common.secret(),\n    PORT: common.number(),\n    SIGN_UPS_OPEN: common.boolean(),\n    MAX_UPLOAD: common.bytes(),\n    AUTH_CLIENT_ID: z.string().startsWith(\"app_\"),\n  },\n});\n```\n\nNow `env.DATABASE_URL` is typed `string`, `env.PORT` is typed `number`, etc. Reading a typo at the call site is a compile error.\n\n## Why\n\n- **Fail at startup, not at request 100.** A missing `RESEND_API_KEY` should crash the boot, not silently 500 the first email.\n- **Single source of truth.** Every app's env shape lives in one file.\n- **Free type narrowing.** No more `process.env.X!.trim()` everywhere.\n- **`.env.example` writes itself.** Run the schema against `{}` and the error message lists every required key.\n\n## `common` helpers\n\n| | What it validates |\n|---|---|\n| `common.nodeEnv()` | `\"development\" \\| \"test\" \\| \"production\"` (default `\"development\"`) |\n| `common.httpsUrl()` | URL starting with `https://` |\n| `common.url()` | Any URL |\n| `common.pgUrl()` | `postgres://` / `postgresql://` |\n| `common.bytes()` | `100mb`, `1gb`, `50000` |\n| `common.number()` | Coerces string env to number |\n| `common.boolean()` | `\"true\"` / `\"false\"` / `\"1\"` / `\"0\"` |\n| `common.secret()` | Non-empty string |\n\nFor anything else, just use raw zod (`z.string()`, `z.enum([...])`).\n","readmeFilename":"README.md"}