A modern Progressive Web App (PWA) for checking real-time bus arrival times (ETA) for Hong Kong bus services. Built with SvelteKit, this application provides a fast and user-friendly interface to browse routes, view stops, and check bus arrival times from multiple bus companies.
- ๐ Multi-Company Support: Browse routes from CTB (Citybus), KMB, and NWFB
- ๐ Route Search: Quickly find bus routes with real-time filtering
- ๐ Stop Information: View detailed stop information and real-time ETA
- โฑ๏ธ Auto-Refresh: ETA data automatically refreshes every 10 seconds
- โญ Favorites: Save your frequently used stops for quick access
- ๐ Direction Switching: Switch between inbound and outbound directions
- ๐ฑ PWA Support: Install as a mobile app with offline capabilities
- โก Performance Optimized: Virtual scrolling for smooth performance with large route lists
- ๐จ Modern UI: Clean, responsive design with Tailwind CSS
- Framework: SvelteKit with Svelte 5
- Language: TypeScript
- Styling: Tailwind CSS 4
- Data Fetching: TanStack Query (formerly React Query)
- Virtualization: TanStack Virtual
- HTTP Client: Axios
- Date Formatting: date-fns
- PWA: Workbox
- Deployment: Netlify (Edge Functions)
The application fetches real-time bus data from official Hong Kong government APIs:
- CTB/Citybus:
https://rt.data.gov.hk/v2/transport/citybus - KMB:
https://data.etabus.gov.hk/v1/transport/kmb
- Bun (v1.3 or higher)
- Clone the repository:
git clone <repository-url>
cd bus-realtime-info- Install dependencies:
bun installStart the development server:
bun run devThe app will open automatically in your browser at http://localhost:5173.
Build the production version:
bun run buildPreview the production build:
bun run previewCheck TypeScript types:
bun run checkLint code:
bun run lintFormat code:
bun run formatsrc/
โโโ app.html # HTML template
โโโ routes/ # SvelteKit routes
โ โโโ +page.svelte # Home page (route list)
โ โโโ favorites/ # Favorites page
โ โโโ [companyId]/ # Dynamic routes
โ โโโ route/
โ โโโ [route]/
โ โโโ +page.svelte # Route detail page
โ โโโ stop/
โ โโโ [stopId]/
โ โโโ +page.svelte # Stop detail page
โโโ lib/
โ โโโ api/ # API clients
โ โ โโโ ctb/ # Citybus API
โ โ โโโ kmb/ # KMB API
โ โ โโโ common/ # Shared API types
โ โโโ components/ # Reusable Svelte components
โ โโโ stores/ # Svelte stores (favorites)
โ โโโ utils/ # Utility functions (ETA formatting)
โโโ service-worker.ts # PWA service worker
- Browse all available routes from supported bus companies
- Search/filter routes by route number
- Virtual scrolling for optimal performance with large lists
- View all stops along a route
- See real-time ETA for each stop
- Switch between inbound and outbound directions
- Shows arrival time in minutes for buses arriving in more than 1 minute
- Displays "ๅณๅฐๅฐ้" (Arriving Soon) for buses arriving within 1 minute
- Automatically refreshes every 10 seconds
- Sorted by arrival time
- Save frequently used stops
- Access favorites from the dedicated favorites page
- Favorites are stored in browser local storage
- Filter favorites by route number
The project is configured for deployment on Netlify using the Netlify adapter with Edge Functions enabled.
Build configuration is defined in netlify.toml:
[build]
command = "bun run build"
publish = "build"- Modern browsers with ES6+ support
- Mobile browsers (iOS Safari, Chrome Mobile)
- PWA installation supported on compatible browsers
This project is private.
This is a private project. Contributions are not currently accepted.
Built with โค๏ธ using SvelteKit