Beginner30 minutesUpdated October 2025

How to Convert Your Next.js App to iOS & Android

Learn how to transform your Next.js web application into fully functional iOS and Android mobile apps using Capacitor. This guide covers installation, configuration, and deployment to app stores.

📋 Prerequisites

  • Existing Next.js application
  • Node.js 18+ installed
  • Basic knowledge of React
  • Xcode (for iOS) or Android Studio (for Android)

🎯 What You'll Learn

  • Install and configure Capacitor in a Next.js project
  • Build your Next.js app for mobile
  • Add native mobile capabilities
  • Test your app on iOS and Android simulators
  • Deploy to the App Store and Google Play

Step-by-Step Guide

1

Install Capacitor

First, install Capacitor core and CLI packages in your Next.js project. Make sure your Next.js app is working locally before proceeding.

npm install @capacitor/core @capacitor/cli
npx cap init

💡 Note: When prompted, enter your app name and bundle ID (e.g., com.yourcompany.appname).

2

Configure Next.js for Static Export

Capacitor works best with static exports. Update your Next.js configuration to enable static site generation.

next.config.ts
const nextConfig = {
  output: 'export',
  images: {
    unoptimized: true,
  },
  // Disable trailing slashes for Capacitor
  trailingSlash: true,
};

export default nextConfig;

💡 Note: The 'output: export' setting generates static HTML/CSS/JS files that Capacitor can wrap.

3

Update Package.json Scripts

Add convenient scripts to build and sync your app with mobile platforms.

package.json
{
  "scripts": {
    "build": "next build",
    "cap:build": "npm run build && npx cap sync",
    "cap:ios": "npm run cap:build && npx cap open ios",
    "cap:android": "npm run cap:build && npx cap open android"
  }
}
4

Configure Capacitor

Update the Capacitor configuration to point to your build output directory.

capacitor.config.ts
import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'com.yourcompany.appname',
  appName: 'Your App Name',
  webDir: 'out',
  server: {
    androidScheme: 'https'
  }
};

export default config;

💡 Note: The 'webDir' should point to 'out' since that's where Next.js exports static files.

5

Add iOS and Android Platforms

Now add the iOS and Android platforms to your project. This creates native project folders.

npx cap add ios
npx cap add android

💡 Note: This will create 'ios' and 'android' folders in your project root.

6

Build and Sync Your App

Build your Next.js app and sync it with the native platforms.

npm run build
npx cap sync

💡 Note: Run 'npx cap sync' whenever you make changes to your web code or add new Capacitor plugins.

7

Open in Xcode or Android Studio

Open your project in the respective IDE to test and build for mobile.

# For iOS
npx cap open ios

# For Android
npx cap open android

💡 Note: You'll need Xcode for iOS development (Mac only) and Android Studio for Android development.

8

Test on Simulators/Emulators

In Xcode or Android Studio, select a simulator/emulator and click the Run button. Your Next.js app will launch as a native mobile app!

💡 Note: Common issues: Make sure your build completed successfully and the 'out' directory exists.

9

Add Mobile-Specific Features (Optional)

Enhance your app with native capabilities like camera, push notifications, or file access.

# Install plugins
npm install @capacitor/camera
npm install @capacitor/push-notifications

# Sync with native projects
npx cap sync

💡 Note: Each Capacitor plugin provides native functionality through a JavaScript API.

🚀 Next Steps

  • Add app icons and splash screens
  • Configure push notifications
  • Set up in-app purchases with RevenueCat
  • Implement deep linking
  • Prepare for App Store submission

Ready to Build Your Mobile App?

Get NextNative and start converting your Next.js website to a mobile app in minutes.

🎁50% off for the first 40 customers, 5 left

Related Tutorials

Compare Mobile Frameworks

Still deciding on your tech stack? Check out these comparisons

📚 Further Reading

Explore our comprehensive documentation to learn more about NextNative features and capabilities.