Skip to content

Modern React authentication system with dark glassmorphism design. Complete login/register with protected routes, form validation, and beautiful UI.

License

Notifications You must be signed in to change notification settings

DevAmirHub/authlab-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AuthLab React

A modern and complete authentication system with React that includes registration, login, session management and route protection with a beautiful dark glassmorphism design.

πŸš€ Features

Core Features

  • βœ… Protected Routes: Protection of sensitive pages with React Router
  • βœ… Auth Context: User state management with Context API
  • βœ… Form Validation: Form validation with Yup and Formik
  • βœ… Mock API: Simulated API with json-server
  • βœ… LocalStorage: Session persistence after page refresh
  • βœ… Responsive Design: Responsive design with Tailwind CSS
  • βœ… Dark Glassmorphism UI: Modern dark theme with glassmorphism effects

UX Features

  • βœ… Loading States: Loading state display
  • βœ… Error Handling: Error management and appropriate message display
  • βœ… Toast Notifications: Success and error message display
  • βœ… Remember Me: User remember functionality

πŸ› οΈ Technologies

  • React 19 - Main library
  • React Router DOM - Routing management and protected routes
  • Axios - API communication
  • Formik + Yup - Form management and validation
  • Tailwind CSS - UI design with glassmorphism
  • Context API - State management
  • json-server - Mock API

πŸ“ Project Structure

src/
β”œβ”€β”€ api/
β”‚   └── auth.js              # API functions for authentication
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ FormInput.jsx        # Input component with validation
β”‚   β”œβ”€β”€ Loader.jsx           # Loading component
β”‚   β”œβ”€β”€ Navbar.jsx           # Navigation bar
β”‚   └── Toast.jsx            # Message display component
β”œβ”€β”€ context/
β”‚   └── AuthContext.jsx      # User state management
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ Home.jsx             # Home page
β”‚   β”œβ”€β”€ Login.jsx            # Login page
β”‚   β”œβ”€β”€ Register.jsx         # Registration page
β”‚   └── Dashboard.jsx        # User dashboard
β”œβ”€β”€ routes/
β”‚   └── ProtectedRoute.jsx   # Route protection
β”œβ”€β”€ App.jsx                  # Main component
└── main.jsx                 # Application entry point

πŸš€ Setup

Prerequisites

  • Node.js (version 18 or higher)
  • npm or yarn

Installation and Setup

  1. Clone the project
git clone <repository-url>
cd authlab-react
  1. Install dependencies
npm install
  1. Start Mock API
npm run api
  1. Start React application
npm run dev
  1. Access the application

πŸ“± Application Pages

🏠 Home Page

  • Welcome and project introduction
  • Login and registration links
  • Project features display

πŸ” Login Page

  • Login form with email and password
  • Validation with Yup
  • "Remember me" functionality
  • Error handling

πŸ“ Registration Page

  • Registration form with complete fields
  • Password confirmation
  • Advanced validation
  • Auto-login after registration

πŸŽ›οΈ Dashboard

  • Protected page
  • User information display
  • Quick actions
  • Logout button

πŸ”§ API Endpoints

Mock API (json-server)

Get users list

GET http://localhost:3001/users

Register new user

POST http://localhost:3001/users
Content-Type: application/json

{
  "name": "User Name",
  "email": "user@example.com",
  "password": "password123"
}

🎯 User Flow

  1. Enter home page β†’ Choose Login or Register
  2. Registration β†’ Fill form β†’ Confirm β†’ Auto-login to Dashboard
  3. Login β†’ Fill form β†’ Confirm β†’ Enter Dashboard
  4. Dashboard β†’ View information β†’ Logout

πŸ”’ Security

  • Protection of sensitive routes
  • Form validation
  • Session management with LocalStorage
  • API error handling

🎨 Design Features

  • Dark Theme: Modern dark color scheme
  • Glassmorphism: Frosted glass effects with backdrop blur
  • Gradients: Beautiful gradient backgrounds
  • Transparency: Semi-transparent elements
  • Modern UI: Clean and contemporary design

πŸš€ Future Development

  • Connect to real Backend (Laravel/Node.js)
  • Password change functionality
  • Forgot password
  • Two-factor authentication
  • Advanced user profile
  • Role and permission system

πŸ“ Scripts

npm run dev      # Start development server
npm run build    # Build production build
npm run preview  # Preview production build
npm run api      # Start Mock API
npm run lint     # Check code with ESLint

🀝 Contributing

To contribute to this project:

  1. Fork it
  2. Create a new branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Create a Pull Request

πŸ“„ License

This project is published under the MIT license.

πŸ‘¨β€πŸ’» Developer

This project has been developed as a complete example of an authentication system with React and modern UI design.


Note: This project is designed for educational and practice purposes. For production use, be sure to add more security and validation features.

🌟 Demo Users

You can test the application with these demo users:

  1. Test User

    • Email: test@example.com
    • Password: 123456
  2. Dev Amir

    • Email: devamir99@example.com
    • Password: 123456

About

Modern React authentication system with dark glassmorphism design. Complete login/register with protected routes, form validation, and beautiful UI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published