amirmub/jwt-auth-fullstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 

Repository files navigation

A secure and minimal JWT-based authentication system using React, Node.js, Express, MySQL2, and bcrypt. This project implements user registration, login, logout, token refresh, providing a robust foundation for secure web applications.


RegisterLogin

βœ… Register and Login with secure hashing
βœ… JWT Access + Refresh Token flow
βœ… MySQL2 for persistent user storage
βœ… Bcrypt for password encryption
βœ… Protected routes via middleware
βœ… Token storage and invalidation system
βœ… RESTful API with JSON responses


LayerTechnology
FrontendReact, Axios, React Router
BackendNode.js, Express
DatabaseMySQL, MySQL2 (Driver)
Securitybcrypt, JWT
Config & Envdotenv
Dev ToolsNodemon, Postman

git clone https://.com/amirmub/jwt-auth.git
cd jwt-auth/server
npm install
CREATE DATABASE jwt_auth;

CREATE TABLE users (
  user_id INT AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(255) NOT NULL,
  firstname VARCHAR(255) NOT NULL,
  lastname VARCHAR(255) NOT NULL,
  email VARCHAR(255) NOT NULL UNIQUE,
  password VARCHAR(255) NOT NULL
);

CREATE TABLE tokens (
  id INT AUTO_INCREMENT PRIMARY KEY,
  user_id INT NOT NULL,
  token TEXT NOT NULL,
  FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
npm start
cd ../client
npm install
npm run dev
git checkout -b feature-new-feature
git commit -m "Add new feature"
git push origin feature-new-feature
πŸ“§ Email: [email protected]
πŸ’» : @amirmub

About

πŸ” A robust full-stack authentication system built with Node.js, Express, MySQL2, and React. It features secure user registration, login, logout, token refresh, and access to protected routes using JSON Web Tokens (JWT).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published