← System Design

Keep Browser Tabs in Sync

mediumCore Concept
Asked at
Figma
Google
Notion
Stripe
Figma, Google, Notion, Stripe

Problem statement

Same-origin pub/sub between tabs for logout, cart hints, and leader signals — and why the channel is a signal, not a database.

Asked In

GoogleSlackFigmaNotionLinearStripe

Key Challenges

  • ·Syncing auth logout across tabs
  • ·Keeping cart or draft state coherent
  • ·Avoiding duplicate expensive work per tab
  • ·Choosing BroadcastChannel vs storage events vs SharedWorker
★

2-Minute Answer — High-Level TL;DR

Read this before your interview

HLD Interview Focus

I use BroadcastChannel as same-origin messaging between tabs. On logout I post a 'session:end' event so every tab clears credentials and routes to login. The channel is a signal, not storage — durable state still lives in cookies or a backend. For older fallback paths I may also listen to storage events on a known localStorage key.

→

My Approach: Building the Solution

How to think about this problem

Open two tabs of your app. Log out in one. If the other still shows a private dashboard, you have a cross-tab bug. BroadcastChannel is how you fix that class of problem.

Why This Approach?

Weak answers ignore multi-tab users. Strong answers design session and cart coherence across contexts without inventing a websocket to yourself.

BroadcastChannel is a walkie-talkie on one company floor (same origin). Everyone hears 'closing time' — but the employee database still lives in HR.

R

Requirements: What Makes a Great Solution?

Clarify scope before designing anything

Requirements Exploration Questions

Ask your interviewer these questions to refine requirements

Which states must agree across tabs?

  • ·Auth session
  • ·Cart
  • ·Feature flags
  • ·In-progress upload leader

Functional Requirements

Must Have — MVP

  • ✓Named channel per concern
  • ✓Typed message schema
  • ✓Ignore self-echoes if needed
  • ✓Persist source of truth separately

Advanced (If Time Permits)

  • +SharedWorker leader election
  • +storage event fallback

Non-Functional Requirements

Interview bar

  • ·Name the invariant in one sentence
  • ·Give one concrete failure of the naive approach
  • ·State when the pattern is the wrong tool
Premium

The full solution is part of HelloFrontend Pro

The question above is free to read in full. Upgrade to unlock the interactive workspace and the senior-level walkthrough that go with it.

  • Full RADIO-framework walkthrough with architecture diagrams
  • Data model, API design, and rendering strategy trade-offs
  • Performance, accessibility, and offline sections plus a model answer
Unlock the full solution →

Already a member? Log in to open the workspace.

More System Design questions

View all System Design →