This was basically five questions stapled together.
Start by clarifying requirements and constraints (e.g., offline duration, data types, security needs). Then walk through the architecture layer by layer: storage (IndexedDB), network interception (Service Worker), sync/retry, conflict resolution, security, and testing. Emphasize trade-offs and justify decisions with Airbnb-specific context (e.g., high user trust, global scale).
Pro tip: Frame your answer around user trust and data integrity: Airbnb users expect seamless booking even offline, so prioritize idempotent operations and clear conflict resolution to avoid double-bookings. Also, mention that security is not just about encryption but also about minimizing attack surface (e.g., short-lived tokens, strict CSP).
Ask about expected offline duration, types of reservations (e.g., hotel, experience), data sensitivity, and compliance (GDPR, PCI). Define success metrics like sync success rate and conflict frequency.
Outline what to store in IndexedDB (e.g., reservation drafts, user preferences, cached listings) and how to structure it for efficient queries. Describe Service Worker strategies (cache-first for static assets, network-first for API calls with fallback to IndexedDB).
Explain using Background Sync API with exponential backoff and retry limits. Detail conflict resolution strategies (e.g., last-write-wins with versioning, or server-side merge) and how to handle failures (e.g., user notification, manual resolution).
Cover encryption at rest (e.g., Web Crypto API with keys stored in secure enclave or derived from user credentials), token refresh (using refresh tokens with rotation), PII minimization (store only necessary data, anonymize where possible), and XSS/CSRF protections (CSP, SameSite cookies, CSRF tokens).
Describe unit tests for sync logic, integration tests with mocked network conditions, end-to-end tests using tools like Puppeteer, and security audits (penetration testing, static analysis). Include monitoring for sync failures and conflict rates in production.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.