---
title: "Discussion on \"How to keep your secrets from your source code in an Angular project ?! 🤫\" | Hashnode"
description: "Discussion on \"How to keep your secrets from your source code in an Angular project ?! 🤫\". Useful for Vercel, Github Action, Netlify or AWS Amplify."
url: "https://hashnode.com/posts/how-to-keep-your-secrets-from-your-source-code-in-an-angular-project/6150445894bb297e1aad7f8d"
---

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

Discussion

# [How to keep your secrets from your source code in an Angular project ?! 🤫](https://pazel.dev/how-to-keep-your-secrets-from-your-source-code-in-an-angular-project?utm_source=hashnode&utm_medium=feed)

Useful for Vercel, Github Action, Netlify or AWS Amplify.

Sep 26, 2021 · 8 min read · pazel.dev  
Updated Oct 2, 2021  
Read the article

-   [#ci-cd](https://hashnode.com/tag/ci-cd)
-   [#angular](https://hashnode.com/tag/angular)
-   [#build-tool](https://hashnode.com/tag/build-tool)
-   [#git](https://hashnode.com/tag/git)
-   [#github-actions-1](https://hashnode.com/tag/github-actions-1)

## Written by

[Parham](https://hashnode.com/@pazel)

@pazel

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

Web is an awesome platform. Let's explore it together.

Web &amp; mobile developer, @Auth0Ambassador. Follow me for content on JavaScript, Angular, React, Ionic &amp; Capacitor, Progressive web apps &amp; UI/UX.

## Responses 4

Markdown supported · ⌘↵ to post

[Yaseen Khamosh](https://hashnode.com/@khamosh943)

[Jan 25, 2024](https://hashnode.com/posts/how-to-keep-your-secrets-from-your-source-code-in-an-angular-project/6150445894bb297e1aad7f8d/comment/65b29b6adaf1bc1d0a8ccc36)

I have three different environments like prod, qa and dv and for each of them i cloud build now how to configure the .env to detect required environments

[arun thakur](https://hashnode.com/@arun517)

[Oct 30, 2023](https://hashnode.com/posts/how-to-keep-your-secrets-from-your-source-code-in-an-angular-project/6150445894bb297e1aad7f8d/comment/653f73f2503f3d9ea169056d)

still private key can be viewed from source code

[mKoliwad](https://hashnode.com/@mKoliwad)

[Nov 16, 2022](https://hashnode.com/posts/how-to-keep-your-secrets-from-your-source-code-in-an-angular-project/6150445894bb297e1aad7f8d/comment/63751ad4cc42566334374777)

Hi I am trying to implement the solution using this guide,

Question: To read the GOOGLE\_API\_KEY from "environment.ts" file? we need to reference it in different file. for example: test.ts

I am getting the following error "src/environments/environment.ts' is not a module." as environment.ts file is added to .gitignore section.

Please help me how to overcome this?

[Abraham Putra Prakasa](https://hashnode.com/@AbrahamSky)

[Nov 2, 2022](https://hashnode.com/posts/how-to-keep-your-secrets-from-your-source-code-in-an-angular-project/6150445894bb297e1aad7f8d/comment/6361f51a05379376d22563da)

Hi i'm following this guide to deploy on vercel. But it gives error when deploying. Thanks

> Cannot find module 'dotenv'

[Parham](https://hashnode.com/@pazel)

[Nov 7, 2022](https://hashnode.com/posts/how-to-keep-your-secrets-from-your-source-code-in-an-angular-project/6150445894bb297e1aad7f8d/comment/6361f51a05379376d22563da#reply-63699822a1ce83db6fb71e02)

Hi [Abraham Putra Prakasa](https://hashnode.com/@AbrahamSky)

`dotenv` should be added to your project's package.json as a dev dependency.

The example repo I shared at the end of the blog has it as well.
