DEV Community

Gaurav Soni
Gaurav Soni

Posted on

How to secure our react website source code?

In Developer tools, we all know that we can access any website source code in source tab...

So tell me how to secure that code in my live website.

Discussion (4)

codebytesfl profile image

You cannot stop people from viewing your frontend website source code. The browser needs to know the code to be able to display to the user. If you're worried about people stealing your html and stealing some idea, you can attempt to obfuscate code by making it difficult to read.

If you are trying to hide user data though, you shouldn't have that in the frontend to begin with. Any and All sensitive data should only be on a secured backend, and the frontend should query that data.

hunghvu profile image
Hung Vu

You are not supposed to put or process any sensitive information in the front end. Your website source code is trivial to all users, so there is no way to secure them, thus you are approaching the wrong way.

This question can only be asked for the back end.

intermundos profile image

The only way to "secure" your code is obfuscate it as much as possible to make it unreadable.

jonrandy profile image
Jon Randy • Edited on

Ultimately, you can't... but why would you want to, or feel the need to?