How sunil8521/gpt-clone-langgraph works
The product is a cookie-session authenticated AI chat application. Users sign in or create an account, open or create a conversation, send messages, and view conversation history; the chat agent uses Gemini and MongoDB-backed checkpoint memory. The sampled sources establish client authentication and chat API calls plus server startup and auth behavior. Chat-route and agent internals were not sampled, so their links reflect only the documented architecture and the repository’s exact paths.
Main entry points: chat.ts Chat routes · App.tsx App routing · auth.ts Auth routes · agent.ts Conversation agent
Components 16
Web client
- App routing
client/src/App.tsx - Sign in / sign up
client/src/pages/Auth.tsx - Chat interface
client/src/pages/Chat.tsx - Auth state
client/src/store/useAuthStore.ts - Chat state
client/src/store/useChatStore.ts
API and auth
- Express server
server/src/index.ts - Auth routes
server/src/routes/auth.ts - Session guard
server/src/middleware/auth.ts
Chat and agent
- Chat routes
server/src/routes/chat.ts - Conversation agent
server/src/agent.ts - Gemini model
Persistence
- User records
server/src/models/User.ts - Chat records
server/src/models/Chat.ts - Agent checkpoints
server/src/agent.ts
Other components
- User
- MongoDB
Connections 20
- User → App routing: uses
- App routing → Auth state: checks session
- App routing → Sign in / sign up: routes to
- App routing → Chat interface: routes to
- Sign in / sign up → Auth state: submits credentials
- Auth state → Auth routes: calls auth API
- Chat interface → Chat state: uses chat state
- Chat state → Chat routes: calls chat API
- Express server → Auth routes: mounts
- Express server → Chat routes: mounts
- Express server → Conversation agent: initializes
- Auth routes → User records: reads / writes
- Auth routes → MongoDB: stores sessions
- Chat routes → Session guard: guards requests
- Chat routes → Chat records: reads / writes
- Chat routes → Conversation agent: invokes
- Conversation agent → Gemini model: generates replies
- Conversation agent → Agent checkpoints: persists memory
- Chat records → MongoDB: persists records
- Agent checkpoints → MongoDB: stores checkpoints