@capacitor/app
The official Capacitor plugin for app lifecycle events, deep links, and app state
Repository Health
Technical Analysis
@capacitor/app is one of Ionic’s official Capacitor plugins, part of the capacitor-plugins monorepo alongside action-sheet, browser, clipboard, device, dialog, network, share, splash-screen, and status-bar. It handles high-level application state and lifecycle events — emitting events when the app enters or leaves the foreground, handling incoming deep links (universal links / app links), opening other installed apps, and exposing persisted plugin state — through a single consistent JS API backed by native Swift and Java/Kotlin implementations.
Because nearly every Capacitor app needs to react to backgrounding, resuming, or deep-link URLs, @capacitor/app is one of the most consistently installed plugins in the ecosystem, making it a representative entry point into how Capacitor’s official plugin packages are structured, tested, and released as a monorepo of independently versioned npm packages.
What You Get
- App.addListener(‘appStateChange’, …) to react when the app enters or leaves the foreground
- App.addListener(‘appUrlOpen’, …) to handle incoming deep links and universal/app links
- App.addListener(‘backButton’, …) to intercept Android’s hardware back button
- App.exitApp() and App.minimizeApp() to programmatically control the app’s foreground state
- App.getState() and App.getLaunchUrl() for reading current state and how the app was launched
- Native Swift and Java/Kotlin implementations behind a single consistent TypeScript API
Common Use Cases
- Pausing video playback, timers, or network polling when the app is backgrounded and resuming on foreground
- Routing users to the correct in-app screen when the app is opened via a deep link or universal link
- Overriding Android’s hardware back-button behavior to navigate within a single-page app instead of exiting
- Persisting and restoring UI or session state around app termination and relaunch
Under The Hood
Architecture: @capacitor/app follows the standard Capacitor plugin structure — src/definitions.ts declares the TypeScript interface, src/web.ts implements a browser fallback where native APIs don’t apply, and platform-native code (ios/Sources in Swift, android/src in Java/Kotlin) implements the actual OS-level hooks (UIApplication lifecycle delegates on iOS, Activity lifecycle callbacks on Android) that get bridged back to JS listeners registered via Capacitor’s core plugin event system.
Tech Stack: The monorepo spans Java (46%, Android plugin implementations), Swift (27%, iOS plugin implementations), and TypeScript (22%, shared JS API layer), managed with Nx and Lerna for versioning and cross-package builds, with each plugin (including app) shipping its own LICENSE, podspec, and Gradle build file so plugins can be installed and updated independently.
Code Quality: Each plugin directory, including app, ships its own ios/Tests directory for native test coverage alongside the shared TypeScript definitions; the monorepo has 88 contributors and releases roughly 1.4 times per week across its packages, with CI running per-platform builds (Ruby-based fastlane/cocoapods tooling appears in the release_frequency-driving workflows) before publishing.
API Design: The plugin’s public API is a small set of listener registrations and imperative methods (getState, getLaunchUrl, exitApp, minimizeApp) that follows the same addListener/removeAllListeners pattern used across every other official Capacitor plugin, so once a developer learns one plugin’s API shape, @capacitor/app requires no additional conceptual overhead.
Used by 5 apps in this directory
AFFiNE
Productivity · Project Management · Note Taking
Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.
Bramble
Password Manager · Security · Authentication
Local-first, end-to-end encrypted password manager that syncs your vault directly between your own devices over a private peer-to-peer mesh — no server, no account, no cloud in the middle.
Logseq
Note Taking · Knowledge Management
A privacy-first, open-source knowledge graph platform combining Markdown, Org-mode, bidirectional linking, and local-first storage for building your second brain.
Supabase
Developer Tools · Databases · Search
The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.
Super Productivity
Productivity · Project Management
A privacy-respecting, local-first task manager with built-in timeboxing, Pomodoro timer, and deep integrations for Jira, GitHub, GitLab, and CalDAV — no accounts, no data collection, ever.