This is a full-stack authentication module built using NestJS (backend) and React (frontend). It includes user signup, login, protected routes, and authentication using JWT.
✅ User authentication (signup, login, JWT authentication)
✅ Form validation (email, name, password rules)
✅ Protected dashboard page (requires authentication)
✅ Token-based authentication (stored in localStorage)
✅ Full-stack best practices with TypeScript
✅ UI with React, React Hook Form, Zod, and Tailwind CSS
✅ Backend using NestJS, MongoDB, JWT, and Bcrypt
- React + TypeScript
- React Router
- React Hook Form & Zod (Validation)
- Axios (API requests)
- Tailwind CSS (UI styling)
- NestJS + TypeScript
- MongoDB (Database)
- Mongoose (ORM)
- JWT (Authentication)
- Bcrypt (Password Hashing)
project-root/ # Main project folder
│── frontend/ # React frontend
│── backend/ # NestJS backend
│── README.md # Project documentation (this file)
│── .gitignore # Git ignore unnecessary files
frontend/
│── src/
│ │── pages/ # Signup, Signin, Dashboard
│ │── components/ # UI elements
│ │── App.tsx # Routes setup
│ │── index.tsx # Entry point
│ │── index.css # Global styles (Tailwind)
│── package.json # Dependencies & scripts
│── tsconfig.json # TypeScript config
backend/
│── src/
│ │── auth/ # Authentication module (Signup, Signin)
│ │── main.ts # Entry point
│── package.json # Dependencies & scripts
│── tsconfig.json # TypeScript config
│── .env # Environment variables (DB, JWT secret)
git clone https://github.com/AbdelrahmanBayoumi/Easygenerator.git
cd your-repo
cd backend
npm install
MONGO_URI=mongodb://localhost:27017/authapp
JWT_SECRET=your_secret_key
JWT_EXPIRES=15m
npm run start:dev
Backend will be running at: http://localhost:3000
cd frontend
npm install
npm start
Frontend will be running at: http://localhost:5173
(Vite) or http://localhost:3000
(CRA)
Method | Endpoint | Description |
---|---|---|
POST | /auth/signup |
Register user |
POST | /auth/signin |
Login user |
GET | /auth/me |
User data |
- Open
http://localhost:5173
(Frontend) - Signup with a valid email, name, and password.
- Login to receive a JWT token.
- Access Dashboard (protected route).
- Logout to clear the session.
✔ Secure authentication with JWT
✔ Password hashing using bcrypt
✔ API validation for user inputs
✔ React Hook Form + Zod validation
✔ Modular NestJS structure for maintainability
✔ Environment variables for secrets
✔ Tailwind CSS for styling
🔹 Add forgot password functionality
🔹 Setup unit tests for backend & frontend