MERN stack app that provides authentication system out of the box using http only cookies
and jwt
- Most tutorials and project store
jwt
tokens inlocalstorage
which makes them exposed in client js and vulnerable toXSS
attack, Rexauth useshttponly cookie
(+sameSite: "strict"
) for storingjwt
for better security 🔒 - Many devs only do client side form validation and neglect server side validation when the latter is more important ✊
- Solutions like Clerk, Kinde.. offer good abstractions on how to deal with authentication. This project is for those who want to roll their own auth in their Mern Apps 👍
- Other auth projects use Javascript in the express server and/or in react. Rexauth uses Typescript to better reflect real world projects 🌎
git clone https://github.com/tarek-mo/rexauth.git ./
Stay in the root folder (not inside backend
or frontend
) and run
npm run install
3- Replace .env.sample
file placeholder values with ur mongodb_uri and jwt secret (choose a jwt secret on ur own)
npm run dev
If you have suggestions to make this project better by adding new features, feel free to open an issue or submit a pull request. I'll review your code and merge it