How chandan-kr-dev/talkwithme works
TalkWithMe is a web chat product: users register or sign in, verify accounts by email, connect with friends, open direct or group conversations, and exchange messages and attachments with delivery/read feedback. The main UI is split between the auth page and chat shell; API routes implement account, social, chat, and message operations, with MongoDB models providing persistence. README capabilities include password recovery, presence, notifications, and PWA support; some corresponding implementation details were not sampled, so their internal wiring is shown conservatively.
Main entry points: User.ts User records · app/page.tsx Auth screens · route.ts Message operations · chat/page.tsx Chat shell
Components 34
Accounts
- Auth screens
app/page.tsx - Registration
app/api/auth/register/route.ts - Login
app/api/auth/login/route.ts - Email verification
app/api/auth/verify-email/route.ts - Auth routes
app/api/auth - OTP mailer
lib/mailer.ts - User records
models/User.ts
Social graph
- Friend requests
app/api/friends/route.ts - User search/profile
app/api/user/route.ts
Conversations
- Chat shell
app/chat/page.tsx - Chat sidebar
components/Sidebar.tsx - Message composer
components/ChatWindow.tsx - Group controls
components/GroupChatModal.tsx - Direct chats
app/api/chat/route.ts - Group chats
app/api/chat/group/route.ts - Message operations
app/api/message/route.ts - Read receipts
app/api/message/read/route.ts - Chat records
models/Chat.ts - Message records
models/Message.ts - Message encryption
lib/encryption.ts
Live experience
- Notifications
app/api/notification/route.ts - Notification records
models/Notification.ts - Socket client
lib/socketClient.ts - Socket server
server.ts - Chat state
store/chatStore.ts - Push subscriptions
app/api/push/subscribe/route.ts - Subscription records
models/PushSubscription.ts - Push worker
public/push-sw.js
Platform services
- Attachment upload
app/api/upload/route.ts - Cloudinary client
lib/cloudinary.ts
Other components
- User
- SMTP provider
- Cloudinary storage
- MongoDB
Connections 47
- User → Auth screens: uses
- Auth screens → Registration: registers via
- Auth screens → Login: signs in via
- Auth screens → Email verification: verifies via
- Auth screens → Auth routes: password recovery
- Registration → User records: creates account
- Registration → OTP mailer: sends OTP
- Login → User records: checks credentials
- Login → OTP mailer: resends OTP
- Email verification → User records: verifies account
- OTP mailer → SMTP provider: delivers email
- Registration → MongoDB: connects through
- Login → MongoDB: connects through
- Chat shell → Chat sidebar: renders
- Chat shell → Message composer: renders
- Chat shell → Socket client: sets up
- Chat shell → Chat state: uses state
- User → Chat sidebar: manages contacts
- Chat sidebar → Friend requests: requests relationships
- Chat sidebar → User search/profile: searches users
- User → Group controls: creates groups
- Group controls → Group chats: manages groups
- Message composer → Message operations: sends and fetches
- Message composer → Read receipts: marks read
- Message composer → Attachment upload: uploads files
- Direct chats → Chat records: reads and writes
- Group chats → Chat records: reads and writes
- Message operations → Chat records: loads chat
- Message operations → Message records: reads and writes
- Message operations → Message encryption: encrypts content
- Message operations → User records: checks friendship
- Read receipts → Message records: updates read state
- Friend requests → User records: updates relationships
- User search/profile → User records: searches and updates
- Attachment upload → Cloudinary client: uploads media
- Cloudinary client → Cloudinary storage: stores files
- Notifications → Notification records: reads and updates
- Notifications → Message encryption: decrypts preview
- Push subscriptions → Subscription records: saves subscriptions
- Push worker → User: shows push alerts
- Socket server → Socket client: serves realtime
- Socket server → MongoDB: uses persistence
- Subscription records → MongoDB: persists in
- Notification records → MongoDB: persists in
- User records → MongoDB: persists in
- Chat records → MongoDB: persists in
- Message records → MongoDB: persists in