Skip to content

This is a simple User Authentication web app using Node.js, Express, MongoDB, and bcrypt. It provides registration and login functionality with password hashing and serves static HTML pages.

Notifications You must be signed in to change notification settings

DINES-04/User-Authentication-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Authentication App (Node.js + Express + MongoDB)

This is a simple User Authentication web app using Node.js, Express, MongoDB, and bcrypt. It provides registration and login functionality with password hashing and serves static HTML pages.

Project Structure

.

├── models/

│ └── user.js

├── public/

│ ├── login.html

│ └── register.html

├── .env

├── index.js

├── package.json

└── README.md

Features

  • User Registration (/register)

  • User Login (/login)

  • Password hashing with bcrypt

  • MongoDB connection with mongoose

  • Simple frontend using static HTML

Setup Instructions

1. Clone the Repository

git clone https://github.com/your-username/auth-app.git
cd auth-app

2. Install Dependencies

npm install

3. Add a .env File

Create a .env file in the root directory:

MONGO_URI=your_mongodb_connection_string
PORT=3000

Replace your_mongodb_connection_string with your actual MongoDB URI.

4. Run the Application

node server.js

5. Visit in Browser

API Endpoints

POST /register

Register a new user.

Body Parameters:

{
  "username": "yourname",
  "email": "your@email.com",
  "password": "yourpassword"
}

POST /login

Login with registered email and password.

Body Parameters:

{
  "email": "your@email.com",
  "password": "yourpassword"
}

ScreenShots

register

image

login

image

Tech Stack

  • Node.js

  • Express.js

  • MongoDB & Mongoose

  • Bcrypt (for password encryption)

  • dotenv

  • HTML/CSS

Security Note

Passwords are hashed using bcrypt before saving to the database.

For production, consider implementing sessions or JWTs for user authentication.

About

This is a simple User Authentication web app using Node.js, Express, MongoDB, and bcrypt. It provides registration and login functionality with password hashing and serves static HTML pages.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published