Real-Time Collaborative Meetings & Calendar Series Sync
Engineered live multi-viewer meeting updates using Server-Sent Events paired with TanStack Query cache invalidation, plus recurring meeting series synchronization with native Google Calendar and Outlook calendars.
- Role
- Software Engineer
- Domain
- Full-Stack Product & Sync
- Timeline
- 2024 – 2025
- Outcome
- Live multi-user sync + native series parity
- TypeScript
- Node.js
- Fastify
- MongoDB
- React
- TanStack Query
- Server-Sent Events
01 / Problem & Constraints
Collaborative meeting workspaces—where managers and teammates view and edit shared agendas, notes, and action items simultaneously—break down quickly if users have to refresh the page to see each other’s updates or manually maintain parallel invites in their work calendars.
Building this feature cleanly required solving two distinct distributed-state problems at once:
- Multi-browser live freshness: Everyone viewing the same meeting page needed changes made by another participant to appear automatically in real time, without introducing brittle client-side merge logic or stale cache bugs.
- Native recurring calendar alignment: Recurring meeting series inside the web app needed to correspond cleanly to native recurring event series in users’ external calendars (Google Calendar and Microsoft Outlook)—including reschedules, edits, and cancellations—without letting external calendar quirks corrupt application state.
02 / System Architecture
Both problems were solved by keeping server state authoritative and choosing the simplest transport and ownership model that cleanly satisfied the constraints.
A / Real-Time Updates via SSE + TanStack Query Invalidation
When a participant saves a change through the backend API, the server publishes a lightweight change notification over a Server-Sent Events (SSE) stream to connected browsers viewing that meeting. Rather than pushing raw partial state patches into complex client reducers, the frontend listener calls TanStack Query cache invalidation on the affected query keys, triggering a targeted refetch of canonical server state.
B / Recurring Series Sync With Single Source of Truth
Recurring series metadata, schedules, and instance updates are modeled inside the application as the canonical source of truth, with outbound calendar adapters projecting series creates, updates, and cancellations onto Google Calendar and Outlook. Provider-specific identifiers and sync boundaries are isolated cleanly so future two-way reconciliation via inbound calendar webhooks can layer on without rewriting the core domain model.
03 / Key Architectural Trade-offs
| Decision | Chosen Approach | Alternative Considered | Why |
|---|---|---|---|
| Real-Time Transport | Server-Sent Events (SSE) over standard HTTP | Full-duplex WebSockets | Mutations already flow cleanly over authenticated REST endpoints; only server-to-client notifications are needed. SSE is simpler to operate, works naturally with HTTP auth/proxies, and reconnects automatically. |
| Client State Updates | Invalidate TanStack Query caches on SSE signal and refetch | Push full mutation payloads and manually patch client state | Manual client patching invites subtle divergence across permissions, derived fields, and race conditions. Cache invalidation keeps server responses canonical and lets TanStack Query deduplicate in-flight requests. |
| Calendar Ownership (v1) | Application as single source of truth (one-way outbound sync) | Immediate two-way sync via Google/Outlook webhooks | Two-way recurring-event sync introduces gnarly conflict resolution (single-instance overrides, timezone shifts, partial attendee edits, webhook retries). Shipping a rock-solid single source of truth delivered immediate user value while preserving a clean adapter boundary for v2 webhooks. |
04 / Failure Modes & Edge Cases
- Reconnection & missed signals: Browsers sleep tabs and drop connections routinely. Because SSE signals only trigger cache invalidation (and TanStack Query already refetches on window focus/reconnect), a temporarily disconnected client converges to exact server state automatically without missing an incremental patch.
- Recurring series vs. single-occurrence edits: External calendar APIs treat “edit this occurrence” very differently from “edit this and following events.” Explicitly tracking series-level vs. instance-level mappings in the adapter layer kept updates predictable across both Google Calendar and Outlook.
- Frontend data-loading waterfalls: Pairing this work with broader TanStack Query and React Router data-loading improvements kept refetches fast and cut initial page load times across the app.
05 / Outcome
Participants collaborating on the same meeting page see updates appear seamlessly across open browsers with minimal infrastructure overhead, and recurring meeting series stay aligned with users’ native Google Calendar and Outlook schedules. Keeping state ownership explicit—authoritative refetches on the frontend and a clear source-of-truth boundary on calendar sync—left the system straightforward to reason about, debug, and extend toward two-way webhooks.