Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible and what would be the best approach to completely secure a form in a react app without backend

I got that friend who want me to build a website for him.
There will be no database, no need of Auth or anything like that, only text, images, embed streams and other stuff but nothing that needs a backend except that one form.

Well the problem is that he doesn’t want to change his hosting plan that he already has and it’s a really basic one that only support php.

I could use php but I really want to avoid it if possible..
I recently learned react and I would like to build the website as a react app, but I don’t know if it’s possible to fully secure the form since I can’t use server side with nodeJS to manage that.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If it’s possible, what would be the best approach to do so?
Its just a contact form so there will never be any interaction with a database or any hypothetical backend code, so just using all basic stuff like data binding etc and maybe use a captcha would be enough? I’m pretty sure that’s risky anyway so I want to know if there is a way to do it or if I need to use php anyway to handle the form in the server side.

Thanks for your answers!

>Solution :

If you’re friend is receiving less than 500 emails per day, he can use EmailJS (a service that solves this sort of problem with an accompanying NPM package) for free. See this walkthrough on how to implement it.

And with the captcha verification, you can do it on the frontend as well using reaptcha. See this walkthrough and skip to the part titled "Using the reaptcha wrapper".

To combine the two to fit your needs, put the <Reaptcha …/> component from walkthrough 2 into your form from walkthrough 1, and then check that the user completed the reaptcha by checking the captchaToken state before doing emailjs.send().

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading