Skip to content

About

Demonstrating modern JavaScript concepts, optimization techniques, and prompt engineering through a real-world web application.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

💻 OTP Auth Frontend

A modern, responsive, and lightweight React application for OTP-based email authentication. Built with React 19, Vite, and Axios, it provides a clean user interface for requesting and verifying one-time passwords through the OTP Auth backend.


🚀 Features

  • Modern React 19 architecture
  • Built with Vite for lightning-fast development
  • Email OTP request & verification
  • Real-time OTP countdown timer
  • Responsive and minimal UI
  • Environment-based API configuration
  • Loading and error state handling
  • Axios-powered API integration
  • Toast notifications for user feedback
  • Built using modern JavaScript (ES2024+) concepts

🛠️ Tech Stack & Dependencies

Library Version Description
react Latest Frontend library
vite Latest Next-generation build tool
axios Latest HTTP client for API requests
eslint Latest Code linting
@vitejs/plugin-react Latest React integration for Vite

✨ Modern JavaScript Concepts Used

  • ES Modules (import / export)
  • Arrow Functions
  • Template Literals
  • Optional Chaining (?.)
  • Nullish Coalescing (??)
  • Destructuring
  • Async / Await
  • Promises
  • React Hooks
    • useState
    • useEffect
    • useRef
  • Environment Variables (import.meta.env)
  • Conditional Rendering
  • Functional Components
  • Event Handling
  • Controlled Components

📦 Scripts

Command Description
npm run dev Start development server
npm run build Create production build
npm run preview Preview production build
npm run lint Run ESLint

🔑 Environment Variables

Create a .env file in the project root.

VITE_API_BASE=http://localhost:5000

📂 Project Structure

src/
│
├── assets/
├── App.jsx
├── App.css
├── main.jsx
└── index.css

🔗 Backend Integration

The application communicates with the backend using the following endpoints.

Method Endpoint Description
POST /api/auth/request-otp Request a new OTP
POST /api/auth/verify-otp Verify the entered OTP

Base URL is configured using:

VITE_API_BASE=http://localhost:5000

📱 User Flow

  1. Enter your email address.
  2. Request an OTP.
  3. Receive the OTP via email.
  4. Enter the OTP.
  5. Verify successfully.
  6. Authentication is completed.

🚀 Installation & Setup

git clone https://github.com/your-username/otp-auth-frontend.git

cd otp-auth-frontend

# Install dependencies
npm install

# Start development server
npm run dev

# Create production build
npm run build

The application will be available at:

http://localhost:5173

🌟 Highlights

  • Clean and responsive interface
  • Fast development experience with Vite
  • Modular React component architecture
  • Easy backend integration
  • Secure OTP authentication workflow
  • Modern ES2024+ JavaScript syntax
  • Beginner-friendly project structure

🚧 Future Improvements

  • JWT authentication support
  • User dashboard
  • Dark mode
  • Form validation with React Hook Form
  • State management using Redux Toolkit
  • Protected routes
  • Better animations
  • PWA support
  • Unit & Integration testing
  • Docker deployment

📄 License

This project is intended for educational purposes and production-ready OTP authentication workflows. Feel free to customize and extend it according to your application requirements.

modern-js-optimization-demo"

About

Demonstrating modern JavaScript concepts, optimization techniques, and prompt engineering through a real-world web application.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages