Skip to content

ManoharBM29/task2-fullstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Task2 Fullstack App

A fullstack web application built with React (frontend) and Express + PostgreSQL (backend) implementing user authentication with JWT πŸ”.


✨ Features

  • πŸ“ Sign Up: Create new user, validate inputs, hash password, return JWT
  • πŸ”‘ Sign In: Validate credentials, return JWT
  • πŸ›‘ Protected Route: /api/users/me returns logged-in user info
  • πŸ’Ύ Token Handling: Store JWT in localStorage, used for API requests
  • πŸšͺ Sign Out: Clears token and user info

⚑ Installation

Backend

cd backend npm install

Create .env file with:

DB_HOST=localhost DB_USER=your_db_username DB_PASSWORD=your_db_password DB_NAME=your_db_name DB_PORT=5432 JWT_SECRET=supersecretkey JWT_EXPIRES_IN=1d

Start backend server:

npm run dev

Frontend

cd frontend npm install npm start

🌐 Frontend: http://localhost:3000 πŸ”Œ Backend: http://localhost:5000


πŸƒβ€β™‚ Usage

  1. Open the app in your browser

  2. πŸ“ Sign Up with a new email

  3. πŸ”‘ Sign In with existing credentials

  4. 🏠 View Home page showing Name + Phone

  5. πŸšͺ Sign Out to remove token


βœ… Testing

🟒 Sign Up / Sign In with valid inputs

πŸ”΄ Sign Up / Sign In with invalid inputs β†’ error messages

πŸ›‘ Access /api/users/me with valid/invalid JWT

πŸ’Ύ Verify JWT stored in localStorage

πŸšͺ Sign Out removes token and blocks access


πŸ“Έ Screenshots

  1. Sign Up success βœ…

  2. Sign In success βœ…

  3. Home page showing Name + Phone 🏠


πŸ›  Technologies

Frontend: React, React Router DOM

Backend: Node.js, Express, PostgreSQL, bcryptjs, jsonwebtoken, cors, dotenv


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors