A comprehensive, production-ready web platform that enables secure conversations with multiple AI models including OpenAI GPT-4o, Google Gemini 2.5 Flash, and Claude 3.5 Sonnet. Built with enterprise-grade authentication, monitoring, and deployment capabilities.
- OpenAI GPT-4o: Latest and most capable OpenAI model
- Google Gemini 2.5 Flash: Google's fastest multimodal AI
- Claude 3.5 Sonnet: Anthropic's most intelligent model
- Seamless Model Switching: Change AI models mid-conversation
- Conversation Persistence: Full chat history with database storage
- JWT Token-Based Authentication: Industry-standard security
- User Registration & Login: Complete account management
- Password Strength Validation: Real-time password requirements
- Email Verification: Account verification system
- Session Management: Automatic token refresh and logout
- Rate Limiting: Protection against abuse and attacks
- Responsive Design: Works perfectly on desktop, tablet, and mobile
- Real-time Chat Interface: Instant message delivery
- Loading States: Clear feedback during AI processing
- Error Handling: Graceful error messages and recovery
- Accessibility: Screen reader compatible and keyboard navigation
- Docker Containerization: Easy deployment anywhere
- Database Integration: PostgreSQL with SQLAlchemy ORM
- Caching Layer: Redis for improved performance
- Monitoring: Prometheus metrics and Grafana dashboards
- Security Headers: CORS, CSP, and security best practices
- SSL/TLS Support: HTTPS encryption ready
- React 18 with TypeScript for type-safe development
- Context API for state management
- Axios for HTTP client with interceptors
- Lucide React for consistent iconography
- Custom CSS with responsive design
- Flask with production WSGI server (Gunicorn)
- SQLAlchemy ORM with PostgreSQL
- JWT Authentication with secure password hashing
- Flask-Limiter for rate limiting
- Flask-Caching with Redis
- Prometheus metrics collection
- Docker Compose for orchestration
- PostgreSQL for data persistence
- Redis for caching and sessions
- nginx as reverse proxy
- Prometheus + Grafana for monitoring
# Clone the repository
git clone https://github.com/your-username/MultiGenQA.git
cd MultiGenQA
# Setup environment variables
cp backend/env.example backend/.env
# Edit backend/.env with your API keys
# Start with Docker
./docker-run.shAccess your app:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5001/api/health
# Backend setup
cd backend
pip install -r requirements.txt
cp env.example .env
# Edit .env with your API keys
python app.py
# Frontend setup (new terminal)
npm install
npm startYou'll need API keys from these services:
- OpenAI β https://platform.openai.com/api-keys
- Google AI β https://makersuite.google.com/app/apikey
- Anthropic β https://console.anthropic.com/
Add them to backend/.env:
OPENAI_API_KEY=sk-your-openai-key
GOOGLE_API_KEY=your-google-key
ANTHROPIC_API_KEY=your-anthropic-key- Create Account: Register with email and secure password
- Login: Access your personalized chat interface
- Select AI Model: Choose from OpenAI, Gemini, or Claude
- Start Chatting: Type messages and get AI responses
- Switch Models: Change AI models anytime during conversation
- View History: Access all your previous conversations
MultiGenQA/
βββ π backend/ # Python Flask API
β βββ app.py # Main Flask application
β βββ models.py # Database models (User, Conversation, Message)
β βββ requirements.txt # Python dependencies
β βββ tests/ # Backend test suite
βββ π src/ # React/TypeScript frontend
β βββ π components/ # React components
β β βββ AuthProvider.tsx # Authentication context
β β βββ Login.tsx # Login component
β β βββ Register.tsx # Registration component
β β βββ ChatMessage.tsx # Message display
β β βββ ModelSelector.tsx # AI model selector
β βββ π services/ # API services
β β βββ api.ts # HTTP client with auth
β βββ π types/ # TypeScript definitions
β β βββ index.ts # Type interfaces
β βββ App.tsx # Main application
βββ π docker/ # Docker configuration
β βββ docker-compose.yml # Development setup
β βββ docker-compose.prod.yml # Production setup
β βββ Dockerfile.backend # Backend container
β βββ Dockerfile.frontend # Frontend container
βββ π monitoring/ # Monitoring setup
β βββ prometheus.yml # Metrics configuration
βββ π docs/ # Documentation
β βββ AUTHENTICATION.md # Auth system guide
β βββ ARCHITECTURE.md # System architecture
β βββ DOCKER.md # Docker guide
β βββ PRODUCTION-DEPLOYMENT.md # Production deployment
βββ README.md # This file
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current userPOST /api/auth/verify-email- Email verification
GET /api/models- Available AI modelsPOST /api/chat- Send message to AIGET /api/conversations- User's conversationsGET /api/conversations/:id- Specific conversation
GET /api/health- Health checkGET /api/metrics- Prometheus metricsGET /api/usage- User's API usage stats
This project demonstrates key TypeScript concepts:
// Define the shape of data
interface User {
id: string;
email: string;
first_name: string;
last_name: string;
}
// Union types for specific values
type MessageRole = 'user' | 'assistant';// Type-safe state management
const [user, setUser] = useState<User | null>(null);
const [messages, setMessages] = useState<Message[]>([]);// Define function signatures
interface AuthContextType {
login: (user: User, token: string) => void;
logout: () => Promise<void>;
}// Properly typed event handlers
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
// TypeScript knows the exact event type
};docker-compose up --builddocker-compose -f docker-compose.prod.yml up -ddocker-compose -f docker-compose.prod.yml --profile monitoring up -d- Prometheus Metrics: API performance, error rates, response times
- Grafana Dashboards: Visual monitoring and alerting
- Structured Logging: JSON logs for easy parsing
- Health Checks: Automated service health monitoring
- JWT Authentication: Secure token-based auth
- Password Hashing: bcrypt with salt
- Rate Limiting: API abuse protection
- CORS Protection: Secure cross-origin requests
- Security Headers: XSS, CSRF, clickjacking protection
- Input Validation: Comprehensive data validation
- SQL Injection Prevention: Parameterized queries
cd backend
python test_backend.pynpm testnpm run test:allFor production deployment, see our comprehensive guides:
- Production Deployment Guide - Complete production setup
- Docker Guide - Container deployment
- Architecture Guide - System design details
- Node.js 18+
- Python 3.11+
- Docker (optional but recommended)
- Git
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
- TypeScript: Strict mode enabled
- Python: PEP 8 compliance
- ESLint: Configured for React/TypeScript
- Prettier: Code formatting
- Response Times: < 2s average for AI responses
- Concurrent Users: Supports 100+ simultaneous users
- Database: Optimized queries with proper indexing
- Caching: Redis caching for frequently accessed data
- CDN Ready: Static assets optimized for CDN delivery
Authentication not working?
- Check if JWT secret is set in environment
- Verify API keys are correctly configured
- Check browser console for errors
Docker containers not starting?
- Ensure Docker Desktop is running
- Check if ports 3000/5001 are available
- Verify .env file has real API keys
AI responses failing?
- Verify API keys are valid and have credits
- Check rate limits on AI service accounts
- Review backend logs for specific errors
- Check the troubleshooting guides
- Review GitHub Issues
- Join our community discussions
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for GPT-4o API
- Google for Gemini API
- Anthropic for Claude API
- React and TypeScript communities
- Flask and Python ecosystems
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with β€οΈ using React, TypeScript, Python, and Docker