How manish3-4/aichatbot works
MERN-GPT is a React chat application with an Express API, user authentication, and MongoDB-backed accounts and conversation history. The visible login path runs from the login page through shared auth state and an Axios helper to the user API, where validation and controller logic authenticate against the User model and issue a JWT cookie. The README documents AI responses and saved-chat operations, but the chat route and page excerpts are empty or minimal, so those capabilities are shown as documented rather than verified implementations.
Main entry points: App.tsx Page routing · user-routes.ts User routes · chat-routes.ts Chat routes · main.tsx React app
Components 22
Frontend
- React app
frontend/src/main.tsx - Page routing
frontend/src/App.tsx - Login form
frontend/src/pages/Login.tsx - Auth context
frontend/src/context/AuthContext.tsx - API helper
frontend/src/helpers/api-communicators.ts - Form input
frontend/src/components/input/customizedInput.tsx - Navigation header
frontend/src/components/header/index.tsx - Home page
frontend/src/pages/HomePage.tsx - Signup page
frontend/src/pages/Signup.tsx
Backend API
- Express app
backend/src/app.ts - API router
backend/src/routes/index.ts
Identity and data
- User routes
backend/src/routes/user-routes.ts - Request validation
backend/src/utils/validators.ts - User controller
backend/src/controllers/user-controller.ts - JWT creation
backend/src/utils/token-manager.ts - User model
backend/src/models/User.ts - Mongo connection
backend/src/db/connection.ts
Chat capabilities
- Chat page
frontend/src/pages/Chat.tsx - Chat routes
backend/src/routes/chat-routes.ts
Other components
- User
- MongoDB
- OpenAI service
Connections 24
- User → React app: uses
README.md - React app → Page routing: renders
frontend/src/main.tsx - React app → Auth context: provides auth
frontend/src/main.tsx - Page routing → Login form: routes to
frontend/src/App.tsx - Page routing → Signup page: routes to
frontend/src/App.tsx - Page routing → Home page: routes to
frontend/src/App.tsx - Page routing → Chat page: routes to
frontend/src/App.tsx - Page routing → Navigation header: renders
frontend/src/App.tsx - Login form → Form input: renders
frontend/src/pages/Login.tsx - Login form → Auth context: calls login
frontend/src/pages/Login.tsx - Auth context → API helper: calls login API
frontend/src/context/AuthContext.tsx - API helper → User routes: posts credentials
frontend/src/helpers/api-communicators.ts - Express app → API router: mounts routes
backend/src/app.ts - API router → User routes: registers
backend/src/routes/index.ts - API router → Chat routes: registers
backend/src/routes/index.ts - User routes → Request validation: validates requests
backend/src/routes/user-routes.ts - User routes → User controller: dispatches
backend/src/routes/user-routes.ts - User controller → User model: reads and writes
backend/src/controllers/user-controller.ts - User controller → JWT creation: creates token
backend/src/controllers/user-controller.ts - Mongo connection → MongoDB: connects
README.md - User model → MongoDB: persists users
README.md - Chat page → Chat routes: requests chats
README.md - Chat routes → OpenAI service: gets AI responses
README.md - Chat routes → MongoDB: stores chat history
README.md