Skip to content

Repository files navigation

Simple Authentication App

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.

Features

  • User registration
  • Secure login authentication
  • Password hashing and salting
  • Session-based authentication
  • Protected routes
  • Flash messages for user feedback
  • Logout functionality

Tech Stack

  • Node.js
  • Express.js
  • MongoDB
  • Mongoose
  • Passport.js
  • Passport Local
  • Passport Local Mongoose
  • Express Session
  • Connect Flash
  • EJS
  • Bootstrap

Concepts Practiced

  • 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

Project Structure

├── models/
├── routes/
├── views/
├── public/
├── middleware.js
├── app.js
└── package.json

Screenshots

Home Page

Home Page

Login Page

Login Page

Signup Page

Signup Page

Dashboard Page

Dashboard Page

Installation

  1. Clone the repository.

  2. Install dependencies.

npm install
  1. Configure your MongoDB connection.

  2. Start the application.

node app.js

or

nodemon app.js
  1. Open your browser and visit:
http://localhost:8080

Learning Outcome

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.

License

This project is created for learning and educational purposes.

About

A simple authentication application built with Node.js, Express.js, MongoDB, Passport.js, and EJS, demonstrating user registration, login, session-based authentication, protected routes, and logout functionality.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages