How yanzyuyu/beam works
Beam is a local-network portal for sharing files and clipboard text between devices through a browser. The workflow starts with the CLI discovering a LAN address, choosing storage and a port, then starting an HTTP server and presenting a QR code; peers use the portal to upload, browse, download, and delete files, organize folders, and exchange text. Server-Sent Events announce updates to connected clients. The README also describes browser-based tools and embedded web assets. Those UI capabilities are represented at the shared web source path; the excerpt is partial, so detailed UI-to-route wiring is omitted.
Main entry points: server.go HTTP server · main.go CLI launcher · store.go Sharing state · web.go Browser interface
Components 18
Startup and Discovery
- CLI launcher
cmd/beam/main.go - LAN discovery
pkg/netutil/netutil.go - Port selection
pkg/netutil/netutil.go - Browser opening
cmd/beam/main.go
Web Portal
- HTTP server
pkg/server/server.go - Browser interface
pkg/web/web.go - QR presentation
cmd/beam/main.go - QR endpoint
pkg/server/server.go
Sharing Services
- File transfer API
pkg/server/server.go - Folder API
pkg/server/server.go - Clipboard API
pkg/server/server.go - Live event stream
pkg/server/server.go - Browser tools
pkg/web/web.go
Local State
- Sharing state
pkg/store/store.go - Local files
Other components
- Beam operator
- Peer devices
- Local Wi-Fi
Connections 29
- Beam operator → CLI launcher: starts
- CLI launcher → LAN discovery: detects address
- CLI launcher → Port selection: selects port
- CLI launcher → Sharing state: opens storage
- CLI launcher → HTTP server: configures
- CLI launcher → QR presentation: prints portal QR
- CLI launcher → Browser opening: opens portal
- Browser opening → Browser interface: opens
- QR presentation → Peer devices: encodes portal address
- QR endpoint → Peer devices: serves QR image
- Peer devices → Local Wi-Fi: connects over
- Local Wi-Fi → HTTP server: carries HTTP
- HTTP server → Browser interface: serves interface
- HTTP server → File transfer API: dispatches routes
- HTTP server → Folder API: dispatches routes
- HTTP server → Clipboard API: dispatches routes
- HTTP server → QR endpoint: dispatches route
- Peer devices → File transfer API: uploads and requests
- Peer devices → Folder API: manages folders
- Peer devices → Clipboard API: shares text
- File transfer API → Sharing state: reads and writes files
- Folder API → Sharing state: manages folders
- Clipboard API → Sharing state: reads and writes text
- HTTP server → Live event stream: dispatches stream
- Live event stream → Sharing state: subscribes to updates
- Sharing state → Live event stream: signals changes
- Live event stream → Peer devices: streams updates
- Sharing state → Local files: persists manifest and files
- Browser tools → Peer devices: provides browser tools