Offline-first database instead of sqlite - node.js

I found a big, HUGE problem with sqlite3 module. when i try to build for windows, it doesn’t work due to issues between sqlite module and electron-builder.
i was thinking to change te database to something that still works offline.
It’s not important that is a RDMS or NOSQL (all the data are stored in json files on a soap services which i transform in sqlite statement)
the important (vital) issue is that it must work offline.
i've been trying just packing the app using electron-packager

If your main concern is that It should work offline I will recommend give a try to Indexeddb it stores data into the users browser.

Related

Vue Frontend + NodeJS backend - local web app (browser)

I need to create an application which will be ran on the browser (local only, not hosted online). I will need to use a lightweight database which has a physical file (eg SQLite3, so I can have a .db file).
Also, just to mention:
I cant use IndexedDB alone to save the data because clearing browser data would clear the entire "database".
I also wouldn't be able to use electron since the bundle is too big. I need the browser for its portability
Also cant use PouchDB, since due to security constraints, online sync (CouchDB, etc) is not possible. Then it would be 100% stored in IndexedDB, which brings me back to my point on bullet 1
My question is - is there a way to create an offline web application build with VueJS frontend + NodeJS backend? I only need NodeJS because SQLite only works on the Node environment.
Deployment is preferably in .html only (is there any way that is possible, and access only using the file protocol file://)? Otherwise, I may consider using a local web server (localhost) - I'm not sure though if it is possible to serve an html file without any installations (node, python, etc), so I would still have to check all my options about this.
Any thoughts?
I am still new to this so please bear with me! There is very limited info online that talks about a 100% offline web application. Thanks a lot!

Cannot Write File in Electron App After Build

I know this is a repetitious question but i can't find any answer
I want to store my electron app data in a local json file
This works very good but after packaging and building it doesn't work
I tried to run app in administrator but that doesn't work again!
i don't know how to solve this problem
There is a way to store data in electron app No Matter How
thanks
Where are you saving this file? Unless you have admin access, you can't save to certain directories because that would expose a lot of potential security holes of written apps.
There was a package written that allows you to save data in a file for your app, making use of the path of app.getPath("userData"). This is the magic path you need to be using, app.getPath("userData"). If you aren't saving your data to this path, you will require admin access.
That package although makes use of outdated security practices, so if you want to still save your electron data to a file with better practices (ie. using IPC instead of the remote module), I'd recommend this template that I am an author of.

Distributable database with my application

I am creating a NodeJs Desktop application using node-webkit and right now using MongoDB as a database.
I want to distribute it as an executable where users will be able to use the application without installing the database by utilizing their own copy of local DB.
Is there a way i can make a local copy for their DB during the installation.
If it is not possible in MongoDB, what other DB should i use?
well its based on your data needs, if you have large set of data you should use mongoDB otherwise there are lots of databases for your NWJS app. check this link https://github.com/nwjs/nw.js/wiki/Save-persistent-data-in-app some of them are good enough to hold big data. but personally i prefer sqlite3 with NWJS(there is a lot of hustle to install it for NWJS) sqlite can work with large data check this page for more info.
if you are going with mongoDB then you should download the the zip not the installer and pack it with your installer the you should be good to go.
by default mongoDB stores its data in /data/db but you can change it to your preferred location

Is there a way to self-host mongoose databases?

I am getting started with writing an API for a project and the tutorial I am following suggests I sign up for a hosted solution. I think that is ridiculous. My project is simple and I do not feel the need to be locked in to a service. If it helps, I am using Express.
Mongoose is a node.js module (library) which is used to interact with a database, called MongoDB.
There are some websites like mongolab.com which offer plans for development for free, so you would jsut need to sign up and you will get a database without installink anything in your computer/server etc. This is why they say it is easier.
You can install MongoDB in your local computer to test (I think most of us have it) and use just that one for developing and testing.
To install MongoDB it all depends which Operating System you are using at the moment. But you can look up on google: "Install MongoDB MacOSX/Window/Ubuntu/etc.." and normally is just one simple command. To connect to it in your local you don't need a user or anything I guess.

CoreData without changes in underlying models

Good day,
I have an app with CoreData that is in the Apps Store. I have now coded some
cosmetic changes in the interface without changing anything in the CoreData model.
I did not add/delete/or change any entity or property. Now, I am ready to upload my
version 2 of the app. I am unsure whether I have to do anything so that the old data
of the users in the first version will not be deleted but will be saved in the
new app (with exactly the same CoreData model). Please be tolerant with this noob.
Great thanks,
Romeo
When someone installs a new version of an app they already have, all the app's data stays where it is-- it doesn't get deleted.
Whether this data is compatible with the new version is a different question. If you haven't made any changes to the data model, then it should be fine. But you should make sure. Testing the upgrade process is one of the most important parts of testing a new version of an app. Install the current version, generate some data, and then install your new version and make sure everything looks OK. As you describe it, there shouldn't be any problems, but you should never just trust that this is the case.
In Marcus Zarra's Core Data Migration Course on iDeveloper TV, he suggests manually locking your xcdatamodel file so that you can't accidentally make updates to it and force a migration when you didn't plan it. But I agree with Tom, test it first.
iDeveloper.TV Core Data Migration

Resources