Core Concepts
Understanding the architecture of Watchee Mini Apps will help you build better experiences.
Architecture
A Mini App is essentially a web application loaded inside a WebView within the Watchee mobile app (React Native). The MiniKit SDK facilitates communication between your web app and the native host.
graph TD
A[Mini App (Web)] <-->|MiniKit SDK| B[Native Bridge]
B <-->|Functions| C[Watchee App Host]
C <-->|Blockchain| D[Aptos Network]
C <-->|API| E[Watchee Backend]
The Bridge
The communication happens via a JavaScript bridge injected into the WebView. The window.WatcheeSDK object is the entry point for all native commands. MiniKit wraps this object to provide a typed, promise-based API.
Security
- Sandboxed: Mini Apps run in a restricted environment.
- Permissions: Sensitive actions (like spending funds or accessing personal info) require explicit user approval via native system dialogs.
- Origin Verification: Watchee validates the origin of the Mini App to ensure security.
Device Capabilities
Mini Apps can access native device features:
- Haptic Feedback: Trigger tactile responses via
minikit.hapticFeedback() - Camera/Microphone: Access via standard WebRTC
getUserMedia()API - Analytics: Track events via
minikit.trackEvent()
Device permissions (camera, microphone) are handled by the Watchee app and prompted to the user when first requested.
Lifecycle
- Initialization: The app loads, and the bridge is injected.
- Interaction: User interacts with the UI, triggering SDK calls.
- Background: When the user minimizes the app, it may be paused.
- Termination: The OS may kill the WebView to save resources. Use
localStorageor backend state to persist user data.