Loading video...

Video Failed to Load

Go Home

Motherload solves the typesafe .env problem (getting autocompletion on process.env), no schemas required. 1. Import a .env file 2. That's it

46,147 views • 10 days ago •via X (Twitter)

28 Comments

colinhacks's profile picture
colinhacks10 days ago

Docs 👇

robby - rbby.dev's profile picture
robby - rbby.dev10 days ago

Wonder of this could be a potential attack vector down the line …

Jinjing Liang's profile picture
Jinjing Liang10 days ago

Could you show an example using your real .env file? 👀

Tom's profile picture
Tom10 days ago

Don’t you want a schema here though? So you can make sure they are what you expect at runtime and fail quickly if they’re not

Rajat's profile picture
Rajat10 days ago

I have an idea instead of importing .env file with secrets, let us import .env.schema then replace the schema format of @varlockdev with zod eg: # z.enum(["dev", "prod"]).default("dev") NODE_ENV= # z.string().optional() EXPORT=

Oluwafemi | penv.cloud's profile picture
Oluwafemi | penv.cloud10 days ago

Validation and agent-safe?

Adrian Gierakowski's profile picture
Adrian Gierakowski10 days ago

No thanks

François Best's profile picture
François Best10 days ago

How does it handle different .env (or any data file) contents between where you do the typechecking (dev, CI) and at runtime (prod)? Feels like it's missing a schema for true type-safety: import "./.env" with { schema: z.object({ ... }) }

galmenash's profile picture
galmenash10 days ago

But we need Zod to verify validity of content anyway, and it better be a func call rather than a module side effect. Am I missing something here? p.s. except that it’s really cool

Rohan's profile picture
Rohan10 days ago

What happens to a variable that only exists in production and is missing from the local .env?

Dhruv Anand's profile picture
Dhruv Anand10 days ago

Who needs this anymore?

All In Developer's profile picture
All In Developer10 days ago

Why .env import does not use named imports instead? import { port } from './.env'

Spartak's profile picture
Spartak10 days ago

importing is cool, type safety is questionable. having runtime safety is more important, like zod validation of env

nori's profile picture
nori10 days ago

incredible! is PORT inferred as a number?

Eugene's profile picture
Eugene10 days ago

not a replacement for schema validation then?

Suyash's profile picture
Suyash10 days ago

does it watch the file or is it a one-time import

Coding in Flow's profile picture
Coding in Flow10 days ago

I can't install anything with that name

JC Martin🧧's profile picture
JC Martin🧧10 days ago

It's a little meaningless for builds though that expect a matching env but now have no runtime validation 😢

Adam Genshaft's profile picture
Adam Genshaft10 days ago

That’s 🔥

Khushal's profile picture
Khushal10 days ago

importing the .env file directly feels illegal in a good way

Prathmesh's profile picture
Prathmesh10 days ago

😮

irazz's profile picture
irazz10 days ago

This has been a thing for a while. The scope of having typesafe is for the end-user to have the correct variables, enforcing minimum characters etc.

mizuki's profile picture
mizuki10 days ago

cooking again

Alfie Ranstead's profile picture
Alfie Ranstead10 days ago

This is insanely cool! Obviously orm-less sql is impressive but I hadn't even considered typesafe .envs Ironically had been attempting to find a nice setup with zod for this kind of thing previously.

All In Developer's profile picture
All In Developer10 days ago

When doing a `tsc` build, does the imported files reach the `dist` already as modules? Or we need to use node register hook for them to work at runtime?

BreezeOg's profile picture
BreezeOg10 days ago

just import the .env and you get autocomplete, no schema at all? nice

RoboKozo's profile picture
RoboKozo10 days ago

that's cool but I still would get value from zod for setting defaults, converting things like dates and numbers, and restricting values to a set of things (like log levels or aws regions)

Rishabh Vasudevan's profile picture
Rishabh Vasudevan10 days ago

You have made text file parsers and then give auto complete for SQL and now this. Have agents been some kind of unlock for you to be able to do this, or is it just you got to this idea only now?

Related Videos

grwm sin contexto env
0:33

Sensitive content

grwm sin contexto env

Dennis Ngiabi

79,520 views • 2 years ago