Architecture Overview
The example has two main components:- Backend (Express): Handles Limrun API calls with your API key, manages assets, and creates/deletes instances
- Frontend (React + Vite): Provides UI for instance creation and uses the
@limrun/uicomponent to stream the instance
What This Example Does
- Users upload app files (APK/IPA) through the frontend
- Files are uploaded to Limrun asset storage via backend API
- Users select platform (Android/iOS) and configuration
- Backend creates instance with uploaded assets
- Frontend displays the instance using RemoteControl component
- Users can interact with the instance in real-time
- Backend handles instance cleanup
Prerequisites
Running the Example
Start the Backend
http://localhost:3000.
Start the Frontend
In another terminal:http://localhost:5173.
Using the Application
- Open
http://localhost:5173in your browser - Select platform (Android or iOS)
- Choose Android version if applicable
- Optionally upload app files (APK/IPA)
- Click “Create Instance”
- Interact with the instance in the browser
- Click “Stop Instance” when done
Backend Code
The backend (backend/index.ts) provides three endpoints:
Get Upload URL
- Creates a Limrun asset record
- Returns a presigned S3 URL for direct upload
- Includes MD5 hash to skip re-uploading identical files
Create Instance
- Accepts uploaded asset names and platform preferences
- Creates instance with appropriate configuration
- Returns connection details for the frontend
Stop Instance
Frontend Code
Asset Upload Hook
TheuseAssets.ts hook manages file uploads:
RemoteControl Component
The main App component (frontend/src/App.tsx) uses the @limrun/ui package:
Key Features
Secure API Key Handling
The API key never leaves the backend. The frontend only receives:- Instance connection URLs
- Temporary tokens for WebRTC streaming
- Presigned URLs for direct S3 uploads
Efficient Asset Management
The MD5 hash comparison prevents re-uploading files:Real-Time Streaming
The RemoteControl component handles:- WebRTC connection setup
- Video/audio streaming
- Touch and keyboard input
- Automatic reconnection
Platform Flexibility
The same UI works for both Android and iOS instances with platform-specific configurations:Deployment Considerations
Backend
- Store
LIM_API_KEYin environment variables - Use CORS configuration for production domains
- Add rate limiting and authentication
- Implement user session management
Frontend
- Configure backend URL for production
- Add error boundaries and loading states
- Implement analytics and monitoring
- Handle network interruptions gracefully
Use Cases
- App Testing Platforms: Let users test apps in browser
- Customer Demos: Show apps without requiring downloads
- Internal Tools: QA dashboards with device access
- Education: Interactive mobile development tutorials
Next Steps
iOS Client API
Learn about the iOS client API
Asset Management
Understand asset storage and distribution