<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nishant Bhatte</title>
    <description>The latest articles on DEV Community by Nishant Bhatte (@nishant_bhatte).</description>
    <link>https://dev.to/nishant_bhatte</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3978158%2Fc4a75bfd-5ebe-4bee-9d5d-21a8754f74b4.jpg</url>
      <title>DEV Community: Nishant Bhatte</title>
      <link>https://dev.to/nishant_bhatte</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nishant_bhatte"/>
    <language>en</language>
    <item>
      <title>I built a zero-dependency env variable validator for Node.js — env-guard</title>
      <dc:creator>Nishant Bhatte</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:57:03 +0000</pubDate>
      <link>https://dev.to/nishant_bhatte/i-built-a-zero-dependency-env-variable-validator-for-nodejs-env-guard-3l78</link>
      <guid>https://dev.to/nishant_bhatte/i-built-a-zero-dependency-env-variable-validator-for-nodejs-env-guard-3l78</guid>
      <description>&lt;p&gt;Every Node.js project reads from process.env. But process.env gives you raw strings — no types, no validation, no defaults.&lt;/p&gt;

&lt;p&gt;This leads to silent bugs like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PORT is undefined and your app crashes&lt;/li&gt;
&lt;li&gt;ENABLE_CACHE === "false" is truthy in JS&lt;/li&gt;
&lt;li&gt;Missing DATABASE_URL discovered at runtime, not startup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I got tired of writing the same boilerplate fix in every project, so I built env-guard.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Zero dependencies — pure Node.js&lt;/li&gt;
&lt;li&gt;Type coercion — strings become numbers, booleans, parsed JSON&lt;/li&gt;
&lt;li&gt;Collects ALL errors at once — see every problem in one error&lt;/li&gt;
&lt;li&gt;Beautiful error output — with hints and examples in the terminal&lt;/li&gt;
&lt;li&gt;Built-in .env loader — no dotenv needed&lt;/li&gt;
&lt;li&gt;Auto-generates .env.example from your schema&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Install it:&lt;br&gt;
npm install @ironfighter23/env-guard&lt;/p&gt;

&lt;p&gt;Define your schema once:&lt;/p&gt;

&lt;p&gt;const { guard, schema } = require('@ironfighter23/env-guard');&lt;/p&gt;

&lt;p&gt;const config = guard({&lt;br&gt;
  PORT:         schema.port().default(3000),&lt;br&gt;
  DATABASE_URL: schema.url().sensitive(),&lt;br&gt;
  NODE_ENV:     schema.enum(['development', 'production']),&lt;br&gt;
  SECRET_KEY:   schema.string().min(32),&lt;br&gt;
  ENABLE_CACHE: schema.boolean().default(false),&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;If anything is wrong you see ALL errors at once with hints — not one at a time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/IronFighter23/env-guard" rel="noopener noreferrer"&gt;https://github.com/IronFighter23/env-guard&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;npm: &lt;a href="https://www.npmjs.com/package/@ironfighter23/env-guard" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@ironfighter23/env-guard&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Would love your feedback!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>webdev</category>
      <category>node</category>
    </item>
  </channel>
</rss>
