How timvisee/send works
Project type and purpose
• This is a full-stack, multi-client, encrypted file‐sharing platform (a community-maintained fork of Mozilla Send).
• It provides:
• A single-page Web client (in “app/” + “public/”)
• A Node.js HTTP/WebSocket server (“server/”)
• Mobile clients: Android (“android/”) and iOS (“ios/”)
• Optional CLI compatibility via “ffsend”
• Pluggable storage backends (local FS, S3, GCS, Redis)
File structure
• Top-level separation:
• “app/” – front-end application code (JS, CSS, UI components)
• “public/” – static assets & i18n resource bundles
• “server/” – Node.js micro-service, with routes, middleware, storage adapters
• “android/” & “ios/” – native mobile wrappers embedding the web client and platform code
• “common/” – shared scripts for asset mapping
• “build/”, “scripts/” – build/deploy tooling
• “test/” – unit, integration, end-to-end tests
• Docker, CI/CD configs for containerization & pipelines
Extract architecture hints from README
• Server is configurable via environment variables; supports Redis for rate-limiting, S3/GCS/FS for storage, FxA for auth.
• Web client is a PWA (with ServiceWorker, QR generation, streaming encryption via WebCrypto, zip.js).
• Android/iOS clients launch a WebView pointing at the same server endpoints.
Main components
a. Clients
• Web SPA (browser)
• ServiceWorker & Cache
• Crypto module (WebCrypto + password)
• UI layers (routes.js, various UI/*.js)
• Android App (WebView + native launcher)
• iOS App (WebView + Action Extension)
b. API Gateway / Load Balancer
• Directs HTTPS traffic to server instances (Docker containers)
c. Node.js Server
• Express (middleware/auth/language/limiter)
• Routes (upload, download, metadata, ws)
• Business logic (encryption metadata, file‐chunk streaming)
• Logging & experiments modules
d. Storage Layer
• Pluggable adapters (“server/storage/”):
• FS (local disk)
• S3 / S3-compatible
• GCS
• Redis (for ephemeral state or sessions)
e. External Services
• Redis cluster (rate limiting, state)
• AWS S3 / GCS buckets
• FxA Auth service (OAuth)
f. CDN (optional)
• Hosts static assets, locales, service worker, webmanifest
Relationships & interactions
• Browser → HTTPS → Load Balancer → Node.js Server
• Server ↔ Storage adapters for file chunks & metadata
• Server ↔ Redis for limits & ephemeral data
• Server ↔ FxA for user authentication
• Web client ↔ WebSocket for real-time upload/download progress
• Android/iOS → embed WebView → same HTTPS API endpoints
Architectural patterns & design principles
• Layered architecture: UI → API layer → storage adapters
• Pluggable storage via strategy pattern in “server/storage/index.js”
• Middleware pipeline in Express for auth, i18n, throttling
• SPA + Service Worker for offline/fallback & progressive enhancement
• CI/CD via Docker, GitLab CI, CircleCI for tests & deployments