ποΈ Seenly Social β Architecture Specification
This document details the high-level architecture, module decomposition, and data pipelines powering Seenly Social.
---
1. High-Level System Architecture
Seenly employs a decoupled, privacy-first client-server model: - Client Layer: Single Page Application (SPA) built on React 18, Vite 6, and Tailwind CSS. Packaged as a Progressive Web App (PWA) and native Android application via Capacitor 8. - Relay & Backend Layer: Express.js and Go WebSocket relay servers providing zero-knowledge transit for encrypted communication. - Database & Storage Layer: Cloudflare R2 object storage for media CDN, Appwrite for identity & session synchronization, and MongoDB for public indexing.
``` ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β SEENLY CLIENT (REACT 18) β βββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββ€ β Home & Trendingβ Clips Viewer β E2EE Chat β Creator Profileβ βββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββ€ β WebCrypto Security Engine (ECDH) β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β Appwrite & Socket.IO Client β ββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ β HTTPS / WSS βΌ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β SEENLY ZERO-KNOWLEDGE RELAY SERVER β ββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ€ β Zero-Plaintext Message Relay β Trending Velocity Calculator β βββββββββββββββββββ¬βββββββββββββββββ΄βββββββββββββββββββ¬βββββββββββββββββββ β β βΌ βΌ βββββββββββββββββββββ βββββββββββββββββββββ β Cloudflare R2 β β Database Layer β β (Fast Media CDN) β β(Appwrite / Mongo) β βββββββββββββββββββββ βββββββββββββββββββββ ```
---
2. Core Subsystems
2.1 Trending Clips Engine (24-Hour Velocity)
Trending Clips are calculated dynamically on the server and client using real-time engagement velocity:$\text{Trending Score} = \frac{(\text{views} \times 1.0) + (\text{likes} \times 2.5) + (\text{comments} \times 3.5) + (\text{shares} \times 5.0)}{(\text{hoursSinceUpload} + 2)^{1.5}}$
- Dynamic Lifespan: Each clip is assigned a `trending_started_at` and `trending_expires_at` (24-hour duration). - No Stories: Ephemeral status updates are deprecated. Ephemeral discovery is powered strictly by trending public Clips.
2.2 End-to-End Encryption (E2EE) Messaging Subsystem
- Key Negotiation: ECDH over curve P-256 via browser `window.crypto.subtle`. - Cipher Suite: AES-GCM with 256-bit key length and unique 12-byte initialization vectors (IV) per message. - Clip Sharing Reference: Clips shared within chats are passed as referenced metadata payloads (`[SHARED_POST:{"id":"..."}]`), eliminating video duplication.2.3 Media Delivery & Preloading
- Video assets are stored on Cloudflare R2 and distributed over a global edge CDN. - Multi-tier preloading: - Active Clip: 100% full stream buffering with hardware decode. - Next 2 Clips: Metadata and first 3 seconds buffer preload.---
3. Directory Layout
``` seenly-social/ βββ android/ # Native Android Capacitor workspace βββ public/ # Public assets, sitemap.xml, robots.txt βββ server/ # Express & Node.js backend relay βββ src/ β βββ assets/ # Brand SVG & HD PNG assets β βββ components/ # UI components & Views β β βββ PixelPerfectSocialApp.jsx # Main App layout & tab router β β βββ ReelsViewer.jsx # Vertical video clips viewer β β βββ ChatMessenger.jsx # E2EE chat & clip sharing β β βββ ProfileDashboard.jsx # Creator profile & grid β β βββ SeenlyCreateStudio.jsx # Clip recording & creation β β βββ FirebaseLogin.jsx # Authentication module β β βββ cryptoHelper.js # WebCrypto E2EE library β βββ hooks/ # Custom React hooks (native, network) β βββ store/ # Zustand state management β βββ utils/ # Appwrite client, analytics, media resolvers ```