This is a full-stack authentication app with a backend built using Express.js and a frontend built using Next.js.
- Backend: Express.js (API & Authentication)
- Frontend: Next.js (Client-side UI)
- Database: MongoDB (MongoDB Atlas)
- Authentication: JWT-based authentication
- Email Service: Mailtrap for email verification
MONOGO_URI=mongodb+srv://username:[email protected]/your-db
PORT=5001
JWT_SECRET=your_jwt_secret_key
NODE_ENV=development # Change this to production when deploying
MAILTRAP_TOKEN="your_mailtrap_token_here"
NEXT_PUBLIC_URL=https://fe-auth-app-v1.vercel.app/NEXT_PUBLIC_BACKEND_URL=https://be-auth-app-v1.vercel.app/api/auth- Clone the repository:
git clone https://github.com/mehul79/auth-app-v1 cd backend - Install dependencies:
npm install
- Add a
.envfile in thebackenddirectory with the above variables. - Start the server:
npm start
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Add a
.envfile in thefrontenddirectory with the above variables. - Start the Next.js development server:
npm run dev
- The backend is deployed on Render (
https://auth-app-v1.onrender.com/api/auth). - Make sure to update
NODE_ENV=productionin.envbefore deploying.
- The frontend is deployed on Vercel (
https://fe-auth-app-v1.vercel.app).
POST /api/auth/signup- Register a new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout userPOST /api/auth/forgot-password- Request password reset emailPOST /api/auth/reset-password- Reset user password with tokenPOST /api/auth/verifyEmail- Send verification email with OTP for account activationPOST /api/auth/verifyUser- Verify user identity with JWT stored in a cookie named 'token'
- Backend: Express.js, MongoDB, JWT, Mailtrap
- Frontend: Next.js, React, Tailwind CSS
- Deployment: Render (Backend), Vercel (Frontend)
This project is licensed under the MIT License.