Back to Projects
Back to Projects
SERVERLESS P2P WORKSPACE

EdgeSync

A serverless, offline-first, peer-to-peer collaborative workspace for iOS with real-time spatial vector mapping. Nearby devices form an encrypted mesh, stream live positions, and co-edit a shared map that merges deterministically after any partition — no server, no internet, no account.

github.com/Thet9354/EdgeSync-WorkSpace
EdgeSync — serverless peer-to-peer spatial workspace

The Thesis & The Problem

Real-time collaboration almost always means a server in the middle. EdgeSync asks whether nearby devices can collaborate with no server, no internet, and no account — forming an encrypted Multipeer mesh, streaming live positions, and co-editing a shared map of markers that still converges after the network partitions and reheals.

The hard part isn't the radio — it's proving the distributed logic is correct. EdgeSync's architecture is built around a testable transport seam so the convergence suite can run the real engine against a simulated mesh where tests control the topology: link, partition, relink.

Layering enforced by imports: the UI never imports MultipeerConnectivity, the engine never imports any radio framework, and only the location service imports CoreLocation. Wiring lives exclusively in the composition root — so the distributed logic is provably independent of the transport.

Concurrency Model (Swift 6)

Default actor isolation is MainActor; everything that owns framework state is pushed behind an actor boundary and crosses only as Sendable value types.

Main actor ─→ MapCanvasView (Canvas + TimelineView, 60 FPS) │ AsyncStream PeerSyncEngine (actor) tie-breaks, relay, acks, anti-entropy, backoff │ EngineOutput (Sendable) SyncRepository (@ModelActor) ModelContext, LWW merges ─→ MarkerSnapshot MeshClock (actor) hybrid logical clock ─→ HLCTimestamp MeshTransport (protocol) MultipeerTransport | FakeMesh (tests)

Conflict Resolution

Markers merge with last-writer-wins keyed on a hybrid logical clock, so concurrent edits from partitioned peers resolve to the same state on every device once they reconnect. The convergence suite runs the real PeerSyncEngine + SyncRepository + MeshClock stacks against an in-process FakeMeshHub — exercising exactly the link / partition / relink scenarios that can't be reproduced on demand with physical radios.

Live Demo Mode

A debug build feeds synthetic peers through the exact presence pipeline the radio uses — projection, interpolation, and canvas rendering are all the production code path, so the demo is an honest picture of the real system rather than a mock-up.