Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Full-Stack Authentication System

This project is a full-stack authentication system built with Node.js, Express, MongoDB, and React (Vite). It provides a secure and scalable authentication workflow with features like JWT + cookie-based login, OTP-based email verification, password reset, and protected routes.


Features

  • User Registration & Login
  • JWT-based Authentication (with Cookies)
  • Email Verification via OTP
  • Password Reset with OTP
  • Protected Routes for Authenticated Users
  • Modular Backend with Express Routes & Middleware

Tech Stack

  • Backend: Node.js, Express.js, MongoDB, JWT, Cookie-Parser, CORS
  • Frontend: React (Vite), Axios, Tailwind CSS

Project Structure


root/
│── server/   # Backend (Node.js + Express + MongoDB)
│── client/   # Frontend (React + Vite)
│── .gitignore
│── README.md


Getting Started

1. Clone the Repository

git clone https://github.com/Shreya11G/Authentication_App.git
cd Authentication_App

2. Setup Backend (Server)

cd server
npm install

Create a .env file in the server/ folder with the following variables:

PORT=4000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret

Run the backend:

npm start

3. Setup Frontend (Client)

cd ../client
npm install

Create a .env file in the client/ folder with:

VITE_BACKEND_URL=http://localhost:4000

Run the frontend:

npm run dev

API Endpoints (Backend)

  • POST /api/auth/register → Register a new user
  • POST /api/auth/login → Login user
  • POST /api/auth/logout → Logout user
  • POST /api/auth/send-verify-otp → Send OTP for email verification
  • POST /api/auth/verify-account → Verify email with OTP
  • POST /api/auth/send-reset-otp → Send OTP for password reset
  • POST /api/auth/reset-password → Reset password

Notes

  • Use Postman or the frontend client to test authentication flows.
  • Make sure MongoDB is running and .env variables are correctly set.

About

This project is a full-stack authentication system with a Node.js + Express + MongoDB backend and a React (Vite) frontend. It includes secure JWT + cookie-based authentication, user registration, login, email verification with OTP, password reset, and protected routes, making it a complete starter template for auth-enabled web applications.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages