Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
How can I encrypt my dotenv variables when running `npm run build`

I am building a firebase application using React v17.0.2 that uses dotenv v8.2.0 to populate the firebaseConfig object.

When I run npm run build it bundles the scripts and puts it in the build folder (obviously) but I noticed that when I view the javascript file that was bundled in the build I can see all the dotenv values. This is a huge security risk as it contains the api key for the firebase app.

For clarity this is what the firebaseConfig variable looks like

const firebaseConfig = {
  apiKey: process.env.REACT_APP_API_KEY,
  authDomain: process.env.REACT_APP_AUTH_DOMAIN,
  databaseURL: process.env.REACT_APP_DATABASE_URL,
  projectId: process.env.REACT_APP_PROJECT_ID,
  storageBucket: process.env.REACT_APP_STORAGE_BUCKET,
  messagingSenderId: process.env.REACT_APP_MESSAGE_SENDING_ID,
  appId: process.env.REACT_APP_APP_ID
};

Is there a way to hide or encrypt these values?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!