How potatosserver/youbike works
Project type and purpose
• This is primarily a client-side Progressive Web App (PWA) for searching YouBike station data, with an optional Android “wrapper” app that embeds the PWA in a WebView (using GoNative and custom plugins).
• The PWA fetches real-time data from the YouBike public API, displays station info, supports offline caching, geolocation, PWA installation, dark mode, and integrates with Google Maps for station navigation.
File structure
Top-level:
• Android/ → native Android project that packages the same PWA in a WebView.
– /app/src/main/assets → offline.html and all web assets for embedded offline mode.
– /app/src/main/java/co/median/android → GoNative core classes (WebView setup, JS bridge, file download, config updater, theme manager, etc.).
– /plugins/lottieAnimation → a plugin module for Lottie animations, illustrating the project’s plugin-based architecture.
README for additional insights
• Confirms it is a “simple, beautiful, low-traffic YouBike station searcher” with PWA features (offline, installable), geolocation, and Android APK releases.
• No custom backend: the app relies on YouBike’s public API and Google Maps links.
Main components and their interactions
A. Client Platform (User’s device/browser or Android app)
• Browser: loads index.html → main.js
• Android Native: launches WebView (GoNativeApplication) → loads offline.html or network index.html via GoNativeWindowManager
B. Frontend SPA
• service-worker.js → intercepts requests to cache static assets & API responses for offline mode
C. External Services
• YouBike Public API → station list & real-time availability
• Google Maps → deep link for station location
D. Native Plugins & Modules (Android only)
• GoNativeJSBridgeLibrary → bridge between JS and native code for downloads, file sharing, custom headers, etc.
• LottieAnimation plugin → supplies animated progress & splash screens
E. Device APIs
• Geolocation → calculate nearest stations and distances
• Notifications/Install prompts → for PWA or Android app updates
Architectural patterns & design principles
• SPA + Service Worker for offline first and responsive UX
• Plugin-based extensibility in native layer (e.g., Lottie plugin)
• Clear separation:
• Web layer (presentational + business logic in JS)
• Caching layer (Service Worker)
• Native wrapper (Android WebView + platform APIs)
• External API integrations