### Start Metro Server for Example App Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/CONTRIBUTING.md Starts the Metro bundler for the example application. This allows you to run and test the library in a React Native environment. ```shell yarn example start ``` -------------------------------- ### Run Example App on iOS Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/CONTRIBUTING.md Builds and runs the example application on an iOS simulator or device. Requires iOS development environment setup. ```shell yarn example ios ``` -------------------------------- ### Install Dependencies (npm) Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/ExampleOldArch/README.md Installs all necessary project dependencies using npm. This is a fundamental step before running or building the application. ```bash npm install ``` -------------------------------- ### Run Example App on Android Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/CONTRIBUTING.md Builds and runs the example application on an Android device or emulator. Requires Android development environment setup. ```shell yarn example android ``` -------------------------------- ### Complete Development Flow Examples Source: https://github.com/juspay/airborne/blob/main/airborne_server/README.md Illustrates the typical development workflow for the Airborne project, covering initial setup, daily development practices, working with specific components, and cleanup procedures. These commands streamline the development process. ```bash 1. First-time setup: make setup # Sets up all dependencies 2. Daily development: make run # Start everything with hot-reloading # Make your changes... make commit # Format, lint, and commit 3. Working with specific components: make db # Start just the database make superposition # Start just Superposition make airborne-server # Build just the server 4. Cleanup and restart: make cleanup # Clean up containers and volumes make run # Fresh start ``` -------------------------------- ### Rust Example: Actix Web Backend Initialization Source: https://github.com/juspay/airborne/blob/main/memory-bank/systemPatterns.md Illustrative code demonstrating the setup of an Actix Web server in Rust, including middleware for authentication and logging, and database connections. This represents the core backend technology choice. ```rust // Example for demonstration purposes, not directly from input text. // Represents the technical decision of using Rust with Actix Web. use actix_web::{middleware, App, HttpServer}; #[actix_web::main] async fn main() -> std::io::Result<()>` { // ... database setup using Diesel ORM ... // ... Keycloak and Superposition client initialization ... HttpServer::new(|| { App::new() .wrap(middleware::Logger::default()) // Logging middleware // .wrap(middleware::Identity::default()) // Placeholder for Auth middleware // .configure(routes::register_routes) }) .bind("127.0.0.1:9000")? // Binding to the specified backend port .run() .await } ``` -------------------------------- ### Start Analytics Server with Kafka + ClickHouse (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Starts an alternative analytics server stack using Kafka for message queuing and ClickHouse for database storage. This setup provides a Kafka UI at http://localhost:8080 and ClickHouse at http://localhost:8123, alongside the Backend API at http://localhost:6400. ```bash # From the project root directory make run-kafka-clickhouse ``` -------------------------------- ### Start Analytics Server with Grafana + Victoria Metrics (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Starts the analytics server using the make command. This setup includes Grafana for dashboards and Victoria Metrics for time-series data storage. It also exposes a backend API. Access Grafana at http://localhost:4000, Victoria Metrics at http://localhost:8428, and the Backend API at http://localhost:6400. ```bash # From the project root directory make run-analytics ``` -------------------------------- ### Local Frontend Development (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_server/Project.md Commands to install dependencies and start the development server for the React frontend. Assumes Node.js and npm are installed. ```bash cd dashboard_react npm install npm run dev ``` -------------------------------- ### Initialize Airborne and Configure React Native Host (Kotlin) Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/NATIVE_INITIALIZATION.md This Kotlin code demonstrates initializing Airborne within the `onCreate` method of `MainApplication`. It also extends `AirborneReactNativeHost` to override `getJSBundleFile`, returning the bundle path from Airborne. This setup ensures Airborne is ready before React Native boots. ```kotlin import android.app.Application import `in`.juspay.airborneplugin.Airborne import `in`.juspay.airborneplugin.AirborneInterface import `in`.juspay.airborne.LazyDownloadCallback import `in`.juspay.airborneplugin.AirborneReactNativeHost import com.facebook.react.ReactApplication import com.facebook.react.ReactNativeHost import com.facebook.react.ReactPackage import com.facebook.react.PackageList import com.facebook.soloader.SoLoader import com.facebook.react.ReactHost import com.facebook.hermes.reactexecutor.BuildConfig import org.json.JSONObject import android.util.Log class MainApplication : Application(), ReactApplication { private var bundlePath: String? = null var isBootComplete = false var bootCompleteListener: (() -> Unit)? = null private lateinit var airborne: Airborne override val reactNativeHost: ReactNativeHost = object : AirborneReactNativeHost(this@MainApplication) { override fun getPackages(): List = PackageList(this).packages.apply { // Packages that cannot be autolinked yet can be added manually here, for example: // add(MyReactNativePackage()) } override fun getJSBundleFile(): String? { // This is delayed until mainActivity is created. // Make sure react is not booted until after bundlePath is created return airborne.getBundlePath() } override fun getJSMainModuleName(): String = "index" override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED } override val reactHost: ReactHost get() = AirborneReactNativeHost.getReactHost(applicationContext, reactNativeHost) override fun onCreate() { super.onCreate() // Initialize Airborne try { airborne = Airborne( this.applicationContext, "https://airborne.sandbox.juspay.in/release/airborne-react-example/android", object : AirborneInterface() { override fun getNamespace(): String { return "airborne-example" // Your app id } override fun getDimensions(): HashMap { val map = HashMap() map.put("city", "bangalore") return map } override fun getLazyDownloadCallback(): LazyDownloadCallback { return object : LazyDownloadCallback { override fun fileInstalled(filePath: String, success: Boolean) { // Logic } override fun lazySplitsInstalled(success: Boolean) { // Logic } } } override fun onEvent( level: String, label: String, key: String, value: JSONObject, category: String, subCategory: String ) { // Log the event } override fun startApp(indexPath: String) { isBootComplete = true bundlePath = indexPath bootCompleteListener?.invoke() } }) Log.i("Airborne", "Airborne initialized successfully") } catch (e: Exception) { Log.e("Airborne", "Failed to initialize Airborne", e) } SoLoader.init(this, OpenSourceMergedSoMapping) } } ``` -------------------------------- ### Performance Monitoring API Request Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Example `curl` command to monitor download and installation performance trends over a specified number of days for a tenant. Useful for tracking the efficiency of the update process. ```bash # Monitor performance trends curl "http://localhost:8081/analytics/performance?tenant_id=acme&days=30" ``` -------------------------------- ### Install iOS Pods Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/ExampleOldArch/README.md Installs CocoaPods dependencies for the iOS platform. This command should be run after installing npm dependencies if you are developing for iOS. ```bash cd ios && pod install ``` -------------------------------- ### Start Metro Bundler for React Native Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/ExampleSplitBundle/README.md Starts the Metro JavaScript bundler, which is essential for developing React Native applications. This command is executed from the root of the project directory. It supports both npm and Yarn package managers. ```sh # Using npm npm start # OR using Yarn yarn start ``` -------------------------------- ### Airborne Server Development Modes Source: https://github.com/juspay/airborne/blob/main/airborne_server/README.md Commands for starting various development environments for the Airborne server and its components. This includes the full server, analytics server with different backends, dependency setup, building, status checks, stopping, and cleanup. ```bash # Start the complete Airborne server development environment make run # Start analytics server with Grafana + Victoria Metrics make run-analytics # Start analytics server with Kafka + ClickHouse (alternative) make run-kafka-clickhouse # Set up dependencies only make setup # Build the server without running make airborne-server # Check system status make status # Stop all services make stop # Clean up everything and start fresh make cleanup ``` -------------------------------- ### Shell Script Example: Superposition Organization Initialization Source: https://github.com/juspay/airborne/blob/main/memory-bank/systemPatterns.md A conceptual shell script demonstrating the initialization process for Superposition, where an organization is created via API call before the main backend service starts. This reflects the 'Initialization Container Pattern'. ```bash # Example for demonstration purposes, not directly from input text. # Represents the Superposition organization initialization logic. SUPERPOSITION_API_URL="http://superposition:8080/api/v1" ORGANIZATION_NAME="DefaultHyperOTAOrg" # Call Superposition API to create the organization RESPONSE=$(curl -s -X POST \ -H "Content-Type: application/json" \ -d "{{\"name\": \"$ORGANIZATION_NAME\"}}" \ "$SUPERPOSITION_API_URL/organizations") # Extract the organization ID from the response (simplified) ORG_ID=$(echo $RESPONSE | jq -r .id) # Set the environment variable for the Hyper OTA server export SUPERPOSITION_ORG_ID=$ORG_ID echo "Superposition organization '$ORGANIZATION_NAME' created with ID: $ORG_ID" # ... subsequent commands to start the Hyper OTA server ... ``` -------------------------------- ### Quick Start Development Server Source: https://github.com/juspay/airborne/blob/main/airborne_server/README.md Commands to quickly start the Airborne server or the analytics server in development mode with hot-reloading enabled. This is ideal for rapid iteration during development. ```bash # Start the Airborne server in development mode with hot-reloading make run # Or start the analytics server in development mode make run-analytics ``` -------------------------------- ### Run iOS Application (npm) Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/ExampleOldArch/README.md Builds and runs the React Native application on an iOS simulator or connected device using npm. Requires iOS development environment setup. ```bash npm run ios ``` -------------------------------- ### Local Development Server Start Command Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Command to start the local development infrastructure and server for the Airborne project. This typically involves running `make run-analytics` from the project's root directory. ```bash Run `make run-analytics` from project root to start infrastructure and server ``` -------------------------------- ### List Files API Request Example Source: https://github.com/juspay/airborne/blob/main/API_DOCUMENTATION.md Shows how to list all files associated with an application using a GET request to the /file/list endpoint. Supports pagination and search functionality through optional query parameters. Authentication and organization headers are mandatory. ```http GET /file/list?page=1&per_page=50&search=example HTTP/1.1 Host: airborne.juspay.in Authorization: Bearer x-organisation: x-application: ``` -------------------------------- ### Run Android Application (npm) Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/ExampleOldArch/README.md Builds and runs the React Native application on an Android emulator or connected device using npm. Requires Android development environment setup. ```bash npm run android ``` -------------------------------- ### Query Adoption Metrics (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Retrieves OTA adoption metrics for a specified tenant and application over a given number of days using the /analytics/adoption GET endpoint. The response includes total and successful updates, failure counts, success rate, and hourly installation data. ```bash curl "http://localhost:8081/analytics/adoption?tenant_id=acme-corp&days=30&app_id=my-app" ``` -------------------------------- ### Create Package API Request Example Source: https://github.com/juspay/airborne/blob/main/API_DOCUMENTATION.md Provides an example of creating a new package, which bundles multiple files, using a POST request to the `/packages` endpoint. The request body includes the package index file path, a tag, and an array of file identifiers. Authentication and organization headers are necessary. ```json { "index": "/package/index.json", "tag": "release-1.0", "files": [ "file1.txt@tag:v1", "file2.txt@version:1" ] } ``` -------------------------------- ### Build and Run React Native iOS App Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/ExampleSplitBundle/README.md Builds and runs the React Native application on an iOS simulator or device. This command should be executed after ensuring all CocoaPods dependencies are installed and the Metro bundler is running. It supports both npm and Yarn. ```sh # Using npm npm run ios # OR using Yarn yarn ios ``` -------------------------------- ### ClickHouse Schema for Hourly Installs Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Defines the SQL schema for the `hourly_installs` materialized view in ClickHouse. It aggregates unique installations per hour, partitioned by month and ordered by tenant, organization, app, target version, and hour. ```sql CREATE TABLE hourly_installs ( tenant_id String, org_id String, app_id String, target_version String, hour_slot DateTime, installs AggregateFunction(uniqExact, String) ) ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMM(hour_slot) ORDER BY (tenant_id, org_id, app_id, target_version, hour_slot); ``` -------------------------------- ### Development Environment Setup Commands Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Shell commands for setting up the development environment, including cloning the repository, creating feature branches, and running build and test targets using `make`. ```bash # Clone your fork: git clone https://github.com/yourusername/airborne.git # Create a feature branch: git checkout -b feature/my-feature # Set up development environment: make run-analytics (from project root) # Run tests: make test (from project root) ``` -------------------------------- ### Install CocoaPods Dependencies for React Native iOS Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/ExampleSplitBundle/README.md Installs the necessary CocoaPods dependencies for building the React Native iOS application. This is typically run once during initial setup or after updating native dependencies. It requires Ruby and Bundler to be installed. ```sh # Install the Ruby bundler itself bundle install # Install CocoaPods dependencies bundle exec pod install ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/juspay/airborne/blob/main/airborne_server/README.md Initial steps to clone the Airborne repository and navigate into the project directory. This is the prerequisite for all subsequent commands. ```bash git clone cd airborne ``` -------------------------------- ### Android: Start MainActivity from SplashActivity Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/NATIVE_INITIALIZATION.md If your Android app uses a native `SplashActivity`, listen for the `startApp` callback from `AirborneInterface` to initiate `MainActivity`. This ensures that Airborne is initialized before the React Native activity starts. ```kotlin class SplashActivity : AppCompatActivity() { var hasBootCompleted = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.splash_screen) if (applicationContext is MainApplication) { (applicationContext as MainApplication).bootCompleteListener = { startMainActivity() } if ((applicationContext as MainApplication).isBootComplete) { startMainActivity() } } } private fun startMainActivity() { synchronized(this) { if (hasBootCompleted) return hasBootCompleted = true } startActivity(Intent(this, MainActivity::class.java)) finish() } } ``` -------------------------------- ### Building Docker Images Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Provides Docker commands for building the application image. It shows how to create a standard build and a multi-stage build optimized for production. ```bash # Build optimized image docker build -t ota-analytics:latest . # Multi-stage build with minimal runtime docker build --target production -t ota-analytics:prod . ``` -------------------------------- ### GET /analytics/performance - Performance Metrics Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Retrieve download speeds, install times, and performance trends for OTA updates. ```APIDOC ## GET /analytics/performance ### Description Download speeds, install times, and performance trends. ### Method GET ### Endpoint `/analytics/performance` ### Parameters #### Query Parameters - **tenant_id** (string) - Required - Identifier for the tenant. - **days** (integer) - Required - Number of past days to consider. ### Response #### Success Response (200) - **data** (object) - Contains performance metrics. - **average_download_speed_mbps** (number) - Average download speed in Mbps. - **average_install_duration_seconds** (number) - Average installation duration in seconds. - **performance_trends** (array) - Trends in performance metrics over time. - **date** (string) - The date in YYYY-MM-DD format. - **avg_download_speed_mbps** (number) - Average download speed for the day. - **avg_install_duration_seconds** (number) - Average install duration for the day. #### Response Example ```json { "data": { "average_download_speed_mbps": 28.5, "average_install_duration_seconds": 110, "performance_trends": [ { "date": "2025-06-01", "avg_download_speed_mbps": 27.0, "avg_install_duration_seconds": 115 }, { "date": "2025-06-02", "avg_download_speed_mbps": 29.0, "avg_install_duration_seconds": 105 }, { "date": "2025-06-03", "avg_download_speed_mbps": 29.5, "avg_install_duration_seconds": 110 } ] } } ``` ``` -------------------------------- ### Development Workflow with Make Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Illustrates common commands for the analytics server development workflow using the project's Makefile. It covers starting services, building, code quality checks, and infrastructure management. ```bash # Navigate to project root (if not already there) cd .. # Show all available commands make help # Start analytics development environment make run-analytics # Grafana + Victoria Metrics make run-kafka-clickhouse # Kafka + ClickHouse alternative # Build analytics server make analytics-server # Code quality make fmt # Format code make lint # Run linting make check # Format check and linting (CI mode) make lint-fix # Run linting with automatic fixes # Infrastructure management make status # Show system status make stop # Stop all services make cleanup # Clean up containers and volumes # Run with specific log level RUST_LOG=debug make run-analytics ``` -------------------------------- ### Complete OTA Update Workflow Example (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_cli/README.md Demonstrates a full workflow for setting up Over-The-Air (OTA) updates using the Airborne CLI and React Native. This includes initializing configuration, creating release configurations, bundling the app, authenticating with Airborne, and finally uploading files and creating packages for both Android and iOS. ```bash # 1. Navigate to your React Native project cd my-react-native-app # 2. Initialize Airborne configuration node airborne_cli/src/index.js \ -o "MyCompany" \ -n "MyApp" \ -j "index.js" # 3. Create release configurations for both platforms node airborne_cli/src/index.js create-local-release-config -p android -b 30000 -r 60000 node airborne_cli/src/index.js create-local-release-config -p ios -b 30000 -r 60000 # 4. Build your React Native bundles (standard RN commands) npx react-native bundle --platform android --dev false --entry-file index.js \ --bundle-output android/app/build/generated/assets/react/release/index.android.bundle \ --assets-dest android/app/build/generated/res/react/release npx react-native bundle --platform ios --dev false --entry-file index.js \ --bundle-output ios/main.jsbundle \ --assets-dest ios # 5. Authenticate with Airborne node airborne_cli/src/index.js login --client_id "$AIRBORNE_CLIENT_ID" --client_secret "$AIRBORNE_CLIENT_SECRET" # 6. Upload files and create packages node airborne_cli/src/index.js create-remote-files -p android --upload -t "v1.0.0" node airborne_cli/src/index.js create-remote-package -p android -t "v1.0.0" node airborne_cli/src/index.js create-remote-files -p ios --upload -t "v1.0.0" node airborne_cli/src/index.js create-remote-package -p ios -t "v1.0.0" ``` -------------------------------- ### Get File API Request Example Source: https://github.com/juspay/airborne/blob/main/API_DOCUMENTATION.md Illustrates how to retrieve details for a specific file using a GET request to the /file endpoint. The file is identified by a `file_key` query parameter, which can be in the format `file_path@version:version_number` or `file_path@tag:tag_name`. Proper authentication and organization headers are required. ```http GET /file?file_key=file_path@tag:tag_name HTTP/1.1 Host: airborne.juspay.in Authorization: Bearer x-organisation: x-application: ``` -------------------------------- ### Getting Help with Airborne CLI (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_cli/README.md Provides instructions on how to get help for any command within the Airborne CLI. By appending the `--help` flag to the main CLI command, users can access detailed usage information, options, and examples for specific commands. ```bash node airborne_cli/src/index.js --help node airborne_cli/src/index.js --help ``` -------------------------------- ### Clone Airborne Repository Source: https://github.com/juspay/airborne/blob/main/README.md Clones the Airborne project repository using Git. Replace the placeholder with the actual repository URL. This is the first step before starting the server. ```bash git clone # Replace with the actual URL cd airborne ``` -------------------------------- ### Database and Migration Setup (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_server/Project.md Commands for setting up PostgreSQL databases and running migrations using Diesel. Requires user credentials and specific database names. ```bash psql -U -d postgres CREATE DATABASE hyperotaserver OWNER ; CREATE DATABASE config OWNER ; diesel migration run make db-init # in superposition ``` -------------------------------- ### Build Documentation React App Source: https://github.com/juspay/airborne/blob/main/README.md Builds the documentation frontend application written in React. This command is used to generate the documentation website. ```bash make docs ``` -------------------------------- ### Display All Make Commands Source: https://github.com/juspay/airborne/blob/main/README.md Shows a help message listing all available make commands along with their descriptions. This is useful for understanding the full range of project management tasks. ```bash make help ``` -------------------------------- ### Query Performance Metrics (Bash) Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Retrieves performance metrics, including download speeds, install times, and performance trends, for a specified tenant over a number of days using the /analytics/performance GET endpoint. This data helps in optimizing the update process. ```bash curl "http://localhost:8081/analytics/performance?tenant_id=acme-corp&days=30" ``` -------------------------------- ### Run Analytics Server (Kafka + ClickHouse) Source: https://github.com/juspay/airborne/blob/main/README.md Starts the analytics server using a Kafka and ClickHouse stack. This includes the analytics backend API, Kafka UI, ClickHouse database, and supporting services like Zookeeper and Kafka. ```bash make run-kafka-clickhouse ``` -------------------------------- ### React Native Airborne API Usage Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/README.md Example of how to use the Airborne React Native API methods to read release configuration, get file content, and retrieve the bundle path. These methods are asynchronous and return Promises. ```typescript import { readReleaseConfig, getFileContent, getBundlePath } from 'airborne-react-native'; // Read configuration const config = await readReleaseConfig(namespace/appId); // Get file content const content = await getFileContent(namespace/appId, 'path/to/file.json'); // Get bundle path const bundlePath = await getBundlePath(namespace/appId); ``` -------------------------------- ### React Native: Interact with Airborne SDK Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/NATIVE_INITIALIZATION.md Utilize the `airborne-react-native` SDK to interact with Airborne features from your React Native application. This includes reading release configurations, fetching file content from OTA bundles, and getting the bundle path. ```typescript import { readReleaseConfig, getFileContent, getBundlePath } from 'airborne-react-native'; // Read release configuration const config = await readReleaseConfig(namespace/appId); console.log('Release config:', JSON.parse(config)); // Get file content from OTA bundle const content = await getFileContent(namespace/appId, 'path/to/file.json'); console.log('File content:', content); // Get bundle path const bundlePath = await getBundlePath(namespace/appId); console.log('Bundle path:', bundlePath); ``` -------------------------------- ### iOS: Initialize Airborne in AppDelegate Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/NATIVE_INITIALIZATION.md Initialize the Airborne SDK in your `AppDelegate.swift` file by creating an instance of `AirborneServices`. Provide the release configuration URL and a delegate conforming to `AirborneDelegate` for callbacks. ```swift import UIKit import Airborne @main class AppDelegate: UIResponder, UIApplicationDelegate { private var airborne: AirborneServices? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Initialize Airborne airborne = Airborne(releaseConfigURL: "https://yourdomain.com/release-config-url.json", delegate: self) return true } } // AirborneDelegate extension AppDelegate: AirborneDelegate { func namespace() -> String { return "airborne-example" } func dimensions() -> [String : String] { ["city": "bangalore"] } func onLazyPackageDownloadComplete(downloadSuccess: Bool, url: String, filePath: String) { } func onAllLazyPackageDownloadsComplete() { } func onEvent(level: String, label: String, key: String, value: [String : Any], category: String, subcategory: String) { // Log the event } func startApp(indexBundleURL: URL?) { // Local file path URL for the available index bundle } } ``` -------------------------------- ### Add Airborne Maven Repository (Gradle) Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/NATIVE_INITIALIZATION.md This snippet shows how to add the Airborne Maven repository to your Android project's root `build.gradle` file. This allows Gradle to download Airborne dependencies. ```gradle allprojects { repositories { maven { url "https://maven.juspay.in/hyper-sdk/" } // ... other mavens } } ``` -------------------------------- ### Create React Native Release Configuration with Airborne CLI Source: https://context7.com/juspay/airborne/llms.txt Initializes Airborne configuration and creates platform-specific release configurations for React Native projects. It requires the project path and organizational details. The output is a JSON configuration file. ```bash cd my-react-native-app node airborne_cli/src/index.js create-local-airborne-config . \ -o "acme-corp" \ -n "mobile-app" \ -j "index.js" # Creates airborne-config.json { "organisation": "acme-corp", "namespace": "mobile-app", "js_entry_file": "index.js", "android": { "index_file_path": "android/app/build/generated/assets/react/release/index.android.bundle" }, "ios": { "index_file_path": "ios/main.jsbundle" } } node airborne_cli/src/index.js create-local-release-config . \ -p android \ -b 30000 \ -r 60000 ``` -------------------------------- ### Enable React and React DOM ESLint Rules in Vite Source: https://github.com/juspay/airborne/blob/main/airborne_server/docs_react/README.md This configuration enables specific lint rules for React and React DOM using 'eslint-plugin-react-x' and 'eslint-plugin-react-dom'. It's designed for TypeScript files in a Vite project and requires these plugins to be installed. Project configuration for type checking is also specified. ```javascript // eslint.config.js import reactX from "eslint-plugin-react-x"; import reactDom from "eslint-plugin-react-dom"; export default tseslint.config([ globalIgnores(["dist"]), { files: ["**/*.{ts,tsx}"], extends: [ // Other configs... // Enable lint rules for React reactX.configs["recommended-typescript"], // Enable lint rules for React DOM reactDom.configs.recommended, ], languageOptions: { parserOptions: { project: ["./tsconfig.node.json", "./tsconfig.app.json"], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, ]); ``` -------------------------------- ### Install Airborne using CocoaPods Source: https://github.com/juspay/airborne/blob/main/airborne_sdk_iOS/hyper-ota/README.md This code snippet shows how to add Airborne to your project's Podfile for installation using CocoaPods. Ensure you have CocoaPods installed and run 'pod install' in your project directory after adding this line. ```ruby pod 'Airborne' ``` -------------------------------- ### Database Migration using Make Source: https://github.com/juspay/airborne/blob/main/airborne_server/README.md Applies pending database schema migrations using the Makefile. This command automatically handles loading environment variables from the .env file and constructing the database URL. ```bash make db-migration ``` -------------------------------- ### Install airborne-react-native Source: https://github.com/juspay/airborne/blob/main/airborne-react-native/README.md Command to install the airborne-react-native package using npm. ```sh npm install airborne-react-native ``` -------------------------------- ### Configuration Management Source: https://github.com/juspay/airborne/blob/main/airborne_server/README.md Manage configurations for applications and packages. ```APIDOC ## POST /organisations/applications/config/create_json_v1 ### Description Creates a new configuration associated with the latest package version. ### Method POST ### Endpoint /organisations/applications/config/create_json_v1 ### Parameters #### Request Body - **configuration** (object) - Required - JSON defining configuration version, timeouts, and properties. ### Request Example ```json { "configuration": { "version": "1.0.0", "timeouts": { "default": 30 }, "properties": { "featureFlag": true } } } ``` ### Response #### Success Response (200) - **version** (string) - The package version associated with the configuration. - **config_version** (string) - The version string of the newly created configuration. #### Response Example ```json { "version": "1.0.0", "config_version": "config-abc123" } ``` ## POST /organisations/applications/config/create_json_v1/multipart ### Description Creates a new configuration via multipart/form-data (primarily for JSON payload). ### Method POST ### Endpoint /organisations/applications/config/create_json_v1/multipart ### Parameters #### Request Body - **json** (text) - Required - JSON string for the configuration. ### Request Example ``` --boundary Content-Disposition: form-data; name="json" { "configuration": { "version": "1.0.0", "timeouts": { "default": 30 } } } --boundary-- ``` ### Response #### Success Response (200) - **version** (string) - The package version associated with the configuration. - **config_version** (string) - The version string of the newly created configuration. #### Response Example ```json { "version": "1.0.0", "config_version": "config-abc123" } ``` ``` -------------------------------- ### Get Live Release Configuration (Legacy) Source: https://github.com/juspay/airborne/blob/main/airborne_server/README.md Serves the live release configuration for a specified organization and application. This is a legacy endpoint and returns a JSON object with combined release configuration, including package details and resources. ```http GET /release/{organisation}/{application} ``` -------------------------------- ### GET /analytics/versions - Version Distribution Source: https://github.com/juspay/airborne/blob/main/airborne_analytics_server/README.md Get the current version spread across active devices for a specific application. ```APIDOC ## GET /analytics/versions ### Description Current version spread across active devices. ### Method GET ### Endpoint `/analytics/versions` ### Parameters #### Query Parameters - **tenant_id** (string) - Required - Identifier for the tenant. - **app_id** (string) - Required - Identifier for the application. ### Response #### Success Response (200) - **data** (object) - Contains the version distribution data. - **versions** (array) - List of versions and their distribution. - **version** (string) - The app version. - **device_count** (integer) - Number of devices running this version. - **percentage** (number) - Percentage of devices running this version. - **total_devices** (integer) - Total number of active devices. #### Response Example ```json { "data": { "versions": [ { "version": "1.1.0", "device_count": 8524, "percentage": 67.2 }, { "version": "1.0.0", "device_count": 3891, "percentage": 30.7 }, { "version": "0.9.8", "device_count": 265, "percentage": 2.1 } ], "total_devices": 12680 } } ``` ``` -------------------------------- ### Install `diesel-cli` for PostgreSQL Source: https://github.com/juspay/airborne/blob/main/README.md Installs the `diesel-cli` for managing database migrations, specifically configured for PostgreSQL. This command is required for database schema changes. ```bash cargo install diesel_cli --no-default-features --features postgres ``` -------------------------------- ### Create Release with Dimension Targeting (Shell) Source: https://context7.com/juspay/airborne/llms.txt Creates a new release, specifying configuration, package details, dimension targeting, and resources. Requires Content-Type, Authorization, x-organisation, and x-application headers. The request body includes detailed configuration for boot/package timeouts, feature flags, package properties, targeted dimensions, and associated resources. ```shell curl -X POST http://localhost:8081/releases \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "x-organisation: acme-corp" \ -H "x-application: mobile-app" \ -d '{ "config": { "boot_timeout": 30000, "package_timeout": 60000, "properties": { "feature_flags": { "new_ui": true, "dark_mode": true } } }, "package_id": "tag:v2.0.0", "package": { "properties": { "version_name": "2.0.0", "build_number": "123" }, "important": [ "bundles/vendor.js@tag:latest", "bundles/core.js@tag:latest" ], "lazy": [ "assets/logo.png@tag:latest", "assets/icons.png@tag:latest" ] }, "dimensions": { "app_version": "2.0.0", "user_cohort": "beta_testers" }, "resources": [ "config/settings.json@tag:latest" ] }' ``` -------------------------------- ### Install `cargo-watch` Source: https://github.com/juspay/airborne/blob/main/README.md Installs the `cargo-watch` utility, which enables hot-reloading for Rust development by automatically recompiling and restarting the application when code changes are detected. ```bash cargo install cargo-watch ```