Tutorial9 min read

Convert your Astro site to iOS and Android with Capacitor

Take an Astro site to native iOS and Android with Capacitor using static output, add device plugins, and ship content and UI changes over the air with OtaKit live updates.

Astro builds fast, content-rich sites, and with static output it wraps cleanly as a native app. If you've built a site or app in Astro and want it on iOS and Android, Capacitor takes the static build to the stores — and OtaKit pushes content and UI changes over the air afterward. This guide covers the full path.

The one requirement: build Astro to static output. Capacitor ships a folder of static assets to the device, so a server-rendered Astro deployment needs to be configured for a static build first.

1. Configure a static build

Use Astro's static output (the default for content sites) so astro build emits a self-contained dist/. If you use SSR features, move the dynamic parts to client-side fetches against your API so the shipped bundle is fully static.

2. Add Capacitor

npm install @capacitor/core @capacitor/cli
npx cap init
npm install @capacitor/ios @capacitor/android
npx cap add ios
npx cap add android

Point webDir at dist, then astro build && npx cap sync.

3. Handle routing and links

Astro's multi-page routing works on device, but make sure internal links resolve relative to the bundle and external calls use absolute URLs. Test navigation on a real device — static multi-page apps sometimes surprise you with how they resolve paths inside the WebView.

4. Add the native polish

5. Ship content updates over the air

This is where Astro + OTA shines: content-heavy apps change their content constantly. Rebuild and push over the air instead of resubmitting:

otakit upload --release production

For a content app, OTA is effectively a CMS-to-device pipeline: publish, rebuild, push, and the new content is live without a store cycle.

Where to go next

See the framework-agnostic Vite guide for the general pattern and Setup to wire up OtaKit.

Related docs