How harkit07/ai-assistant works
AI Assistant is a full-stack chat product: users authenticate, manage conversation threads, submit prompts, and receive streamed model replies, with account and thread state persisted in MongoDB. The graph separates the React interaction layer, backend identity and chat domains, and external services. Relationships are limited to excerpted calls/imports or README-documented capabilities; some frontend and deployment details were not sampled.
Main entry points: user.js Account routes · chat.js Thread and chat routes · App.jsx Application shell · ChatWindow.jsx Chat interaction
Components 20
Chat interface
- Application shell
Frontend/src/App.jsx - Auth state
Frontend/src/AuthContext.jsx - Signup and login UI
Frontend/src/Login.jsx - Chat interaction
Frontend/src/ChatWindow.jsx - Message rendering
Frontend/src/Chat.jsx - Thread navigation
Frontend/src/Sidebar.jsx - Chat state
Frontend/src/ChatContext.jsx
Identity and access
- Account routes
Backend/routes/user.js - JWT authorization
Backend/middleware.js - User records
Backend/models/user.js - Revoked tokens
Backend/models/blacklistToken.js - Request validation
Backend/services/validationResult.js - User creation
Backend/services/user.js
Conversation backend
- Express API
Backend/server.js - Thread and chat routes
Backend/routes/chat.js - Thread records
Backend/models/Thread.js - AI inference client
Backend/utils/openai.js
External services
- MongoDB
- NVIDIA inference API
Other components
- User
Connections 29
- User → Application shell: uses
README.md - Application shell → Auth state: provides
Frontend/src/App.jsx - Application shell → Chat state: provides
Frontend/src/App.jsx - Application shell → Chat interaction: renders
Frontend/src/App.jsx - Application shell → Thread navigation: renders
Frontend/src/App.jsx - Signup and login UI → Auth state: uses
Frontend/src/Login.jsx - Chat interaction → Chat state: uses
Frontend/src/ChatWindow.jsx - Chat interaction → Message rendering: renders
Frontend/src/ChatWindow.jsx - Chat interaction → Signup and login UI: renders
Frontend/src/ChatWindow.jsx - Signup and login UI → Account routes: calls signup and login
README.md - Chat interaction → Thread and chat routes: requests chat and history
Frontend/src/ChatWindow.jsx - Thread navigation → Thread and chat routes: manages threads
README.md - Express API → Thread and chat routes: mounts API
Backend/server.js - Express API → Account routes: mounts API
Backend/server.js - Account routes → Request validation: validates input
Backend/routes/user.js - Account routes → JWT authorization: protects routes
Backend/routes/user.js - Account routes → User records: reads and creates
Backend/routes/user.js - Account routes → User creation: creates account
Backend/routes/user.js - User creation → User records: creates record
Backend/services/user.js - Account routes → Revoked tokens: revokes token
Backend/routes/user.js - JWT authorization → Revoked tokens: checks revocation
Backend/middleware.js - JWT authorization → User records: loads user
Backend/middleware.js - Thread and chat routes → JWT authorization: protects endpoints
Backend/routes/chat.js - Thread and chat routes → Thread records: reads and saves
Backend/routes/chat.js - Thread and chat routes → AI inference client: requests completion
Backend/routes/chat.js - AI inference client → NVIDIA inference API: streams inference
README.md - Express API → MongoDB: connects
Backend/server.js - User records → MongoDB: persists user data
README.md - Thread records → MongoDB: persists threads
README.md