How aryaaloni33/cross-network-transfer works
1. Repository shape
- This is a small, single-service Node.js application: one backend entrypoint (server.js) and one browser client in public/.
- There is no separate frontend build pipeline or microservice split; the server appears to serve the static UI and handle realtime coordination.
2. Core architectural pattern
- The app follows a client–server signaling model rather than peer-to-peer direct transfer.
- The Node/Express server acts as a routing hub for file/message chunks and session matching between devices on different networks.
3. Backend boundary
- server.js is the main runtime boundary and likely owns:
- HTTP server startup
- Express static file hosting
- Socket.IO setup for realtime connections
- session/code creation and lookup
- message/file forwarding between connected clients
- Because the app depends on live connections, the backend is stateful in memory for active sessions, even if it does not use a database.
4. Frontend boundary
- public/index.html, public/style.css, and public/script.js form a plain browser-based SPA-like interface.
- There is no React/Vue/Angular layer in the tree; the client is vanilla HTML/CSS/JS.
- The UI likely handles mode selection, code generation, QR display, upload/input controls, progress updates, and receiver status.
5. Primary data flow
- A sender starts a session in the browser, which creates a short share code.
- The receiver joins using that code or QR scan.
- Once paired, the browser clients exchange data through Socket.IO messages routed by the server.
6. Transfer mechanics
- The README indicates chunked binary transfer for files, which implies the client splits payloads into pieces and reassembles them on the other side.
- This matters architecturally because the server is not storing whole files long-term; it is forwarding stream-like chunks and coordinating completion.
7. Session types
- The app supports at least three modes:
- Direct for one-to-one transfer
- Message for text payloads
- Broadcast for one-to-many delivery
- Broadcast suggests the server maintains room-like session membership rather than only paired connections.
8. Session lifecycle and security
- Share codes have a built-in expiry timer of about five minutes.
- Architecturally, that means session records are temporary and cleaned up automatically, reducing stale-room risk and limiting server state growth.
9. QR and mobile-friendly interaction
- QR generation is part of the user flow, enabling cross-device handoff without typing the code.
- The UI is optimized for mobile browsers, so the same browser client is intended to work on phones and desktops without native apps.
10. Static assets and presentation
- public/assets/ contains branding images/icons used by the UI.
- The design is entirely client-rendered and presentation-heavy, with the server only providing the assets and realtime channel.
11. Deployment/runtime implications
- The app is meant to run as a long-lived Node process, which is important because Socket.IO sessions require persistent websocket-capable connectivity.
- The presence of a GitHub Actions workflow (.github/workflows/daily-ping.yml) strongly suggests an external uptime workaround, likely to keep the hosted Render deployment from sleeping.
12. External services and infrastructure
- The README points to deployment on Render, so the operational boundary is a hosted Node app rather than self-managed infrastructure.
- No database, object store, or message broker is visible in the tree, so the architecture is intentionally lightweight and mostly in-process.
13. What to draw in an architecture diagram
- Show two browser clients (sender and receiver) connecting to a single Node/Express + Socket.IO server.
- Show the server serving static web assets and acting as the session/routing hub.
- Show temporary session/code state inside the server.
- Show optional broadcast room fan-out from the server to multiple receivers.
- Show a separate deployment/ops lane for Render hosting and the scheduled ping workflow.
Main entry points: server.js App server · script.js Client logic · index.html UI shell · daily-ping.yml Daily ping
Components 14
Backend
Node.js server and realtime coordination
- App server · Main runtime boundary for HTTP and realtime coordination
server.js - Static host · Serves the browser app and assets
server.js - Socket hub · Handles realtime connection and event routing
server.js - Sessions · Tracks share codes, expiry, and membership
server.js - Transfer router · Forwards chunks, messages, and broadcast events
server.js - Expiry timer · Removes stale session state after a short TTL
server.js
Frontend
Vanilla browser client and assets
- UI shell · Main browser interface and layout
public/index.html - Client logic · Implements pairing, QR flow, chunking, and realtime events
public/script.js - Styles · Presentation and mobile-friendly layout
public/style.css - Brand assets · Static images and UI artwork
public/assets
Ops
Deployment and uptime support
- Render · Long-lived deployment target for the Node process
- Daily ping · Scheduled uptime check to reduce sleeping
.github/workflows/daily-ping.yml
Other components
- Sender · Starts transfers and publishes data
- Receiver · Joins a session and receives data
Connections 15
- Sender → App server: connects · Opens the realtime session and sends payloads
- Receiver → App server: connects · Joins by code or QR and receives routed events
- App server → Static host: serves · Hosts the browser application and assets
- App server → Socket hub: accepts · Upgrades and manages Socket.IO connections
- Socket hub → Sessions: reads/writes · Creates and looks up temporary session records
- Socket hub → Transfer router: routes · Forwards text, chunk, and broadcast events
- Sessions → Expiry timer: expires · Session state is removed after the TTL
- Transfer router → Receiver: delivers · Pushes payloads to paired or room members
- UI shell → Client logic: loads · Browser UI bootstraps client behavior
- UI shell → Styles: uses · Applies presentation styling
- Client logic → Socket hub: emits events · Creates sessions, joins rooms, and sends chunks
- Client logic → UI shell: drives UI · Updates mode, code, QR, progress, and status
- Client logic → Brand assets: uses · Displays branding and interface imagery
- Render → App server: hosts · Runs the persistent Node service
- Daily ping → Render: keeps warm · Periodic request helps prevent sleep on the platform