How inbestigator/messaging works
Project type and purpose
• This is a full-stack, end-to-end encrypted messaging service with two client applications (a macOS SwiftUI app and a web Next.js app) communicating in real time through a Deno server.
• Purpose: allow users on Mac or in a browser to exchange messages securely (messages encrypted/decrypted entirely on the clients).
File structure
• Top-level directories:
– messaging/ : macOS client app (SwiftUI, MVVM-style)
– server/ : Deno TypeScript server (WebSocket endpoint, message relay)
– www/ : Next.js web client (React + Tailwind CSS)
• Key config files:
– messaging/Info.plist, .entitlements — app identity and sandboxing
– server/deno.json, deno.lock — runtime & permissions for Deno
– www/package.json, next.config.ts, tailwind.config.ts, tsconfig.json — web build & lint setup
• Patterns & protocols:
– WebSockets for real-time communication
– End-to-end encryption performed in clients (Encryption.swift & www/src/enc.ts)
– SwiftUI for Mac UI; React/Next.js for web UI
Extract insights from README
• Confirms “end-to-end encrypted messaging service with a web and Mac app.”
• No direct mention of persistent storage, so the server likely acts as a transient message relay only.
a. Main components:
• macOS Client (messaging/)
• Web Client (www/)
• Message Relay Server (server/)
• Internet / Network
b. Relationships & interactions:
1. Both clients generate or retrieve encryption keypairs locally.
2. On login, clients open a WebSocket connection to the server.
3. When User A sends a message:
– Encryption module on client A encrypts message with recipient’s public key.
– Encrypted payload sent over WebSocket to the server.
4. Server relays ciphertext to User B’s open WebSocket.
5. Client B decrypts payload locally.
c. Architectural patterns/design principles:
– MVVM or similar unidirectional data flow on SwiftUI side (AppManager.swift as orchestrator, ChatView/SelectChatView as views).
– Component-based UI in React/Next.js with server-side rendering for pages (layout.tsx, page.tsx, input.tsx).
– Single WebSocket endpoint in Deno; no message persistence (stateless relay).
– Separation of concerns: UI + encryption logic + networking logic decoupled.
d. Important technologies/frameworks:
• SwiftUI (messagingApp.swift, ContentView.swift, ChatView.swift)
• Deno runtime + Oak or built-in WebSocket APIs (main.ts)
• Next.js with React + Tailwind CSS (www/src/app & components)