This project is a backend Login and Registration System. It encompasses key functionalities such as registration, login, input validation, JWT authentication, refresh tokens, password reset, and OTP support. This backend solution ensures secure and efficient user authentication for web applications built with the MERN stack.
- ✅ Registration
- ✅ Login
- ✅ Input Validation
- ✅ JWT Auth Token
- ✅ Refresh Token
- ✅ Password Reset
- ✅ OTP Support
- ✅ Api Access Limit
- ⏳ Google Auth (coming soon)
- NodeJS
- ExpressJS
- MongoDB
- Json Web Token
- Nodemailer
git clone https://github.com/hirushaph/MernAuth-Backend.git
cd MernAuth-backend
npm install
After creating .env file, your folder structer look like this
📂 MernAuth-Backend
📂 node-modules
📂 src
📂 Controllers
📂 Models
📂 Router
📂 and others
📄 app.js
📄.env <------This is the file you need to create
📄.gitignore
📄 package.json
📄 README.md
Important
Copy the code below to the .env file and fill in all required variables. 👇
# define development or production ( default is development )
# If you are deploying for production, set this to production
STATUS=
# Default port is 3000.
# Define the port here if you want to change that.
PORT=
MONGODB_URL=
# Enter your frontend application url here (only if you have frontend)
FRONTEND_URL=
# You can generate a secret by running this command in the terminal:
# "node -e "console.log(require('crypto').randomBytes(32).toString('hex'))".
JWT_ACCESS_SECRET=
JWT_REFRESH_SECRET=
# Smtp Details for email features
HOST=
EPORT=
USER=
PASSWORD=
npm start
- Document Api Endpoints
- Add integration Tests
- User Roles
- OAuth
- Add better comments