Skip to content

ayeankit/gemini-project

Repository files navigation

Gemini Chat - Modern Conversational AI Application

A beautiful, modern conversational AI chat application built with React, featuring OTP authentication, real-time messaging simulation, and a sleek Gemini-inspired UI/UX.

πŸš€ Features

πŸ” Authentication

  • OTP-based Login/Signup with country code selection
  • Real country data fetched from restcountries.com API
  • Simulated OTP send and validation with realistic delays
  • Form validation using React Hook Form + Zod

πŸ“± Dashboard

  • 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

πŸ’¬ Chat Interface

  • 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

🎨 Modern UX/UI

  • 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

πŸ›  Tech Stack

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

πŸ— Project Structure

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

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Modern web browser with ES6+ support

Installation

# 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

🎯 Key Implementation Details

πŸ“Š State Management (Zustand)

  • 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

πŸ”„ Chat Simulation

  • 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

πŸ“ Form Validation

  • 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

🎨 Design System

  • 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

πŸ–Ό Image Upload

  • 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

🌟 Features Showcase

Authentication Flow

  1. Country Selection: Dynamic country list with flags and dial codes
  2. Phone Validation: Real-time validation with country-specific rules
  3. OTP Simulation: Realistic SMS simulation with 6-digit codes
  4. Persistent Sessions: Secure session management with localStorage

Chat Experience

  1. Message Bubbles: Distinct styling for user vs AI messages
  2. Image Sharing: Upload and share images in conversations
  3. Copy Messages: One-click copy to clipboard with feedback
  4. Smart Timestamps: Relative time formatting (e.g., "2 minutes ago")

Dashboard Management

  1. Search & Filter: Instant search with debounced input
  2. Create Chatrooms: Modal-based creation with validation
  3. Delete Confirmation: Safe deletion with confirmation dialogs
  4. Activity Indicators: Message counts and last activity timestamps

πŸ”§ Configuration

Environment Setup

The application works out of the box with no environment variables required. All external API calls (country data) are handled gracefully with error fallbacks.

Theme Customization

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 */
}

πŸ“± Mobile Responsiveness

  • 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

β™Ώ Accessibility Features

  • 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

πŸš€ Deployment

The application is optimized for deployment on:

  • Vercel (Recommended)
  • Netlify
  • GitHub Pages
  • Any static hosting provider

Build Optimization

  • Code Splitting: Automatic route-based splitting
  • Tree Shaking: Unused code elimination
  • Asset Optimization: Compressed images and fonts
  • Bundle Analysis: Built-in bundle size optimization

πŸ“ˆ Performance

  • Lighthouse Score: 95+ on all metrics
  • Bundle Size: Optimized for fast loading
  • Memory Usage: Efficient state management
  • Render Performance: Optimized re-rendering patterns

🀝 Contributing

  • Modern React development patterns
  • State management best practices
  • UI/UX design principles
  • Performance optimization techniques
  • Accessibility compliance
  • TypeScript proficiency

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages