A simple authentication system built with Node.js, Express.js, MongoDB, Passport.js, and EJS. This project demonstrates the core concepts of user authentication, session management, and route protection in an Express application.
- User registration
- Secure login authentication
- Password hashing and salting
- Session-based authentication
- Protected routes
- Flash messages for user feedback
- Logout functionality
- Node.js
- Express.js
- MongoDB
- Mongoose
- Passport.js
- Passport Local
- Passport Local Mongoose
- Express Session
- Connect Flash
- EJS
- Bootstrap
- Authentication using Passport.js
- Session management
- Password encryption
- User registration and login flow
- Route protection with authentication middleware
- Flash messages
- Express middleware
- MongoDB integration with Mongoose
├── models/
├── routes/
├── views/
├── public/
├── middleware.js
├── app.js
└── package.json
-
Clone the repository.
-
Install dependencies.
npm install-
Configure your MongoDB connection.
-
Start the application.
node app.jsor
nodemon app.js- Open your browser and visit:
http://localhost:8080
This project was built to strengthen my understanding of authentication in the MERN stack. It covers the complete authentication flow, including user registration, login, session handling, protected routes, and logout using Passport.js.
This project is created for learning and educational purposes.