---
title: Nodejs create env file – ReadyMadeCode
description: "Nodejs create env file install npm package dotenv Create .env file in the root folder of project, create some variables. MY_VAR1=\"value1\"\nMY_VAR2=\"value2\""
---

[Skip to content](https://jaeves.com/codelab/nodejs-create-env-file#main-content)

 Close

SEARCH

[Discover Jaeves for Free](https://app.jaeves.com/login)

[![jaeves-2025-logo](https://jaeves.com/hubfs/logos/jaeves-2025-logo.svg)![jaeves-2025-logo](https://jaeves.com/hubfs/logos/jaeves-2025-logo.svg)](https://jaeves.com/)

[Discover Jaeves for Free](https://app.jaeves.com/login)

Quick results for "{search\_term}"

TABLE OF CONTENTS

loading...

[Admin](https://jaeves.com/codelab/author/admin)Oct 2, 2023, 4:23:53 PM< 1 min read

# Nodejs create env file

[Previous](https://jaeves.com/codelab/laravel-return-json-not-authentication)

<https://jaeves.com/codelab>

[Next](https://jaeves.com/codelab/jquery-daterangepicker-destroy)

Nodejs create env file

install [npm package dotenv](https://www.npmjs.com/package/dotenv)

Create .env file in the root folder of project, create some variables.

```
MY_VAR1="value1"
MY_VAR2="value2"
```

Use variables

```
require('dotenv').config();

console.log(process.env.MY_VAR1);
```

[click for more Nodejs codes](https://jaeves.com/codelab/tag/nodejs/)

COMMENTS

## RELATED ARTICLES

[![logo](https://jaeves.com/hs-fs/hubfs/jaeves-logo-230917.png?width=140&height=45&name=jaeves-logo-230917.png "logo")](https://jaeves.com/)

Jaeves is a trailblazing AI-powered content generation tool that revolutionizes your content creation journey. Its user-friendly interface, extensive customization options, and innovative approach make it an invaluable asset for all your content needs. Transform your content strategy with Jaeves today.

All rights reserved

- [Privacy Policy](https://jaeves.com/privacy-policy)

```json
{
  "@context" : "https://schema.org",
  "@type" : "Organization",
  "address" : {
    "@type" : "PostalAddress",
    "addressCountry" : "Germany",
    "addressLocality" : "Speyer",
    "addressRegion" : "Rheinland-Pfalz",
    "postalCode" : "67346",
    "streetAddress" : "Gerhart-hauptmann-Str"
  },
  "knowsLanguage" : "en",
  "logo" : {
    "@type" : "ImageObject",
    "url" : "https://139767802.fs1.hubspotusercontent-eu1.net/hubfs/139767802/logo-2024-less-points.svg"
  },
  "name" : "Jaeves AI",
  "url" : "https://jaeves.com/codelab/nodejs-create-env-file"
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "abstract" : "Nodejs create env file install npm package dotenv Create .env file in the root folder of project, create some variables. MY_VAR1=\"value1\" MY_VAR2=\"value2\"",
  "author" : {
    "@type" : "Person",
    "name" : "Admin"
  },
  "dateModified" : "",
  "datePublished" : "",
  "headline" : "Nodejs create env file",
  "image" : "",
  "inLanguage" : "en",
  "keywords" : "[NodeJs]",
  "mainEntityOfPage" : {
    "@type" : "WebPage"
  },
  "name" : "Nodejs create env file",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://139767802.fs1.hubspotusercontent-eu1.net/hubfs/139767802/jaeves-logo-230917.png"
    },
    "name" : "Jaeves AI"
  },
  "text" : "Nodejs create env file install npm package dotenv Create .env file in the root folder of project, create some variables. MY_VAR1=\"value1\" MY_VAR2=\"value2\" Use variables require('dotenv').config(); console.log(process.env.MY_VAR1); click for more Nodejs codes",
  "url" : "https://jaeves.com/codelab/nodejs-create-env-file",
  "wordCount" : "116"
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Admin",
    "url" : "https://jaeves.com/codelab/author/admin"
  },
  "dateModified" : "2023-10-02T20:29:15.192Z",
  "datePublished" : "2023-10-02T20:23:53.000Z",
  "headline" : "Nodejs create env file – ReadyMadeCode",
  "mainEntityOfPage" : {
    "@id" : "https://jaeves.com/codelab/nodejs-create-env-file",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://jaeves.com/hubfs/logo-2024-less-points.svg"
    },
    "name" : "Jaeves AI"
  }
}
```

```json
{
  "@context" : "http://schema.org",
  "@type" : "Organization",
  "description" : "Unlock the Power of AI for Content Creation. Explore Insights, Tips, and Trends on the Jaeves.com Blog. Empower Your Writing Journey Today!",
  "logo" : "https://jaeves.com/hubfs/untitled%20(4).png",
  "name" : "Jaeves AI",
  "sameAs" : [ "https://www.instagram.com/jaeves.ai", "https://www.linkedin.com/company/jaeves-ai", "https://www.youtube.com/@Jaeves_ai", "https://www.tiktok.com/@jaeves_ai" ],
  "url" : "https://jaeves.com"
}
```