Home > OS >  Angular SPA for Offline Use (with DDBB)
Angular SPA for Offline Use (with DDBB)

Time:04-07

I am developing an invoice app with Angular NodeJs MySql.

The thing is, the app is planned to be used by one employee in his office. No need for online servers.

It is not problematic to deploy the app online, but the internet is unstable in the zone (Latinamerican problem. You may lose connection for hours, and even voltage variations that may shut down the PC).

So the app must be self sufficient to always work offline.

So my questions are:

  1. Can I simply deploy the app offline? Like in local. If that is the case, I would need for everything to be initialized automatically when the user opens the app (server open, database connected...).

  2. If I have no way but to deploy the app online, should I use Firebase? Also, what happen if the internet service shut downs for hours? Is there a way for the database to be available offline and sync when the internet gets back?

CodePudding user response:

You can use both ways if you want to be sync like situation you have to hold data if your internet is not working in local storage or indexed db.

and it is fine you can deploy locally also or make one dedicated server which is always on.so any body in same network can use that angular app easily.

Just take care of backup plan when you system corrupt you should have proper backup of database for such scenario.

CodePudding user response:

  1. You could build the app as an Electron App, then its becomes a locally run program. https://www.electronjs.org/

  2. You can host it anywhere, but turn the app in to a PWA, which means it will work locally in the browser after a successful visit (gets installed with a service worker in browser) For the database it self, you can store data in the browser but some are limited to 5mb of data in the localstorage / sessionStorage / indexdb. Firebase does have some locally cached data. But if the browser is closed it can be lost.

If it needs to run locally i would go the electron route. Its slightly harder to do but it fills out your usecase better.

  • Related