Loading repository data…
Loading repository data…
aayush130405 / repository
A modern, full-stack authentication system built with Next.js, MongoDB, TypeScript, and Mailtrap. This project demonstrates best practices for secure user authentication, email verification, password reset, and a beautiful, responsive UI.
A modern, full-stack authentication system built with Next.js, MongoDB, TypeScript, and Mailtrap. This project demonstrates best practices for secure user authentication, email verification, password reset, and a beautiful, responsive UI.
git clone https://github.com/aayush130405/auth-nextjs.git
cd auth-nextjs
npm install
# or
yarn install
Create a .env.local file in the root directory and add the following:
MONGODB_URI=your_mongodb_connection_string
MAILTRAP_USER=your_mailtrap_username
MAILTRAP_PASS=your_mailtrap_password
NEXTAUTH_SECRET=your_nextauth_secret
BASE_URL=http://localhost:3000
Get your MongoDB URI from MongoDB Atlas and Mailtrap credentials from Mailtrap.io
npm run dev
# or
yarn dev
Open http://localhost:3000 to see the app.
src/
app/
api/
users/ # API routes for authentication
...
login/ # Login page
signup/ # Signup page
profile/ # User profile pages
forgotpassword/ # Forgot password page
resetpassword/ # Reset password page
verifyemail/ # Email verification page
dbConfig/ # MongoDB connection
models/ # Mongoose models
helpers/ # Utility functions (mailer, token, etc.)
middleware.ts # Middleware
All transactional emails (verification, password reset) are sent using Mailtrap, so you can safely test email flows in development.
.env.local as needed.git checkout -b feature/your-feature)git commit -m 'Add some feature')git push origin feature/your-feature)This project is open source and available under the MIT License.
Made with ❤️ using Next.js, MongoDB, TypeScript, and Mailtrap.