How to Create Mobile App using Next.js

Updated 11 February 2026

Building a native mobile app usually takes time and effort. However, with Next.js and BagistoNative, the process becomes simple.

Using BagistoNative, you can turn your existing Next.js project into a real native iOS and Android app.

You keep one codebase and share it across web and mobile.

This guide walks you through everything step by step. By the end, your app will run on the web, iOS, and Android.

Why Use BagistoNative with Next.js?

BagistoNative Framework connects your Next.js app to native mobile features.

With it, you can:

As a result, development becomes faster and more scalable.

y20Qbscqg90

Prerequisites

Before starting, make sure you have:

Check the detail documetaion of setting up BagistoNative with next.js

Project Setup

Create or Use a Next.js Project

First, create a new Next.js project:

You can also use an existing Next.js project.

We provide a fast, scalable, and production-ready storefront that you can use directly or customize to fit your needs. Check the demo here.

Install BagistoNative Libraries

Next, open your package.json file and add:

Then install the dependencies:

Make Your Next.js App Native Mobile Ready

Add Environment Variables

If your app uses APIs or special configuration, add them to:

This keeps your settings secure and organized.

Load Hotwire for Native Features

Now, open your main layout file, such as app/layout.tsx. Add the following script:

This script allows communication between your Next.js app and the native mobile shell.

Detect Native Mobile App Environment

BagistoNative framework provides helpers to detect if your app is running inside a native mobile app.

Client-Side Detection

This is useful when you want to change layouts or behavior for mobile users.

Server-Side Detection

This ensures correct rendering during server-side rendering.

Add Native Mobile Features Easily

BagistoNative allows your Next.js app to trigger native actions.

Update Cart Count in Native App

This sends the cart count directly to the native mobile app.

Show Native Toast Messages

This displays a native toast notification.

next.js-native-toast

Share User Location (Full Component)

When tapped inside the native app, this opens the device’s location-sharing dialog.

native-location

Light and Dark Theme Toggle

This works for both web and native mobile apps.

native-theme

Search Component with BagistoNative Integration

The following search component supports both web and native mobile search events.

This component integrates smoothly with BagistoNative search events.

native-search

Switch UI for Native Mobile

This allows you to customize layouts for mobile users.

Connect Web and Native Mobile App

Cart Modal Bridge

Search Router Bridge

These bridges allow native apps to trigger UI actions in your Next.js app.

Bagisto Native Framework provides a wide range of built-in native components that you can easily use in your Next.js applications.

Explore all the available components here in detail.

Run and Test Your Native Mobile App

Start the development server:

Now test your app:

Generate the APK and IPA of the Next.js app

After your Next.js app is ready, you can connect it to real native iOS and Android apps in just a few steps!

Step 4: Determine Your Project URL

Your native apps will talk to your Next.js project using a Project URL.

Use your local network URL (like http://localhost:3000) or your custom domain.

⚠️ Make sure your phone/simulator and your computer are on the same network if running locally. Do NOT use Vercel preview links for local development.

iOS: Set Up for iOS App

  1. Clone the iOS App Repository:

iOS App Repo Reference

  1. Open the Project in Xcode:

  1. Configure Base URL in iOS App: In Xcode, find the line:

Change it to your Next.js project URL, for example:

  1. Build & Run the iOS Application:

Android: Set Up for Android App

  1. Clone the Android App Repository:

Android App Repo Reference

  1. Open the Project in Android Studio:
  1. Configure Base URL in Android App:
  1. Build & Run the Android Application:

Congratulations! Your native iOS and Android apps are now connected to your Next.js project and ready to use

Conclusion

Using Next.js, build true native iOS and Android apps. If you’re new to BagistoNative Framework, check the detailed documentation.

With a single Next.js codebase, you can build:

All three platforms share the same code and logic.

This approach allows you to build iOS and Android apps with Next.js, faster and with less complexity.

It is flexible, scalable, and ready for production use.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project




    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home