Current collected state Current
Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Type-safe zod-validated environment loader. Fails at startup with a clear message instead of failing at runtime with a NaN somewhere.
Type-safe, zod-validated environment loader. Fails LOUDLY at module-load time when a variable is missing or invalid.
// lib/env.ts
import { defineEnv, common } from "@021.is/spine-env";
import { z } from "zod";
export const env = defineEnv({
schema: {
NODE_ENV: common.nodeEnv(),
DATABASE_URL: common.pgUrl(),
APP_URL: common.httpsUrl(),
RESEND_API_KEY: common.secret(),
PORT: common.number(),
SIGN_UPS_OPEN: common.boolean(),
MAX_UPLOAD: common.bytes(),
AUTH_CLIENT_ID: z.string().startsWith("app_"),
},
});
Now env.DATABASE_URL is typed string, env.PORT is typed number, etc. Reading a typo at the call site is a compile error.
RESEND_API_KEY should crash the boot, not silently 500 the first email.process.env.X!.trim() everywhere..env.example writes itself. Run the schema against {} and the error message lists every required key.common helpers| What it validates | |
|---|---|
common.nodeEnv() | "development" | "test" | "production" (default "development") |
common.httpsUrl() | URL starting with https:// |
common.url() | Any URL |
common.pgUrl() | postgres:// / postgresql:// |
common.bytes() | 100mb, 1gb, 50000 |
common.number() | Coerces string env to number |
common.boolean() | "true" / "false" / "1" / "0" |
common.secret() | Non-empty string |
For anything else, just use raw zod (z.string(), z.enum([...])).
Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:664468dac54bec109c301dc2127c01faf02621674043514ee286e1d1961a985b