Seenly

πŸ›οΈ 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 ```