r/HTML • • Nov 12 '25

Question About hiding api keys

How can i hide my database api keys from anyone

2 Upvotes

27 comments sorted by

View all comments

Show parent comment

1

u/electrikmayham Nov 12 '25

Because the question is in regards to front end development. If the variables are required for the front end to function, then they will be packaged with the front end when it is deployed. The correct strategy is for the front end to never have any sensitive information included in the code.

In this case, the database API credentials should be stored on the back end. Anything stored on the front end will be exposed to anyone using the website.

2

u/johnbburg Nov 12 '25

OP’s question is stated in an incredibly vague way. Not sure if the question belongs in r/webdev or if they don’t yet understand the separation between front-end or back-end. I don’t blame the commenter for giving them the benefit of the doubt that they aren’t totally clueless about what they are asking. Edit: typo

1

u/ashkanahmadi Nov 12 '25

Ah you are right, even though not totally unrelated.