Cow258 / zoom-demo

0 stars 0 forks source link

Question about your usage of Next.js #1

Open jgoux opened 3 years ago

jgoux commented 3 years ago

Hello !

I'm so sorry to contact you by opening an issue but I didn't find any other way. xD

I saw your PR here : https://github.com/vercel/next.js/pull/16650

So I assume you're using Next.js for building desktop and mobile app using Electron and Ionic / Capacitor?

At my company we plan to do the same, would you be available somewhere on discord/slack/twitter/email to have a little chat about it? I'd love to know how is it working for you! You can find me on twitter here : https://twitter.com/_jgx_

Take care, have a nice week-end!

Cow258 commented 3 years ago

Here are many benefit with using Next.js to building desktop and mobile app, Coding once and build every where. The most easy part is just simple run Next.js Static Export with different ENV, ENV will effecting next.config.js, Then it built different platforms static files.

// _app.js
const { publicRuntimeConfig } = getConfig();

// isMobile is assigned by next.config.js by ENV
if (publicRuntimeConfig.isMobile) {
  Cordova.init();
}

The hardest part is the end-user framework, Many stuff working on how to integrate, Just imagine Electron/Cordova is a agent between Next.js and Device, You need find a way to let this agent strong enough.

e.g. Next.js want scan QR code, It call agent open QR code scanner, agent should open the camera, analyze the image, callback the result when something scanned.

Native part (camera/gps/notification) Electron/Cordova Go find plug-in Modify the setting to fit you Should be framework only Provide enough internal API of Next.js Should not be changed often Only update when you need more plug-in and native functions

UI Logic / The App Next.js All your App written here. How your App look like. How your App work. How & When to call internal framework API. How & When to call back-end API.

Business Logic Back-end API server Node.js Express / Koa / Strapi / GraphQL / REST / CRUD ...

Sorry for my bad English. Hope I can help you. Thanks.