How ayush-r-athi/neurachat works
NeuraChat is a full-stack chatbot: users authenticate, choose or create a conversation, submit prompts, and receive streamed model output while threads are saved for later management. The client separates authentication, shared chat state, conversation navigation, and chat rendering; Express routes handle authentication and protected thread/chat operations, with MongoDB models and Groq generation behind them. The README documents Markdown rendering and optional OpenAI support; excerpts show the chat renderer and a Groq helper, but not their internals or an active OpenAI call.
Main entry points: chat.js Thread and chat routes · App.jsx Application shell · ChatWindow.jsx Prompt and streaming UI · server.js Express server
Components 18
Chat client
- Application shell
Frontend/src/App.jsx - Shared chat state
Frontend/src/MyContext.jsx - Thread navigation
Frontend/src/Sidebar.jsx - Prompt and streaming UI
Frontend/src/ChatWindow.jsx - Message rendering
Frontend/src/Chat.jsx
Authentication
- Sign-in interface
Frontend/src/Auth.jsx - Session state
Frontend/src/AuthContext.jsx - Registration and login
Backend/routes/auth.js - JWT protection
Backend/middleware/auth.js
Backend API
- Express server
Backend/server.js - Thread and chat routes
Backend/routes/chat.js
Data and models
- User records
Backend/models/User.js - Thread records
Backend/models/Thread.js - Groq response helper
Backend/utils/openai.js
Other components
- Chat user
- MongoDB
- Groq model API
- OpenAI models
Connections 21
- Chat user → Application shell: uses
Frontend/src/App.jsx - Application shell → Sign-in interface: shows when signed out
Frontend/src/App.jsx - Sign-in interface → Registration and login: submits credentials
Frontend/src/Auth.jsx - Registration and login → User records: finds and creates
Backend/routes/auth.js - Sign-in interface → Session state: stores session
Frontend/src/Auth.jsx - Application shell → Session state: provides session
Frontend/src/App.jsx - Application shell → Shared chat state: provides chat state
Frontend/src/App.jsx - Application shell → Thread navigation: renders
Frontend/src/App.jsx - Application shell → Prompt and streaming UI: renders
Frontend/src/App.jsx - Thread navigation → Thread and chat routes: loads and manages threads
Frontend/src/Sidebar.jsx - Prompt and streaming UI → Thread and chat routes: posts streamed prompt
Frontend/src/ChatWindow.jsx - Prompt and streaming UI → Message rendering: renders messages
Frontend/src/ChatWindow.jsx - Express server → Registration and login: mounts
Backend/server.js - Express server → Thread and chat routes: mounts
Backend/server.js - Express server → MongoDB: connects
Backend/server.js - Thread and chat routes → JWT protection: guards routes
Backend/routes/chat.js - Thread and chat routes → Thread records: reads and saves
Backend/routes/chat.js - Thread and chat routes → Groq model API: streams completions
Backend/routes/chat.js - Groq response helper → Groq model API: requests completion
Backend/utils/openai.js - Thread and chat routes → OpenAI models: optional model support
README.md - Thread and chat routes → Prompt and streaming UI: streams SSE response
README.md