• Stars
    star
    1,664
  • Rank 28,091 (Top 0.6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A starting point for building an iOS, Android, and Progressive Web App with Tailwind CSS, React w/ Next.js, Ionic Framework, and Capacitor

Next.js + Tailwind CSS + Ionic Framework + Capacitor Mobile Starter

Screenshot

This repo is a conceptual starting point for building an iOS, Android, and Progressive Web App with Next.js, Tailwind CSS, Ionic Framework, and Capacitor.

Next.js handles the production React app experience, Tailwind can be used to style each page of your app, Ionic Framework provides the cross-platform system controls (navigation/transitions/tabs/etc.), and then Capacitor bundles all of it up and runs it on iOS, Android, and Web with full native access.

See this blog post for an overview of the stack and how it all works: https://dev.to/ionic/build-mobile-apps-with-tailwind-css-next-js-ionic-framework-and-capacitor-3kij

Usage

This project is a standard Next.js app, so the typical Next.js development process applies (npm run dev for browser-based development). However, there is one caveat: the app must be exported to deploy to iOS and Android, since it must run purely client-side. (more on Next.js export)

To build the app, run:

npm run build
npm run export

All the client side files will be sent to the ./out/ directory. These files need to be copied to the native iOS and Android projects, and this is where Capacitor comes in:

npx cap sync

Finally, to run the app, use Capacitor 3 new awesome run command:

npx cap run ios
npx cap run android

Livereload/Instant Refresh

To enable Livereload and Instant Refresh during development (when running npm run dev), find the IP address of your local interface (ex: 192.168.1.2) and port your Next.js server is running on, and then set the server url config value to point to it in capacitor.config.json:

{
  "server": {
    "url": "http://192.168.1.2:3000"
  }
}

Note: this configuration wil be easier in Capacitor 3 which recently went into beta.

API Routes

API Routes can be used but some minimal configuration is required. See this discussion for more information.

Caveats

One caveat with this project: Because the app must be able to run purely client-side and use Next.js's Export command, that means no Server Side Rendering in this code base. There is likely a way to SSR and a fully static Next.js app in tandem but it requires a Babel plugin or would involve a more elaborate monorepo setup with code sharing that is out of scope for this project.

Additionally, Next.js routing is not really used much in this app beyond a catch-all route to render the native app shell and engage the Ionic React Router. This is primarily because Next.js routing is not set up to enable native-style transitions and history state management like the kind Ionic uses.

What is Capacitor?

You can think of Capacitor as a sort of "electron for mobile" that runs standard web apps on iOS, Android, Desktop, and Web.

Capacitor provides access to Native APIs and a plugin system for building any native functionality your app needs.

Capacitor apps can also run in the browser as a Progressive Web App with the same code.

More Repositories

1

ionic-react-hooks-demo

Basic demo using hooks with Ionic React
JavaScript
20
star
2

jquerymobile-tabbar

An easier to use NavBar control for jQuery Mobile apps
JavaScript
11
star
3

ionic-core-angularjs-demo

A very simple prototype of using Ionic Core (Ionic web components, not yet released) with AngularJS
HTML
8
star
4

github-multi-dashboard

Multi-repo dashboard for better managing OSS projects
TypeScript
7
star
5

opencount

opencount
JavaScript
7
star
6

arduino-snippets

Helpful snippets for Arudino C++ projects
C++
7
star
7

dev-app

Objective-C
7
star
8

ionic-capacitor-chatgpt-starter

JavaScript
5
star
9

codiqa-jquerymobile-icons

Icons for use in jQuery Mobile and other projects
5
star
10

ionic-vue-demo

Ionic Vue Demo
Vue
4
star
11

mlynch

3
star
12

ionic-react-firebase-demo

TypeScript
3
star
13

ionic-react-example

TypeScript
3
star
14

pgday-eu-2017-perf

3
star
15

capacitor-watchkit-example

Example repo of including a WatchKit extension with Capacitor integration to communicate between the Watch and the App
Swift
3
star
16

BeautifulSoupPlus

2
star
17

app-generator-page-template

An example of a custom page template for the App Generator
HTML
2
star
18

ionic-react-routing-case

TypeScript
2
star
19

capacitor-remote-offline-example

JavaScript
2
star
20

ionifits-example

TypeScript
2
star
21

square-words

A simple Ionic app for building instagram word images.
JavaScript
2
star
22

Vim-Dotfiles

My collection of vim dotfiles
Vim Script
1
star
23

ionifits

Python
1
star
24

mlynch.github.com

HTML
1
star
25

codiqa-blog

Pages and code samples for the codiqa.com blog
1
star
26

capacitor-plugin-example-embedded

TypeScript
1
star
27

studio-demo-workout

Workout log demo app for Studio
TypeScript
1
star
28

capacitor-keyboard-toolbar-demo

Custom native toolbar on top of keyboard on iOS in Capacitor/Ionic apps
TypeScript
1
star
29

stencil-transform-angularjs

Prototype AngularJS component/directive generator from a typed web component
JavaScript
1
star
30

madison-iterators

JavaScript
1
star
31

grunt-stylevalidate

grunt-stylevalidate
JavaScript
1
star
32

github-multi-repo-dashboard

Nothing to see here, move along
TypeScript
1
star
33

scheming

Prototype scheme interpreter for practice purposes, very incomplete
TypeScript
1
star