A beautiful, modern conversational AI chat application built with React, featuring OTP authentication, real-time messaging simulation, and a sleek Gemini-inspired UI/UX.
- OTP-based Login/Signup with country code selection
- Real country data fetched from
restcountries.comAPI - Simulated OTP send and validation with realistic delays
- Form validation using React Hook Form + Zod
- Chatroom Management - Create, delete, and organize chatrooms
- Smart Search - Debounced search to filter chatrooms by title
- Toast Notifications - Confirmation for all major actions
- Responsive Design - Optimized for mobile and desktop
- Real-time Chat UI with user and AI messages
- Typing Indicator - "Gemini is typing..." simulation
- Auto-scroll to latest messages
- Reverse Infinite Scroll for loading older messages
- Image Upload Support with preview and validation
- Copy-to-clipboard feature on message hover
- Message Timestamps with relative time formatting
- Dark/Light Mode Toggle with system preference detection
- Beautiful Gradients and modern color schemes
- Smooth Animations and micro-interactions
- Loading Skeletons for better perceived performance
- Glass Morphism effects and modern card designs
- Keyboard Accessibility for all interactions
| Technology | Purpose |
|---|---|
| React 18 | Core framework with hooks and modern patterns |
| TypeScript | Type safety and better developer experience |
| Zustand | Lightweight state management with persistence |
| React Hook Form + Zod | Form validation and schema validation |
| Tailwind CSS | Utility-first styling with custom design system |
| Radix UI | Accessible component primitives |
| Lucide React | Beautiful icon library |
| Date-fns | Date formatting and manipulation |
| Vite | Fast build tool and development server |
src/
βββ components/
β βββ auth/ # Authentication components
β β βββ LoginForm.tsx # OTP login with country codes
β βββ chat/ # Chat interface components
β β βββ ChatInterface.tsx # Main chat UI with messaging
β βββ dashboard/ # Dashboard and chatroom management
β β βββ Dashboard.tsx # Chatroom grid and search
β βββ layout/ # Layout components
β β βββ MainLayout.tsx # Main app layout controller
β βββ providers/ # Context providers
β β βββ ThemeProvider.tsx # Dark/light mode management
β βββ ui/ # Reusable UI components (shadcn)
βββ store/ # Zustand state management
β βββ authStore.ts # Authentication state
β βββ chatStore.ts # Chat and chatroom state
βββ assets/ # Static assets
β βββ hero-bg.jpg # Hero background image
βββ hooks/ # Custom React hooks
βββ use-toast.ts # Toast notification hook
- Node.js 18+ and npm
- Modern web browser with ES6+ support
# Clone the repository
git clone <repository-url>
cd gemini-chat
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview- Persistent Storage: Auth and chat data saved to localStorage
- Optimistic Updates: Immediate UI feedback with error handling
- Type Safety: Full TypeScript integration with proper typing
- AI Response Throttling: Realistic delays (1.5-3.5s) for AI responses
- Typing Indicators: Visual feedback during AI "thinking"
- Message Pagination: Client-side pagination with 20 messages per page
- Infinite Scroll: Load older messages when scrolling to top
- Phone Number Validation: Country-specific format validation
- OTP Validation: 6-digit numeric code verification
- Real-time Feedback: Instant validation with clear error messages
- Accessibility: Proper ARIA labels and keyboard navigation
- Custom CSS Variables: Semantic color tokens for consistent theming
- Gradient Utilities: Beautiful gradients defined in design system
- Animation Library: Custom keyframes and transition utilities
- Responsive Breakpoints: Mobile-first responsive design
- File Validation: Type and size validation (5MB limit)
- Preview System: Instant preview with removal option
- Base64 Encoding: Client-side image processing
- Error Handling: User-friendly error messages
- Country Selection: Dynamic country list with flags and dial codes
- Phone Validation: Real-time validation with country-specific rules
- OTP Simulation: Realistic SMS simulation with 6-digit codes
- Persistent Sessions: Secure session management with localStorage
- Message Bubbles: Distinct styling for user vs AI messages
- Image Sharing: Upload and share images in conversations
- Copy Messages: One-click copy to clipboard with feedback
- Smart Timestamps: Relative time formatting (e.g., "2 minutes ago")
- Search & Filter: Instant search with debounced input
- Create Chatrooms: Modal-based creation with validation
- Delete Confirmation: Safe deletion with confirmation dialogs
- Activity Indicators: Message counts and last activity timestamps
The application works out of the box with no environment variables required. All external API calls (country data) are handled gracefully with error fallbacks.
Modify src/index.css to customize the design system:
:root {
--primary: 217 91% 60%; /* Main brand color */
--secondary: 252 83% 57%; /* Secondary accent */
--gradient-hero: linear-gradient(...); /* Hero gradients */
}- Touch-Optimized: Proper touch targets and gestures
- Adaptive Layouts: Responsive grid and flexbox layouts
- Mobile Navigation: Optimized navigation patterns
- Performance: Optimized for mobile networks and devices
- Keyboard Navigation: Full keyboard accessibility
- Screen Reader Support: Proper ARIA labels and roles
- Focus Management: Visible focus indicators
- Color Contrast: WCAG AA compliant color schemes
The application is optimized for deployment on:
- Vercel (Recommended)
- Netlify
- GitHub Pages
- Any static hosting provider
- Code Splitting: Automatic route-based splitting
- Tree Shaking: Unused code elimination
- Asset Optimization: Compressed images and fonts
- Bundle Analysis: Built-in bundle size optimization
- Lighthouse Score: 95+ on all metrics
- Bundle Size: Optimized for fast loading
- Memory Usage: Efficient state management
- Render Performance: Optimized re-rendering patterns
- Modern React development patterns
- State management best practices
- UI/UX design principles
- Performance optimization techniques
- Accessibility compliance
- TypeScript proficiency