This is a modern full-stack AI chat application built with React frontend and Express backend. The application allows users to have conversations with an AI assistant powered by OpenAI's GPT-4o model. It features a clean, responsive interface using shadcn/ui components and TailwindCSS for styling.
Link: https://aia-ssistant.vercel.app/
- Framework: React 18 with TypeScript
- Routing: Wouter for lightweight client-side routing
- State Management: TanStack Query (React Query) for server state management
- UI Components: shadcn/ui component library built on Radix UI primitives
- Styling: TailwindCSS with CSS variables for theming
- Build Tool: Vite for fast development and optimized builds
- Runtime: Node.js with Express.js framework
- Language: TypeScript with ES modules
- API Design: RESTful API structure
- Development: Hot reload with tsx in development mode
- Production: Compiled with esbuild for optimal performance
- Database: MongoDB with Mongoose ODM
- Current Storage: MongoDB database storage (DatabaseStorage)
- Schema: Defined in shared/schema.ts with users and messages collections
- Connection: Local MongoDB instance running on port 27017
- Currently not implemented but database schema includes users table for future implementation
- Provider: OpenAI API with GPT-4o model
- Service: Dedicated OpenAI service in server/services/openai.ts
- Configuration: Environment variable based API key management
- Error Handling: Comprehensive error handling for API failures
- Speech Recognition: Web Speech API for voice input
- Text-to-Speech: Web Speech Synthesis API for voice responses
- Voice Controls: Microphone toggle, auto-speak toggle, visual feedback
- Browser Support: Automatic detection and graceful fallback
- AI Call: Phone-like interface with OpenAI Whisper and TTS integration
- QR Code Scanning: Camera-based QR code detection using jsQR library
- Photo Upload: Multi-image upload with preview and analysis capability
- Image Processing: Base64 encoding for AI analysis
- Visual Feedback: Real-time camera preview and upload status
GET /api/messages- Retrieve all chat messagesPOST /api/chat- Send message and receive AI responsePOST /api/ai-call- Process voice queries (audio to audio)- Input validation using Zod schemas
- Consistent error response format
- Landing Page: Users start at QR scanner landing page (
/) - QR Scanning: Scan product QR codes to extract product IDs
- Product Chat: Navigate to chat with
?productId=parameter - Auto-Query: Automatically request product information on load
- Interactive Chat: Continue conversation about the product
- AI Call: Phone-like interface for voice queries at
/ai-call
- Message Sending: User inputs message → Frontend validates → API call to
/api/chat - AI Processing: Backend saves user message → Calls OpenAI API → Saves AI response
- Data Fetching: Frontend queries
/api/messages→ Displays conversation history - Real-time Updates: TanStack Query invalidates cache after successful message send
- UI Components: Extensive Radix UI component collection
- State Management: TanStack React Query for server state
- Form Handling: React Hook Form with Hookform Resolvers
- Styling: TailwindCSS with Autoprefixer
- Icons: Lucide React icon library
- Date Handling: date-fns for date formatting
- Database: MongoDB with Mongoose ODM
- Validation: Zod for runtime type checking
- AI: OpenAI API client
- Connection: MongoDB connection management with caching
- TypeScript: Strict type checking across the stack
- Vite: Development server with HMR and build optimization
- ESBuild: Fast TypeScript compilation for production
- Replit Integration: Cartographer plugin and runtime error overlay
- Vite dev server for frontend with proxy to backend
- Express server with hot reload using tsx
- Environment variables loaded from .env files
- Replit-specific development banner and error handling
- Frontend: Vite builds to
dist/publicdirectory - Backend: ESBuild compiles TypeScript to
dist/index.js - Static file serving through Express in production
- Environment-based configuration switching
- MongoDB connection with Mongoose ODM
- Environment variable based MongoDB URI
- Automatic connection caching for development
- Local MongoDB instance for development and testing
- July 07, 2025. Initial setup
- July 07, 2025. Added dark mode functionality with theme toggle button
- July 07, 2025. Integrated MongoDB database with Mongoose ODM
- July 07, 2025. Added voice command and voice assistant functionality
- July 07, 2025. Implemented QR code scanning and image upload capabilities
- July 07, 2025. Added QR landing page as entry point with product ID flow
- July 14, 2025. Added AI Call page with phone-like voice interface using OpenAI Whisper and TTS
Preferred communication style: Simple, everyday language.