Why a validator instead of another converter
Search for “.env to json” and you get a page of converters. They all do the same mechanical thing, and none of them answers the question you actually have during a deploy: is this file complete, and is anything in it dangerous?
So this tool is built the other way round — conversion is the by-product, checking is the product. It compares two files, applies the rules that are specific to Vite (what most Vue 3 projects run on), and hands back a typed env.d.ts so nobody has to hand-write one again.
- Comparison against .env.example. Variables that are missing (the app reads undefined), variables that exist only on your machine, keys declared with an empty value, and values that differ from the example — listed by key, not in prose.
- The Vite-specific traps. Only VITE_ prefixed variables reach import.meta.env. That also means a VITE_ prefixed secret is inlined into the client bundle where anyone can read it, while a variable the browser needs without the prefix silently arrives as undefined. Both are flagged.
- Duplicate and malformed keys. dotenv keeps the last definition, so a duplicate key is a silent surprise. The parser reports the line numbers of every duplicate, plus lines without "=" and keys that are not valid identifiers.
- The half nobody wants to write. A generated env.d.ts — with an option to mark variables absent from the example as optional — and a normalised .env.example with sorted keys, so diffs stay readable.
Everything happens in your tab: the files are parsed locally, nothing is uploaded and no share link is created. That matters more than usual here, because a .env file is exactly the kind of file that should never leave your machine. Treat the output as a review aid: the validator knows syntax and Vite rules, it does not know your deployment.