DEV Community

Bruno Moura
Bruno Moura

Posted on

1

dotenv and typescript

When we are developing our app, it is very important to put things in its right place.

Here, I'm talking about "typescript" with "dotenv".

They are two powerful tool that increases considerably the development speed.

In order we can do that, we can do something like this,

.env file must exists in root application path.

package.json

"scripts": {
...
    "dev": "ts-node-dev --transpile-only -r dotenv/config -- src/main/server.ts",
...
  },
Enter fullscreen mode Exit fullscreen mode

That way, we don´t "dirty" our code when we have to load local env variables for our app.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs