How shraddesh29/ai_chatbot works
Project type and purpose
• This is a full-stack MERN (MongoDB–Express–React–Node) web application that provides an AI-powered chatbot interface.
• Frontend: React + TypeScript + Material-UI, bundler via Vite.
• Backend: Node.js + Express, structured with MVC-style controllers, routes, models, and utilities.
• Persistence: MongoDB for user data and chat history through Mongoose models.
• External AI: Grok’s LLaMA-3.3 API for generating streamed chatbot responses.
• Security: JWT authentication stored in secure cookies.
File structure
• Top level splits into “frontend/” and “backend/”.
• backend/src/ contains:
• app.ts and index.ts (Express app setup & server entry)
• controllers/ (chat + user business logic)
• routes/ (chat-routes, user-routes, index)
• models/ (User schema)
• db/ (MongoDB connection)
• utils/ (JWT token manager, validators, constants)
• frontend/src/ contains:
• pages/ (Home, Chat, Login, Signup, NotFound)
• components/ (UI atoms and molecules: Header, Footer, ChatItem, TypingAnim, Shared inputs)
• context/AuthContext.tsx (auth state & provider)
• helpers/ (axiosInstance, API communicator)
• assets, styling, and app entry (main.tsx).
README for additional insights
• Project description, features (multi-personality chat, JWT auth, chat history CRUD).
• Tech stack table.
• Setup instructions referencing .env for MONGODB_URI, JWT_SECRET, GROK_API_KEY.
• Mentions streamed responses from Grok LLaMA API.
Elements
• Blue rectangles for compute components (Client, API server).