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.
- 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
| 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 |
- ES Modules (
import/export) - Arrow Functions
- Template Literals
- Optional Chaining (
?.) - Nullish Coalescing (
??) - Destructuring
- Async / Await
- Promises
- React Hooks
useStateuseEffectuseRef
- Environment Variables (
import.meta.env) - Conditional Rendering
- Functional Components
- Event Handling
- Controlled Components
| 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 |
Create a .env file in the project root.
VITE_API_BASE=http://localhost:5000src/
│
├── assets/
├── App.jsx
├── App.css
├── main.jsx
└── index.css
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- Enter your email address.
- Request an OTP.
- Receive the OTP via email.
- Enter the OTP.
- Verify successfully.
- Authentication is completed.
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 buildThe application will be available at:
http://localhost:5173
- 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
- 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
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.