How mhdsahil1/zline works
Zline is a real-time messaging and calling platform with multi-device end-to-end encryption and an AI assistant grounded in platform knowledge and web research. The main workflow is account access, opening chats, encrypting and sending messages, and synchronizing them across trusted devices; calls, group features, and AI research are distinct capabilities. The graph also shows persistence and the AI research layers. Some relationships are documented in the README rather than verified in sampled implementation, and unsampled internals are not inferred.
Main entry points: page.tsx Chat Workspace · messages/route.ts Message APIs · chat/route.ts AI Chat Endpoint · Chat.ts Chat Records
Components 29
Identity and Devices
- Sign-in and Registration
app/(auth)/login/page.tsx - Authentication API
app/api/auth/[...nextauth]/route.ts - Auth Configuration
lib/auth.ts - Device Pairing UI
components/DevicePairingModal.tsx - Device and Pairing APIs
app/api/devices/route.ts - Device Crypto
lib/crypto.ts
Messaging and Storage
- Chat Workspace
app/chat/page.tsx - Message APIs
app/api/messages/route.ts - Chat APIs
app/api/chats/route.ts - Groups and Polls
app/api/polls/route.ts - Message Records
lib/models/Message.ts - Chat Records
lib/models/Chat.ts - User Records
lib/models/User.ts - MongoDB Connector
lib/db.ts
Realtime and Calls
- Socket.IO Server
pages/api/socket/io.ts - Call Signaling API
app/api/calls/route.ts - Call Interfaces
components/CallModal.tsx - Group Calls
components/GroupCallModal.tsx
AI and Research
- AI Chat Endpoint
app/api/ai/chat/route.ts - Search Intent
lib/searchClassifier.ts - Web Research
lib/ai/researcher.ts - RAG Context Builder
lib/ai/context-builder.ts - Platform Knowledge Base
lib/ai/knowledge-base.ts - Obscura Browser
lib/obscura - Tavily Search
lib/tavily.ts
User Experience
- Product Landing
app/page.tsx - Link Preview API
app/api/link-preview/route.ts - Link Preview Card
components/LinkPreviewCard.tsx
Other components
- User
Connections 35
- User → Sign-in and Registration: signs in
README.md - Sign-in and Registration → Authentication API: authenticates
- Authentication API → Auth Configuration: uses options
- Auth Configuration → User Records: looks up
lib/auth.ts - User → Device Pairing UI: pairs device
README.md - Device Pairing UI → Device and Pairing APIs: registers device
- Device and Pairing APIs → Device Crypto: verifies fingerprint
app/api/devices/route.ts - Chat Workspace → Device Crypto: encrypts messages
app/chat/page.tsx - Chat Workspace → Device and Pairing APIs: registers device
app/chat/page.tsx - Chat Workspace → Message APIs: sends messages
- Message APIs → MongoDB Connector: connects
app/api/messages/route.ts - Message APIs → Message Records: creates and reads
app/api/messages/route.ts - Message APIs → Chat Records: finds chat
app/api/messages/route.ts - Message APIs → User Records: checks users
app/api/messages/route.ts - Chat APIs → MongoDB Connector: connects
app/api/chats/route.ts - Chat APIs → Chat Records: reads and updates
app/api/chats/route.ts - Groups and Polls → Message Records: creates and updates
app/api/polls/route.ts - Groups and Polls → Chat Records: finds chat
app/api/polls/route.ts - Message Records → MongoDB Connector: persists in
- Chat Records → MongoDB Connector: persists in
- User → Chat Workspace: messages and calls
README.md - Chat Workspace → Socket.IO Server: realtime events
- Chat Workspace → Call Interfaces: starts calls
app/chat/page.tsx - Chat Workspace → Group Calls: starts group calls
app/chat/page.tsx - Call Interfaces → Call Signaling API: signals calls
- User → AI Chat Endpoint: asks Zino
README.md - AI Chat Endpoint → Search Intent: classifies query
app/api/ai/chat/route.ts - AI Chat Endpoint → Web Research: requests research
app/api/ai/chat/route.ts - AI Chat Endpoint → RAG Context Builder: builds prompt
app/api/ai/chat/route.ts - RAG Context Builder → Platform Knowledge Base: uses knowledge
lib/ai/context-builder.ts - Web Research → Tavily Search: searches web
lib/ai/researcher.ts - Web Research → Obscura Browser: browses pages
lib/ai/researcher.ts - User → Product Landing: discovers product
app/page.tsx - Chat Workspace → Link Preview API: fetches metadata
- Link Preview API → Link Preview Card: renders preview