swatimj29/mern-login-backend ? reverse-engineered prompt
Reverse engineered prompt
Build me the backend for a simple MERN app that handles user signup, login, and logout. I want users to be able to create an account with email and password, sign in securely, and get back a token they can use to stay logged in and access protected routes. Please store users in a database, hash passwords properly, and add basic validation and error messages for bad input or wrong credentials.
I also want a small protected test route so I can confirm the login is working, plus a clean setup for environment variables, database connection, and CORS so it can connect to a frontend later. Keep it simple and easy to run locally, and make sure the code is organized clearly enough that I can extend it later for things like profile pages or password reset. If you need to check current best practices or docs online, go ahead and do that.
Are you gonna build this?
make sure you review the code using coderabbit