nextjs-native-trpc icon indicating copy to clipboard operation
nextjs-native-trpc copied to clipboard

Comparison to PWABuilder

Open maiconcarraro opened this issue 1 year ago • 0 comments

First of all, awesome project and thanks for the explanations in the README, 100% agree on PWA downsides here: https://github.com/RobSchilderr/nextjs-native-trpc?tab=readme-ov-file#why-not-make-a-pwa-instead

I'll start this issue only for discussion and maybe to help other devs if they have the same question, for reference PWABuilder is a tool from Microsoft to generate the native apps based on your PWA application.

  • For Android it's going to use bubblewrap which launches a TWA, and you can still have access to the android source code, and customize push notifications (example)
  • For iOS it's experimental, but it's basically a native swift wrapper that is going to load the website w/ WKWebView and allow some features like push notification using window listeners events + js evaluation (example1 and example2) and the Apple Login + Next-auth seems to work fine under this approach (saw a warning about this in the readme w/ universal links redirect).

The strong benefit of this approach is to write a single web project, since it's going to work as TWA for android and webview for iOS, push notifications that are usually the blocker against PWA (mainly related to iOS) is solved and it will be available in Google and Apple stores,

The CONS I'm facing is mainly related to the TWA that will use a specific browser depending on the device, so if you have a samsung device it's very likely going to use Samsung internet and their TWA support is not the best, so I'm looking for new solutions that can make it stable, or at least consistent across all Androids.

Now about this project Next.js + Capacitor, it's looking closer to create-t3-turbo (Next.js + Expo) where you write "twice" the web and ~native layout, when I was checking this tutorial https://galaxies.dev/nextjs-and-capacitor (also mentioned in the README) I thought the idea would be to have the same Next.js folder exporting to capacitor and also deploying it for the web usage, only different build commands but still same codebase... is it not possible? I probably misunderstood, but I want to discuss to get some ideas/approaches.

I don't have experience using Capacitor, so I'm assuming that APIs like Share will work fine for both build flows, since it provides Shared Web API for web environment. Lmk if I misunderstood, I'm going to explore the project and plugins, but started this discussion in case you can share some thoughts around these ideas.

maiconcarraro avatar Oct 12 '24 17:10 maiconcarraro