Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron app with database

I'm creating a web app for ticket reservation. The only problem is the database. I don't want to tell my client to install XAMPP or set a database, etc.

Is there any way to package the app with the database?

like image 783
gian29 Avatar asked Jun 30 '18 23:06

gian29


People also ask

What database should I use for Electron app?

SQLite is a good option for a local database that you can ship with your application. It won't require the user to setup or install any extra dependencies. It's certainly not as full featured as a full on server, but it should be good enough for a local desktop app.

Does Electron need a backend?

Electron will act as a wrapper for the existing web app without requiring any changes to the backend. Setting up Electron is easy for this type of app! There are no changes needed at the web app codebase level.

What is the best database for electron?

MongoDB is a fantastic NoSQL database with a lot of resources. In MongoDB, a record is a document, which is a data structure with field and value pairs. It has a straightforward API that is simple to incorporate into your Electron application.

What is nedb for Electron apps?

If your electron app state is beyond what localStorage can manage, you need to bundle a database. NEDB is a mongo API compatible, file-based database. It’s a great fit for electron apps. In this post, I’ll walk through my NEDB setup. It’s fairly simple and is being used in production at HTTPSLocalhost app. nedb-promises is a wrapper around NEDB.

What's in the sqlectron app?

Databases - List of current supported databases. Download - Installers, binaries and source. Configuration - List of saved servers and custom configurations. Terminal - A terminal-based interface of Sqlectron. Contribute - Details on how you can contribute to Sqlectron. Something missing? Edit this app.

How to access a MySQL database in electron using Node JS?

Thanks to Node.js you'll be able to access a lot of features to create awesome apps, in this case we are going to use the mysql module to access a MySQL database within Electron. To interoperate with MySQL (in our case, we are using Xampp which includes PHPMyAdmin) using Node.js, you'll need the following node package named mysql.


2 Answers

SQLite is a good option for a local database that you can ship with your application. It won't require the user to setup or install any extra dependencies. It's certainly not as full featured as a full on server, but it should be good enough for a local desktop app.

like image 181
Jacobm001 Avatar answered Oct 16 '22 11:10

Jacobm001


There are many standalone databases you can use with JavaScript and Electron applications. Here are some that I can recommend

https://github.com/louischatriot/nedb (last release 4 years ago)

https://github.com/pubkey/rxdb (many features, observable queries)

https://github.com/pouchdb/pouchdb (many open issues)

https://github.com/techfort/LokiJS (only in-memory storage)

https://github.com/typicode/lowdb (good for simple, small datasets)

like image 34
pubkey Avatar answered Oct 16 '22 11:10

pubkey