A full-stack AI-powered chatbot application built with React.js and Node.js, featuring advanced vision capabilities, real-time communication, and comprehensive user authentication. This project was developed as part of the Inter IIT Bootcamp Dev Task.
๐ Frontend: laplacechatbot.vercel.app
๐ง Backend: laplacechatbot.onrender.com
- Groq API Integration: Powered by Meta's Llama 3.2 11B Vision model
- Vision Capabilities: Upload and analyze images, charts, documents, and visual content
- Natural Language Processing: Advanced text understanding and generation
- Real-time Responses: Streaming responses with typing effects
- Typing Animation: Character-by-character response display
- Speech Integration:
- ๐ค Speech-to-text input
- ๐ Text-to-speech output (optional)
- Code Highlighting: Syntax highlighting for code blocks with copy functionality
- File Upload: Support for image and document uploads
- Responsive Design: Mobile and desktop optimized interface
- JWT Authentication: Secure user authentication with JSON Web Tokens
- Password Encryption: Bcrypt hashing for secure password storage
- Session Management: Persistent login with cookie-based sessions
- Route Protection: Secured API endpoints with middleware validation
- MongoDB Integration: Persistent data storage
- Chat History: Complete conversation history per user
- User Management: Registration, login, and profile management
- File Processing: Secure file upload and processing with Multer
- React.js (18.3.1) - UI framework
- Axios - HTTP client for API requests
- React Router DOM - Client-side routing
- React Syntax Highlighter - Code syntax highlighting
- Prism.js - Additional syntax highlighting
- JS Cookie - Cookie management
- File Saver - File download functionality
- Node.js - Runtime environment
- Express.js - Web application framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- Groq SDK - AI model integration
- Multer - File upload middleware
- JWT - Authentication tokens
- Bcrypt - Password hashing
- CORS - Cross-origin resource sharing
- Groq API - Fast LLM inference
- Llama 3.2 11B Vision - Multimodal AI model
- Speech Recognition API - Browser speech-to-text
- Speech Synthesis API - Browser text-to-speech
Node.js (v14 or higher)
npm or yarn
MongoDB database
Groq API keygit clone https://github.com/laladwesh/laplacechatbot.git
cd laplacechatbotcd server
npm installCreate a .env file in the server directory:
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/laplacechatbot
# or use MongoDB Atlas: mongodb+srv://username:password@cluster.mongodb.net/laplacechatbot
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here
# Groq API Configuration
GROQ_API_KEY=your-groq-api-key-here
# Server Configuration
PORT=5000
NODE_ENV=developmentcd client
npm installCreate a .env file in the client directory:
# Backend API URL
REACT_APP_BACKEND_URL=http://localhost:5000
# For production: https://your-backend-domain.comBackend (Terminal 1):
cd server
npm install
npx nodemon index.jsFrontend (Terminal 2):
cd client
npm install
npm startThe application will be available at:
- Frontend:
http://localhost:3000 - Backend:
http://localhost:5000
- Visit Groq Console
- Create an account or sign in
- Navigate to API Keys section
- Generate a new API key
- Add it to your
.envfile asGROQ_API_KEY
Option 1: Local MongoDB
# Install MongoDB locally
# Start MongoDB service
mongod
# Use connection string: mongodb://localhost:27017/laplacechatbotOption 2: MongoDB Atlas (Cloud)
- Create account at MongoDB Atlas
- Create a new cluster
- Get connection string
- Replace
MONGODB_URIin.envfile
# Install Vercel CLI
npm i -g vercel
# Deploy frontend
cd client
vercel
# Follow prompts for configuration- Push code to GitHub repository
- Connect repository to deployment platform
- Set environment variables in platform dashboard
- Deploy backend service
# Backend (.env)
MONGODB_URI=your-production-mongodb-uri
JWT_SECRET=your-production-jwt-secret
GROQ_API_KEY=your-groq-api-key
PORT=5000
NODE_ENV=production
# Frontend (.env)
REACT_APP_BACKEND_URL=https://your-backend-domain.comlaplacechatbot/
โโโ client/ # React frontend
โ โโโ public/ # Static files
โ โโโ src/ # Source code
โ โ โโโ App.js # Main application component
โ โ โโโ App.css # Styling
โ โ โโโ index.js # Entry point
โ โโโ package.json # Frontend dependencies
โ โโโ .env # Frontend environment variables
โ
โโโ server/ # Node.js backend
โ โโโ models/ # MongoDB schemas
โ โ โโโ User.js # User model
โ โ โโโ ChatHistory.js # Chat history model
โ โโโ uploads/ # File upload directory
โ โโโ index.js # Main server file
โ โโโ package.json # Backend dependencies
โ โโโ .env # Backend environment variables
โ
โโโ README.md # Project documentation
POST /register # User registration
POST /login # User login
POST /chat # Send message & get AI response
# Supports text and file uploads
GET / # Server status check
- Register a new account or login
- Type your message in the chat input
- Press Enter or click Send
- Watch the AI respond with typing animation
- Click the file upload button
- Select an image file
- Add a text prompt about the image
- Send the message
- AI will analyze and describe the image
- Click the microphone button
- Speak your message
- Text will be converted from speech
- Enable text-to-speech for audio responses
- Ask coding questions
- Request code examples
- Copy code blocks with the copy button
- Syntax highlighting automatically applied
- Document Understanding: Analyze charts, graphs, and documents
- Image Captioning: Generate descriptions of uploaded images
- Visual Question Answering: Answer questions about image content
- Object Detection: Identify and locate objects in images
- JWT Tokens: Secure authentication with 1-hour expiration
- Password Hashing: Bcrypt with salt rounds for secure storage
- CORS Protection: Configured for secure cross-origin requests
- Input Validation: Server-side validation for all inputs
- Lazy Loading: Components loaded on demand
- Caching: Browser caching for static assets
- Compression: Gzip compression for API responses
- CDN: Vercel CDN for fast global delivery
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes and commit:
git commit -m 'Add new feature' - Push to branch:
git push origin feature/new-feature - Create a Pull Request
- Follow existing code style and conventions
- Add comments for complex functionality
- Test your changes thoroughly
- Update documentation as needed
1. Backend Connection Failed
# Check if backend is running
curl http://localhost:5000
# Verify environment variables
echo $MONGODB_URI
echo $GROQ_API_KEY2. Frontend Build Errors
# Clear node modules and reinstall
rm -rf node_modules package-lock.json
npm install3. Database Connection Issues
# Check MongoDB status
mongod --dbpath /path/to/db
# Verify connection string format
mongodb://[username:password@]host1[:port1][/database]4. API Key Issues
- Verify Groq API key is valid and active
- Check API key permissions and quota
- Ensure proper environment variable setup
- Response Time: Average AI response in <2 seconds
- Uptime: 99.9% availability target
- Security: JWT token-based authentication
- Scalability: Horizontal scaling ready
- Multi-language Support: Support for multiple languages
- Voice Cloning: Custom voice models
- File Format Expansion: Support for more file types
- Real-time Collaboration: Multi-user chat rooms
- Mobile App: React Native mobile application
- Plugin System: Extensible plugin architecture
- Analytics Dashboard: Usage analytics and insights
This project is licensed under the MIT License - see the LICENSE file for details.
Laladwesh
- GitHub: @laladwesh
- Project: Laplace's Chatbot
- Meta AI for Llama 3.2 Vision model
- Groq for fast LLM inference platform
- Vercel for hosting and deployment
- MongoDB for database services
- React Community for amazing ecosystem
- Inter IIT Bootcamp for the development opportunity
If you encounter any issues or have questions:
- Check the Troubleshooting section above
- Search existing issues on GitHub
- Create a new issue with detailed description
- Join our community discussions
โญ Star this repository if you find it helpful!
๐ Fork this repository to create your own chatbot!
๐ค Share with others who might benefit from this project!
Built with โค๏ธ for the AI community