koushik-stack/restapi — reverse-engineered prompt
Reverse engineered prompt
Build me a secure Node.js REST API for user accounts and protected access. I want people to be able to sign up, log in, get a JWT token, and then use that token to access private routes. Passwords need to be safely hashed with bcrypt, not stored as plain text.
Please set it up with Express and Sequelize so it can work with PostgreSQL or MySQL using environment variables. Organize it cleanly with separate routes, controllers, database config, middleware, and utility helpers so it feels production ready and easy to extend later.
Add role based access control so some routes can be limited to certain users, like admin only routes. Include authentication middleware that checks the token and blocks requests that are missing, expired, or invalid.
Please include a sample environment file, clear setup instructions, and a few example endpoints for signup, login, a protected user route, and an admin only route. Look up current docs online if you need to.
Want more depth? Deep Reverse