Platform · mobile

Mobile

iPhone and Android apps through Capacitor, with storage, the back button, deep links and safe areas handled natively.

  • iOS
  • Android
kitr add mobile phone

First time? Run npm i -g @kitr/kitr once. Inside a project, the global kitr runs your project's own version.

Built onCapacitor
// app/components/shell.tsx
import { useBackButton, useSafeArea } from '@kitr/platform/react'
import { useCallback, type ReactNode } from 'react'

export function Shell({ children }: { children: ReactNode }) {
  const insets = useSafeArea()
  useBackButton(
    useCallback(({ canGoBack }) => canGoBack && window.history.back(), []),
  )
  return <main style={{ paddingTop: insets.top }}>{children}</main>
}

Native projects you own

The Xcode and Android Studio projects live in platforms/phone/. kitr dev adds them the first time and --target ios picks one.

Live reload on the device

The app on your phone loads the dev server over the network, so a saved file shows up on the device in a second.

Hooks for the device

usePlatform, useAppState, useBackButton, useDeepLink and useSafeArea answer the same way in the browser and in the app.

Storage that survives

Storage items move to Capacitor Preferences, which iOS and Android keep when they clear a webview to free space.

Same commands as every platform

Every platform answers to kitr dev, kitr build and kitr start, by the name you gave it. Leave the name off to run them all.

kitr dev phone
live reload on a device or simulator, port 3100
kitr build phone
the web build synced into ios/ and android/
kitr doctor
checks Xcode and Android Studio

Packages that work here

32 packages run on mobile. Each one is a single kitr add away.

All packages →

Learn more

Start from a kit

A kit sets up the platforms, the packages and a first page in one command.

kitr new my-app --kit mobile

First time? Run npm i -g @kitr/kitr once. Inside a project, the global kitr runs your project's own version.

Add another platform

Platforms share the app/ folder, so adding one is a command, not a rewrite.

Mix and match →