---
title: "Discussion on \"How to add Environment Variables in Node.js with Typescript in a type-safe way\" | Hashnode"
description: "Discussion on \"How to add Environment Variables in Node.js with Typescript in a type-safe way\". In this article, I explain how to have type-safe environment variables with Node.js and Typescript"
url: "https://hashnode.com/posts/nodejs-with-typescript-environment-variables-type-safe/64192ce4a3a06d29a99c6c04"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to add Environment Variables in Node.js with Typescript in a type-safe way](https://blog.otaviocapila.dev/nodejs-with-typescript-environment-variables-type-safe?utm_source=hashnode&utm_medium=feed)

In this article, I explain how to have type-safe environment variables with Node.js and Typescript

Mar 21, 2023 · 3 min read · blog.otaviocapila.dev  
Updated Apr 4, 2023  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#nodejs](https://hashnode.com/tag/nodejs)

## Written by

[Otavio Capila](https://hashnode.com/@OtavioCapila)

@OtavioCapila · Brazil

  
[View profile](https://hashnode.com/@OtavioCapila)

Software Engineer @trio

## Responses 1

Markdown supported · ⌘↵ to post

[Jonathan Galdino](https://hashnode.com/@jonathangaldino)

[Mar 23, 2023](https://hashnode.com/posts/nodejs-with-typescript-environment-variables-type-safe/64192ce4a3a06d29a99c6c04/comment/641c819e88cf343b36fc7634)

Thx for the post, mate.

I've been combining this approach with a zod schema, works like a charm as well.
