back

Sri Lanka Bank USD rates

A real-time Sri Lankan bank USD to LKR exchange rate tracker browser extension. Features instant rate update notifications via Firebase Cloud Messaging, a live badge display, customizable alerts, and direct fetching from official bank APIs without intermediate servers.

The Challenge

Building real-time tracking extensions in Manifest V3 presents a distinct technical hurdle: background Service Workers automatically go to sleep after a brief period of inactivity. This makes traditional polling or maintaining a WebSocket connection highly unreliable for timely notifications.

The Architecture & Solution

To solve the Manifest V3 lifecycle limits without draining device battery, the extension utilizes an event-driven push model:

  • Cloud-Based Scraper Backend: A lightweight cloud server constantly checks USD buying and selling rates from major commercial banks in Sri Lanka (BOC, Commercial Bank, Sampath Bank, HNB, People's Bank, etc.) and the Central Bank of Sri Lanka (CBSL).
  • Firebase Cloud Messaging (FCM): When a significant rate fluctuation is detected, the backend issues a silent push message via Firebase Cloud Messaging.
  • Service Worker Awakening: The incoming FCM message instantly wakes up the Chrome Extension's background Service Worker.
  • Local Action: Once awake, the Service Worker updates the local cache using chrome.storage.local, triggers a native Chrome notification to alert the user, and updates the browser action badge text with the latest rate.

Key Features

  • Live Bank Rates: View USD buying & selling rates across all major Sri Lankan commercial banks at a glance.
  • Push Notifications: Get alerted instantly about significant exchange rate changes.
  • Live Badge: Keep an eye on the rate directly from the extension's toolbar icon badge.
  • Local-Only Storage: All settings, configurations, and cached rates are kept strictly on your device using Chrome's secure storage APIs.
  • Direct & Secure: The extension fetches data directly from secure endpoints, preserving network privacy and security.

Technical Specifications

  • Manifest Version: Manifest V3
  • Core Tech Stack: React, JavaScript (ES6+), Webpack, Babel
  • APIs & Services: Firebase Cloud Messaging (FCM), Chrome Storage API, Chrome Alarms API, Chrome Notifications API, Chrome Context Menus API
Hello