A modern, accessible, and type-safe authentication system built with React, TypeScript, and Formik. This project demonstrates best practices in form handling, validation, and user experience.
- 🔐 Secure Login and Sign Up forms
- 📝 Form validation with Yup
- 💪 Password strength indicator
- 🔄 "Remember Me" functionality
- ⌨️ Full keyboard accessibility
- 📱 Responsive design
- 🎨 Clean, modern UI with Tailwind CSS
- 🛡️ Type-safe with TypeScript
- 🎯 Formik for form management
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/yourusername/react-auth-forms.git- Install dependencies:
npm install- Start the development server:
npm run devThe application will be available at http://localhost:5173
- Component Structure: Components are broken down into small, reusable pieces following the Single Responsibility Principle
- Type Safety: Comprehensive TypeScript types for form values and validation schemas
- Form Management: Formik for handling form state and validation
- Styling: Tailwind CSS for utility-first styling approach
- Form Switching: Easy toggle between Login and Sign Up forms
- Validation Feedback: Immediate feedback on form errors
- Password Strength: Visual indicator for password security
- Success Messages: Clear feedback on successful form submission
- Remember Me: Email persistence using localStorage
- Accessibility: ARIA labels, semantic HTML, and keyboard navigation
- Password Requirements: Strong password validation rules
- Form Validation: Comprehensive client-side validation using Yup
- Type Safety: TypeScript to prevent runtime errors
src/
├── components/ # React components
│ ├── FormInput.tsx # Reusable form input component
│ ├── LoginForm.tsx # Login form component
│ └── SignUpForm.tsx # Sign up form component
├── types/ # TypeScript type definitions
│ └── auth.ts # Authentication-related types
├── utils/ # Utility functions
│ ├── validation.ts # Form validation schemas
│ ├── storage.ts # Local storage utilities
│ └── password-strength.ts # Password strength calculator
└── App.tsx # Main application component
- Users have modern browsers with localStorage support
- JavaScript is enabled in the browser
- Client-side validation is sufficient for demonstration purposes
- No actual authentication implementation (mock success messages)
- Password strength indicator is basic and could be enhanced
- No password recovery functionality
- No social authentication options
-
Authentication
- Implement actual authentication with a backend service
- Add OAuth/social login options
- Implement JWT token management
-
Security
- Add rate limiting for failed attempts
- Implement CAPTCHA for bot prevention
- Add two-factor authentication
-
Features
- Password recovery flow
- Email verification
- Session management
- Remember device functionality
-
UX Enhancements
- Add loading states
- Improve error messages
- Add form animations
- Enhanced password strength requirements
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.